diff options
author | Devaev Maxim <[email protected]> | 2021-07-10 08:07:22 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-07-10 08:07:22 +0300 |
commit | 01514d2e6aa2929666938a9d568954a3a9a9fdfc (patch) | |
tree | 6bb8dea446a4c2e19f7bf04f2f4353f73f450765 /hid | |
parent | 70141f0fbbded557daadf758d9d94589fca9f037 (diff) |
fixed boot mouse for apple recovery
Diffstat (limited to 'hid')
-rw-r--r-- | hid/patch.py | 2 | ||||
-rw-r--r-- | hid/patches/hid-boot-mouse-mac-fix.patch (renamed from hid/patches/hid-boot-mouse-fix.patch) | 33 |
2 files changed, 28 insertions, 7 deletions
diff --git a/hid/patch.py b/hid/patch.py index 292f653b..2695901b 100644 --- a/hid/patch.py +++ b/hid/patch.py @@ -41,4 +41,4 @@ _libs = _get_libs() _patch(_libs["HID-Project"], "patches/hid-shut-up.patch") _patch(_libs["HID-Project"], "patches/hid-no-singletones.patch") _patch(_libs["HID-Project"], "patches/hid-abs-mouse-win-fix.patch") -_patch(_libs["HID-Project"], "patches/hid-boot-mouse-fix.patch") +_patch(_libs["HID-Project"], "patches/hid-boot-mouse-mac-fix.patch") diff --git a/hid/patches/hid-boot-mouse-fix.patch b/hid/patches/hid-boot-mouse-mac-fix.patch index e9381113..0a8709b4 100644 --- a/hid/patches/hid-boot-mouse-fix.patch +++ b/hid/patches/hid-boot-mouse-mac-fix.patch @@ -1,7 +1,27 @@ -index 27aee63..2d7d6c0 100644 +diff --git a/src/SingleReport/BootMouse.cpp b/src/SingleReport/BootMouse.cpp +index 27aee63..0de3644 100644 --- a/src/SingleReport/BootMouse.cpp +++ b/src/SingleReport/BootMouse.cpp -@@ -73,18 +73,23 @@ int BootMouse_::getInterface(uint8_t* interfaceCount) +@@ -29,6 +29,10 @@ static const uint8_t _hidReportDescriptorMouse[] PROGMEM = { + 0x09, 0x02, /* USAGE (Mouse) */ + 0xa1, 0x01, /* COLLECTION (Application) */ + ++ /* Pointer and Physical are required by Apple Recovery */ ++ 0x09, 0x01, /* USAGE (Pointer) */ ++ 0xa1, 0x00, /* COLLECTION (Physical) */ ++ + /* 8 Buttons */ + 0x05, 0x09, /* USAGE_PAGE (Button) */ + 0x19, 0x01, /* USAGE_MINIMUM (Button 1) */ +@@ -51,6 +55,7 @@ static const uint8_t _hidReportDescriptorMouse[] PROGMEM = { + 0x81, 0x06, /* INPUT (Data,Var,Rel) */ + + /* End */ ++ 0xc0, /* END_COLLECTION (Physical) */ + 0xc0 /* END_COLLECTION */ + }; + +@@ -73,18 +78,24 @@ int BootMouse_::getInterface(uint8_t* interfaceCount) int BootMouse_::getDescriptor(USBSetup& setup) { @@ -17,9 +37,9 @@ index 27aee63..2d7d6c0 100644 - 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) { ++ // Apple UEFI wants it + HIDDescDescriptor desc = D_HIDREPORT(sizeof(_hidReportDescriptorMouse)); + return USB_SendControl(0, &desc, sizeof(desc)); + } else if (setup.wValueH == HID_REPORT_DESCRIPTOR_TYPE) { @@ -28,12 +48,13 @@ index 27aee63..2d7d6c0 100644 + protocol = HID_REPORT_PROTOCOL; + return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse)); + } -+ + +- return USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse)); + return 0; } bool BootMouse_::setup(USBSetup& setup) -@@ -103,7 +108,17 @@ bool BootMouse_::setup(USBSetup& setup) +@@ -103,7 +114,17 @@ bool BootMouse_::setup(USBSetup& setup) return true; } if (request == HID_GET_PROTOCOL) { |