本帖最后由 a07530033 于 2014-12-24 18:09 编辑
STM32 USB 描述2个接口 第一个接口可以正常使用第二个接口的设备识别不了
2个HID设备,一个是鼠标键盘,一个是自定义HID想用来升级的,这样子可以吗?
const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =
{
//struct CONFIGURATION_DESCRIPTOR Con_Desc;
0x09, // Length
0x02, // Type
CUSTOMHID_SIZ_CONFIG_DESC,0x00, // Totallength
0x02, // NumInterfaces
0x00, // bConfigurationValue0x01
0x00, // iConfiguration
0xA0, // bmAttributes
500/2, // MaxPower
//struct INTERFACE_DESCRIPTOR Int_Desc;
0x09, // bLength
0x04, // bDescriptorType
0x00, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints
0x03, // bInterfaceClass
0x01, // bInterfaceSubClass0x01
0x01, // bInterfaceProcotol0x01
0x00, // iInterface
//struct HID_DESCRIPTOR Hid_Desc;
0x09, //bLength--HID Class Descriptor Length (9)
0x21, //bDescriptorType: HID Class
0x10,0x01, //bcdHID
0x21, //bCountryCode,设备适用的国家代码,美国0x21
0x01, //bNumDescriptors
0x22, //REPORT_DESCRIPTOR
CUSTOMHID_SIZ_REPORT_DESC,0x00, //wDescriptorLength//CUSTOMHID_SIZ_REPORT_DESC
// INPUT endpoint (optional for HID)
0x07, // bLength
0x05, // bDescriptorType
0x81, // bEndpointAddress,端点1输入
0x03, // bmAttributes,中断模式
0x10,0x00, // MaxPacketSize (LITTLE ENDIAN),包长8byte
3, // bInterval,端点查询时间,10ms
// OUT endpoint (optional for HID)
0x07, // bLength
0x05, // bDescriptorType
0x02, // bEndpointAddress,端点2输出
0x03, // bmAttributes
0x10,0x00, // MaxPacketSize (LITTLE ENDIAN)
10, // bInterval
//struct INTERFACE_DESCRIPTOR Int_Desc;
0x09, // bLength
0x04, // bDescriptorType
0x01, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints
0x03, // bInterfaceClass
0x00, // bInterfaceSubClass0x01
0x00, // bInterfaceProcotol0x01
0x00, // iInterface
//struct HID_DESCRIPTOR Hid_Desc;
0x09, //bLength--HID Class Descriptor Length (9)
0x21, //bDescriptorType: HID Class
0x10,0x01, //bcdHID
0x21, //bCountryCode,设备适用的国家代码,美国0x21
0x01, //bNumDescriptors
0x22, //REPORT_DESCRIPTOR
CUSTOMHID_SIZ_REPORT_DESC_01,0x00, //wDescriptorLength
// INPUT endpoint (optional for HID)
0x07, // bLength
0x05, // bDescriptorType
0x83, // bEndpointAddress,端点1输入
0x03, // bmAttributes,中断模式
0x10,0x00, // MaxPacketSize (LITTLE ENDIAN),包长8byte
10, // bInterval,端点查询时间,10ms
// OUT endpoint (optional for HID)
0x07, // bLength
0x05, // bDescriptorType
0x04, // bEndpointAddress,端点2输出
0x03, // bmAttributes
0x10,0x00, // MaxPacketSize (LITTLE ENDIAN)
10,
/* */
};
看BUS HOUND抓取的内容好像只请求一个接口的报告描述符;
不是应该请求两个接口的报告描述符的吗?
Device Address Length Phase Data Description Delta Cmd.Phase.Ofs(rep) Date Time Driver
------ ------------------- -------- ----- -------------------------------------------------- ---------------- ----- ------------------ ---------- ------------ ------------
41.0 CTL 80 06 00 03 00 00 ff 00 GET DESCRIPTOR 4.3sc 1.1.0(2) 2014-12-24 18:00:45.437 usbhub
41.0 4 IN 04 03 09 04 .... 245us 1.2.0 2014-12-24 18:00:45.437
41.0 CTL 80 06 02 03 09 04 ff 00 GET DESCRIPTOR 95us 2.1.0(2) 2014-12-24 18:00:45.437 usbhub
41.0 32 IN 20 03 53 00 54 00 4d 00 33 00 32 00 20 00 43 00 .S.T.M.3.2. .C. 271us 2.2.0 2014-12-24 18:00:45.437
75 00 73 00 74 00 6d 00 20 00 48 00 49 00 44 00 u.s.t.m. .H.I.D. 2.2.16
41.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 12ms 5.1.0 2014-12-24 18:00:45.453 usbccgp
41.0 18 IN 12 01 00 02 00 00 00 40 c4 bc 45 03 03 00 01 02 .......@..E..... 252us 5.2.0 2014-12-24 18:00:45.453
03 01 .. 5.2.16
41.0 CTL 80 06 00 02 00 00 09 00 GET DESCRIPTOR 144us 6.1.0 2014-12-24 18:00:45.453 usbccgp
41.0 9 IN 09 02 49 00 02 00 00 a0 fa ..I...... 222us 6.2.0 2014-12-24 18:00:45.453
41.0 CTL 80 06 00 02 00 00 49 00 GET DESCRIPTOR 130us 7.1.0 2014-12-24 18:00:45.453 usbccgp
41.0 73 IN 09 02 49 00 02 00 00 a0 fa 09 04 00 00 02 03 01 ..I............. 373us 7.2.0 2014-12-24 18:00:45.453
01 00 09 21 10 01 21 01 22 a9 00 07 05 81 03 10 ...!..!."....... 7.2.16
41.0 CTL 81 06 00 22 00 00 00 04 GET DESCRIPTOR 2.0ms 8.1.0 2014-12-24 18:00:45.453 usbccgp
41.0 169 IN 05 01 09 06 a1 01 85 01 05 07 19 e0 29 e7 15 00 ............)... 373us 8.2.0 2014-12-24 18:00:45.453
25 01 95 08 75 01 81 02 95 01 75 08 81 03 95 06 %...u.....u..... 8.2.16
41.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 26ms 9.1.0 2014-12-24 18:00:45.484 usbccgp
41.0 18 IN 12 01 00 02 00 00 00 40 c4 bc 45 03 03 00 01 02 .......@..E..... 361us 9.2.0 2014-12-24 18:00:45.484
03 01 .. 9.2.16
41.0 CTL 80 06 00 02 00 00 09 00 GET DESCRIPTOR 46us 10.1.0 2014-12-24 18:00:45.484 usbccgp
41.0 9 IN 09 02 49 00 02 00 00 a0 fa ..I...... 282us 10.2.0 2014-12-24 18:00:45.484
41.0 CTL 80 06 00 02 00 00 49 00 GET DESCRIPTOR 43us 11.1.0 2014-12-24 18:00:45.484 usbccgp
41.0 73 IN 09 02 49 00 02 00 00 a0 fa 09 04 00 00 02 03 01 ..I............. 332us 11.2.0 2014-12-24 18:00:45.484
01 00 09 21 10 01 21 01 22 a9 00 07 05 81 03 10 ...!..!."....... 11.2.16
41.0 CTL 00 09 00 00 00 00 00 00 SET CONFIG 120us 12.1.0 2014-12-24 18:00:45.484 usbccgp
41.0 CTL 80 06 00 03 00 00 ff 00 GET DESCRIPTOR 71ms 13.1.0(4) 2014-12-24 18:00:45.546 usbhub
41.0 4 IN 04 03 09 04 .... 267us 13.2.0 2014-12-24 18:00:45.562
41.0 CTL 80 06 02 03 09 04 ff 00 GET DESCRIPTOR 122us 14.1.0(4) 2014-12-24 18:00:45.562 usbhub
41.0 32 IN 20 03 53 00 54 00 4d 00 33 00 32 00 20 00 43 00 .S.T.M.3.2. .C. 238us 14.2.0 2014-12-24 18:00:45.562
75 00 73 00 74 00 6d 00 20 00 48 00 49 00 44 00 u.s.t.m. .H.I.D. 14.2.16
|
|