<br />要实现的是still image capture & PTP<br /><br />descriptor 如下:<br /><br />const u8 SIC_DeviceDescriptor[SIC_SIZ_DEVICE_DESC] ={<br /> 0x12, /* bLength */<br /> 0x01, /* bDescriptorType */<br /> 0x00, /* bcdUSB, version 1.00 */<br /> 0x01,<br /> 0x00, /* bDeviceClass : See interface */<br /> 0x00, /* bDeviceSubClass : See interface*/<br /> 0x00, /* bDeviceProtocol : See interface */<br /> 0x08, /* bMaxPacketSize0 0x40 = 64 */<br /> 0x83, /* idVendor (0483) */<br /> 0x04,<br /> 0xb4, /* idProduct */<br /> 0x14,<br /> 0x1A, /* bcdDevice*/<br /> 0x01,<br /> 0x01, /* iManufacturer : index of string Manufacturer */ <br /> 0x02, /* iProduct : index of string descriptor of product */ <br /> 0x03, /* iSerialNumber : index of string serial number */ <br /> 0x01 /* bNumConfigurations */<br />};<br /><br />const u8 SIC_ConfigDescriptor[SIC_SIZ_CONFIG_DESC] = {<br /> 0x09, /* bLength: Configuation Descriptor size */<br /> 0x02, /* bDescriptorType: Configuration */<br /> SIC_SIZ_CONFIG_DESC,<br /> /* wTotalLength: Bytes returned */<br /> 0x00,<br /> 0x01, /* bNumInterfaces: 1 interface */<br /> 0x01, /* bConfigurationValue: Configuration value */<br /> 0x00, /* iConfiguration: Index of string descriptor describing the configuration */<br /> 0x80, /* bmAttributes: bus powered */<br /> 0x52, /* MaxPower 100 mA: this current is used for detecting Vbus */<br />/* 09 */<br /><br />/*** Descriptor of DFU interface 0 Alternate setting 0 ***/<br /> 0x09, /* bLength: Interface Descriptor size */<br /> 0x04, /* bDescriptorType: */<br /> 0x00, /* bInterfaceNumber: Number of Interface */<br /> 0x00, /* bAlternateSetting: Alternate setting */<br /> 0x03, /* bNumEndpoints*/<br /> 0x06, /* bInterfaceClass: SIC */<br /> 0x01, /* bInterfaceSubClass */<br /> 0x01, /* nInterfaceProtocol :PTP*/<br /> 0x04, /* iInterface: */<br />/* 18 */<br /> 0x07, /* bLength: Endpoint Descriptor size */<br /> 0x05, /* bDescriptorType: */<br /> 0x81, /* bEndpointAddress: */<br /> 0x02, /* bmAttributes: bulk transfers */<br /> 0x40, /* wMaxPacketSize:64 bytes */<br /> 0x00,<br /> 0x00, /* bInterval:Ignored */<br />/* 25 */<br /> 0x07, /* bLength: Endpoint Descriptor size */<br /> 0x05, /* bDescriptorType: */<br /> 0x01, /* bEndpointAddress: */<br /> 0x02, /* bmAttributes: bulk transfers */<br /> 0x40, /* wMaxPacketSize:64 bytes */<br /> 0x00,<br /> 0x00, /* bInterval:Ignored */<br />/* 32 */<br /> 0x07, /* bLength: Endpoint Descriptor size */<br /> 0x05, /* bDescriptorType: */<br /> 0x83, /* bEndpointAddress: */<br /> 0x03, /* bmAttributes: interrupt transfers */<br /> 0x40, /* wMaxPacketSize:64 bytes */<br /> 0x00,<br /> 0x00, /* bInterval:Ignored */<br />/* 39 */<br />}; /* SIC_ConfigDescriptor */<br /><br />可以把基本的descriptor给传上去,pc识别为digital still camera。<br />一下为BUS HOUND的监控结果:<br />****************************************************<br />*************** monitor start **********************<br />****************************************************<br />Bus Hound 5.00 capture. Complements of www.perisoft.net<br /><br /> Device - Device ID (followed by the endpoint for USB devices)<br /> (20) Digital Still Camera<br /> Phase - Phase Type<br /> CTL USB control transfer <br /> DI Data in <br /> RSET bus reset <br /> USTS USB status <br /> Data - Hex dump of the data transferred<br /> Descr - Description of the phase<br /> Cmd... - Position in the captured data<br /><br /><br />Device Phase Data Description Cmd.Phase.Ofs(rep)<br />------ ----- -------------------------------------------------- ---------------- ------------------<br /> 20.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 1.1.0 <br /> 20.0 DI 12 01 00 01 00 00 00 08 83 04 b4 14 1a 01 01 02 ................ 1.2.0 <br /> 03 01 .. 1.2.16 <br /> 20.0 CTL 80 06 00 02 00 00 09 00 GET DESCRIPTOR 2.1.0 <br /> 20.0 DI 09 02 27 00 01 01 00 80 52 ..'.....R 2.2.0 <br /> 20.0 CTL 80 06 00 02 00 00 27 00 GET DESCRIPTOR 3.1.0 <br /> 20.0 DI 09 02 27 00 01 01 00 80 52 09 04 00 00 03 06 01 ..'.....R....... 3.2.0 <br /> 01 04 07 05 81 02 40 00 00 07 05 03 02 40 00 00 ......@......@.. 3.2.16 <br /> 07 05 83 03 40 00 00 ....@.. 3.2.32 <br /> 20.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 4.1.0 <br /> 20.0 CTL a1 67 00 00 00 00 24 00 GET DEVICE STS 5.1.0 <br /> 20.0 DI 18 00 01 20 81 81 81 81 81 81 81 81 81 81 81 81 ... ............ 5.2.0 <br /> 81 81 81 81 81 81 81 81 ........ 5.2.16 <br /> 20.1 RSET 6.1.0 <br /><br />****************************************************<br />*************** monitor end ************************<br />****************************************************<br /><br />最后一步20.1 RSET,但是我监控的实际是clear feature: 02 01 00 81 00 <br />still image capture的spec上指明如果不支持feature则返回stall,我照做了,但没效果,卡在这边了!!!<br />从上一步讲:20.0 GET DEVICE STS,这个命令到底要回什么呢? <br />关于这个命令的回复,spec上写得有点难明白,请参照still image capture的spec1.0的11页。<br /><br />在线等,急!!!<br /><br /> 相关链接:<a href='https://bbs.21ic.com/upfiles/img/20082/20082482826899.pdf'>https://bbs.21ic.com/upfiles/img/20082/20082482826899.pdf</a> |
|