File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 4949#define REQUEST_OTHER 0x03
5050#define REQUEST_RECIPIENT 0x03
5151
52- #define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE)
53- #define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE)
52+ #define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE)
53+ #define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE)
54+ #define REQUEST_DEVICETOHOST_STANDARD_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_STANDARD + REQUEST_INTERFACE)
5455
5556// Class requests
5657
Original file line number Diff line number Diff line change @@ -40,9 +40,12 @@ int HID_::getInterface(uint8_t* interfaceCount)
4040
4141int HID_::getDescriptor (USBSetup& setup)
4242{
43- if (pluggedInterface != setup.wIndex ) {
44- return 0 ;
45- }
43+ // Check if this is a HID Class Descriptor request
44+ if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0 ; }
45+ if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0 ; }
46+
47+ // In a HID Class Descriptor wIndex cointains the interface number
48+ if (setup.wIndex != pluggedInterface) { return 0 ; }
4649
4750 int total = 0 ;
4851 HIDDescriptorListNode* node;
You can’t perform that action at this time.
0 commit comments