楼上的朋友,你的描述符能否发一个看看,我做HID 鼠标和键盘的复合设备是一个配置描述符,两个接口描述符。
下面的描述符不是针对68013的,但是你可以照着改改的。
code const usb_conf_desc_templ_t g_usb_conf_desc =
{
{ // configuration_descriptor hid_configuration_descriptor
sizeof(hal_usb_conf_desc_t), // Length
0x02, // Type
SWAP(sizeof(usb_conf_desc_templ_t)), // Totallength
0x02, // NumInterfaces
0x01, // bConfigurationValue
0x00, // iConfiguration
0xA0, // bmAttributes (0x80 + Remote Wakeup)
0x32 // MaxPower (in 2mA units) = 100 * 2mA
},
{ // interface_descriptor hid_interface_descriptor (keyboard)
sizeof(hal_usb_if_desc_t), // Length
0x04, // bDescriptorType
0x00, // bInterfaceNumber
0x00, // bAlternateSetting
0x01, // bNumEndpoints
0x03, // bInterfaceClass (3 = HID)
0x01, // bInterfaceSubClass
0x01, // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
0x00 // iInterface
},
{ // class_descriptor hid_descriptor keyboard
sizeof(hal_usb_hid_desc_t), // Length
0x21, // bDescriptorType
SWAP(0x0100), // bcdHID
0x00, // bCountryCode
0x01, // bNumDescriptors
0x22, // bDescriptorType
SWAP(HID_REPORT1_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
// descriptor)
},
{ // endpoint_descriptor hid_endpoint_in_descriptor keyboard
sizeof(hal_usb_ep_desc_t), // Length
0x05, // bDescriptorType
0x81, // bEndpointAddress
0x03, // bmAttributes
SWAP(EP1_PACKET_SIZE), // MaxPacketSize (LITTLE ENDIAN)
2 // bInterval
},
{
// interface_descriptor hid_interface_descriptor (mouse)
sizeof(hal_usb_if_desc_t), // Length
0x04, // bDescriptorType
0x01, // bInterfaceNumber
0x00, // bAlternateSetting
0x01, // bNumEndpoints
0x03, // bInterfaceClass (3 = HID)
0x01, // bInterfaceSubClass
0x02, // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
0x00 // iInterface
},
{ // class_descriptor hid_descriptor mouse
sizeof(hal_usb_hid_desc_t), // Length
0x21, // bDescriptorType
SWAP(0x0100), // bcdHID
0x00, // bCountryCode
0x01, // bNumDescriptors
0x22, // bDescriptorType
SWAP(HID_REPORT2_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
// descriptor)
},
{ // endpoint_descriptor hid_endpoint_in_descriptor mouse
sizeof(hal_usb_ep_desc_t), // Length
0x05, // bDescriptorType
0x82, // bEndpointAddress
0x03, // bmAttributes
SWAP(EP2_PACKET_SIZE), // MaxPacketSize (LITTLE ENDIAN)
2 // bInterval
},
}; |