|
要做一个HID和MSD的复合设备,stm32f103在发送完config descriptor后出现问题。bushond如下: 21.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 1.1.0 21.0 DI 12 01 00 02 00 00 00 40 83 04 50 57 00 02 01 02 03 01 .......@..PW.... 1.2.0 21.0 CTL 80 06 00 02 00 00 09 00 GET DESCRIPTOR 2.1.0 21.0 DI 09 02 40 00 02 01 00 c0 32 ..@.....2 2.2.0 21.0 CTL 80 06 00 02 00 00 40 00 GET DESCRIPTOR 3.1.0 21.0 DI 09 02 40 00 02 01 00 c0 32 09 04 00 00 02 03 00 00 00 09 21 10 01 00 01 22 26 00 07 05 81 03 40 ..@.....2....... 3.2.0 00 20 07 05 01 03 40 00 20 09 04 01 00 02 08 06 50 04 07 05 83 02 40 00 00 07 05 02 02 40 00 00 . ....@. ....... 3.2.32 21.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 4.1.0
config descriptor如下:
const u8 CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] = { 0x09, /* bLength: Configuation Descriptor size */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */ CUSTOMHID_SIZ_CONFIG_DESC, /* wTotalLength: Bytes returned */ 0x00, 0x02, /* bNumInterfaces: 2 interface */ 0x01, /* bConfigurationValue: Configuration value */ 0x00, /* iConfiguration: Index of string descriptor describing the configuration*/ 0xC0, /* bmAttributes: Bus powered */ 0x32, /* MaxPower 100 mA: this current is used for detecting Vbus */ /* 09 */
/************** Descriptor of Custom HID interface ****************/ 0x09, /* bLength: Interface Descriptor size */ USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType: Interface descriptor type */ 0x00, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints */ 0x03, /* bInterfaceClass: HID */ 0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */ 0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */ 0, /* iInterface: Index of string descriptor */ /* 18 */ /******************** Descriptor of Custom HID HID ********************/ 0x09, /* bLength: HID Descriptor size */ HID_DESCRIPTOR_TYPE, /* bDescriptorType: HID */ 0x10, /* bcdHID: HID Class Spec release number */ 0x01, 0x00, /* bCountryCode: Hardware target country */ 0x01, /* bNumDescriptors: Number of HID class descriptors to follow */ 0x22, /* bDescriptorType */ CUSTOMHID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */ 0x00, /* 27 */ /******************** Descriptor of Custom HID endpoints ******************/
0x07, /* bLength: Endpoint Descriptor size */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */ 0x81, /* bEndpointAddress: Endpoint Address (IN) */ 0x03, /* bmAttributes: Interrupt endpoint */ 0x40, /* wMaxPacketSize: 64 Bytes max */ 0x00, 0x20, /* bInterval: Polling Interval (32 ms) */ /* 34 */ 0x07, /* bLength: Endpoint Descriptor size */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint descriptor type */ 0x01, /* bEndpointAddress: Endpoint Address (OUT) */ 0x03, /* bmAttributes: Interrupt endpoint */ 0x40, /* wMaxPacketSize: 2 Bytes max */ 0x00, 0x20, /* bInterval: Polling Interval (32 ms) */ /* 41 */ /************** Descriptor of MSD interface ****************/
0x09, /* bLength: Interface Descriptor size */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface descriptor type*/ 0x01, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints*/ 0x08, /* bInterfaceClass: MASS STORAGE Class */ 0x06, /* bInterfaceSubClass : SCSI transparent*/ 0x50, /* nInterfaceProtocol */ 4, /* iInterface: */ /* 50 */ /******************** Descriptor of MSD endpoints ******************/
0x07, /* Endpoint descriptor length = 7*/ 0x05, /* Endpoint descriptor type */ 0x83, /* Endpoint address (IN, address 3) */ 0x02, /* Bulk endpoint type */ 0x40, /* Maximum packet size (64 bytes) */ 0x00, 0x00, /* Polling interval in milliseconds */ /* 57 */ 0x07, /* Endpoint descriptor length = 7 */ 0x05, /* Endpoint descriptor type */ 0x02, /* Endpoint address (OUT, address 2) */ 0x02, /* Bulk endpoint type */ 0x40, /* Maximum packet size (64 bytes) */ 0x00, 0x00 /*Polling interval in milliseconds*/ /* 64 */ }
bushond显示host发送了set config,但跟踪发现mcu中没收到该命令,怀疑config descriptor设置有问题。但查不出来,请高手们帮忙解惑啦:)
|
|