diff options
author | Devaev Maxim <[email protected]> | 2021-07-09 19:27:35 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-07-09 19:27:35 +0300 |
commit | 70141f0fbbded557daadf758d9d94589fca9f037 (patch) | |
tree | 5ea584a8c12ee0f0d3b3b20c4416c2855c3ebb57 /hid/patches/hid-boot-mouse-fix.patch | |
parent | 63d953d22efb1e9b73fd235b64269b3406569cb8 (diff) |
renamed patches
Diffstat (limited to 'hid/patches/hid-boot-mouse-fix.patch')
-rw-r--r-- | hid/patches/hid-boot-mouse-fix.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/hid/patches/hid-boot-mouse-fix.patch b/hid/patches/hid-boot-mouse-fix.patch new file mode 100644 index 00000000..e9381113 --- /dev/null +++ b/hid/patches/hid-boot-mouse-fix.patch @@ -0,0 +1,54 @@ +index 27aee63..2d7d6c0 100644 +--- a/src/SingleReport/BootMouse.cpp ++++ b/src/SingleReport/BootMouse.cpp +@@ -73,18 +73,23 @@ int BootMouse_::getInterface(uint8_t* interfaceCount) + + int BootMouse_::getDescriptor(USBSetup& setup) + { +- // Check if this is a HID Class Descriptor request +- if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; } +- if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; } +- + // In a HID Class Descriptor wIndex cointains the interface number + if (setup.wIndex != pluggedInterface) { return 0; } + +- // Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol +- // due to the USB specs, but Windows and Linux just assumes its in report mode. +- protocol = HID_REPORT_PROTOCOL; ++ // Check if this is a HID Class Descriptor request ++ if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; } + +- return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse)); ++ if (setup.wValueH == HID_HID_DESCRIPTOR_TYPE) { ++ HIDDescDescriptor desc = D_HIDREPORT(sizeof(_hidReportDescriptorMouse)); ++ return USB_SendControl(0, &desc, sizeof(desc)); ++ } else if (setup.wValueH == HID_REPORT_DESCRIPTOR_TYPE) { ++ // Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol ++ // due to the USB specs, but Windows and Linux just assumes its in report mode. ++ protocol = HID_REPORT_PROTOCOL; ++ return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse)); ++ } ++ ++ return 0; + } + + bool BootMouse_::setup(USBSetup& setup) +@@ -103,7 +108,17 @@ bool BootMouse_::setup(USBSetup& setup) + return true; + } + if (request == HID_GET_PROTOCOL) { +- // TODO: Send8(protocol); ++ // TODO improve ++#ifdef __AVR__ ++ UEDATX = protocol; ++#endif ++ return true; ++ } ++ if (request == HID_GET_IDLE) { ++ // TODO improve ++#ifdef __AVR__ ++ UEDATX = idle; ++#endif + return true; + } + } |