File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 49
49
#define REQUEST_OTHER 0x03
50
50
#define REQUEST_RECIPIENT 0x03
51
51
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)
54
55
55
56
// Class requests
56
57
Original file line number Diff line number Diff line change @@ -40,9 +40,12 @@ int HID_::getInterface(uint8_t* interfaceCount)
40
40
41
41
int HID_::getDescriptor (USBSetup& setup)
42
42
{
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 ; }
46
49
47
50
int total = 0 ;
48
51
HIDDescriptorListNode* node;
You can’t perform that action at this time.
0 commit comments