diff options
author | Devaev Maxim <[email protected]> | 2021-07-14 13:23:41 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-07-14 13:23:41 +0300 |
commit | 937d8320f84f48572900dc495a80ac09e04ab413 (patch) | |
tree | 669de2f9f5f9c08ef6218b94e9c8cb8add8df6de | |
parent | f641afcc6be81145b542fcdb4aa7096fca29d2db (diff) |
moved some patches to upstream
-rw-r--r-- | hid/patch.py | 3 | ||||
-rw-r--r-- | hid/patches/hid-abs-mouse-mac-fix.patch | 23 | ||||
-rw-r--r-- | hid/patches/hid-abs-mouse-win-fix.patch | 12 | ||||
-rw-r--r-- | hid/patches/hid-boot-mouse-mac-fix.patch | 75 | ||||
-rw-r--r-- | hid/platformio.ini | 2 | ||||
-rw-r--r-- | hid/src/main.cpp | 4 |
6 files changed, 3 insertions, 116 deletions
diff --git a/hid/patch.py b/hid/patch.py index 520368e5..363a837b 100644 --- a/hid/patch.py +++ b/hid/patch.py @@ -40,6 +40,3 @@ _patch(_get_pkg_path("framework-arduino-avr"), "patches/arduino-get-plugged-endp _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-abs-mouse-mac-fix.patch") -_patch(_libs["HID-Project"], "patches/hid-boot-mouse-mac-fix.patch") diff --git a/hid/patches/hid-abs-mouse-mac-fix.patch b/hid/patches/hid-abs-mouse-mac-fix.patch deleted file mode 100644 index 57fef195..00000000 --- a/hid/patches/hid-abs-mouse-mac-fix.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/src/SingleReport/SingleAbsoluteMouse.cpp b/src/SingleReport/SingleAbsoluteMouse.cpp -index bad902c..88d16f0 100644 ---- a/src/SingleReport/SingleAbsoluteMouse.cpp -+++ b/src/SingleReport/SingleAbsoluteMouse.cpp -@@ -29,6 +29,10 @@ static const uint8_t _hidSingleReportDescriptorAbsoluteMouse[] 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) */ -@@ -58,6 +62,7 @@ static const uint8_t _hidSingleReportDescriptorAbsoluteMouse[] PROGMEM = { - 0x81, 0x06, /* INPUT (Data,Var,Rel) */ - - /* End */ -+ 0xc0, /* END_COLLECTION (Physical) */ - 0xc0 /* END_COLLECTION */ - }; - diff --git a/hid/patches/hid-abs-mouse-win-fix.patch b/hid/patches/hid-abs-mouse-win-fix.patch deleted file mode 100644 index ac2226a1..00000000 --- a/hid/patches/hid-abs-mouse-win-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -See /kvmd/apps/otg/hid/keyboard.py for details ---- a/src/SingleReport/SingleAbsoluteMouse.cpp 2019-07-13 21:16:23.000000000 +0300 -+++ b/src/SingleReport/SingleAbsoluteMouse.cpp 2019-10-05 00:58:34.592003332 +0300 -@@ -43,7 +43,7 @@ - 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ - 0x09, 0x30, /* USAGE (X) */ - 0x09, 0x31, /* USAGE (Y) */ -- 0x16, 0x00, 0x80, /* Logical Minimum (-32768) */ -+ 0x16, 0x00, 0x00, /* Logical Minimum (0) */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767) */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x02, /* Report Count (2), */ diff --git a/hid/patches/hid-boot-mouse-mac-fix.patch b/hid/patches/hid-boot-mouse-mac-fix.patch deleted file mode 100644 index 0a8709b4..00000000 --- a/hid/patches/hid-boot-mouse-mac-fix.patch +++ /dev/null @@ -1,75 +0,0 @@ -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 -@@ -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) - { -- // 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; } -+ -+ 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) { -+ // 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 USB_SendControl(TRANSFER_PGM, _hidReportDescriptorMouse, sizeof(_hidReportDescriptorMouse)); -+ return 0; - } - - bool BootMouse_::setup(USBSetup& setup) -@@ -103,7 +114,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; - } - } diff --git a/hid/platformio.ini b/hid/platformio.ini index aef04396..c68dc420 100644 --- a/hid/platformio.ini +++ b/hid/platformio.ini @@ -7,7 +7,7 @@ platform = atmelavr board = micro framework = arduino lib_deps = + git+https://github.com/mdevaev/HID#2.8.2 git+https://github.com/Harvie/ps2dev#v0.0.3 extra_scripts = diff --git a/hid/src/main.cpp b/hid/src/main.cpp index 118e0d4e..ca00f7dc 100644 --- a/hid/src/main.cpp +++ b/hid/src/main.cpp @@ -212,8 +212,8 @@ static void _cmdMouseMoveEvent(const uint8_t *data) { // 4 bytes // See /kvmd/apps/otg/hid/keyboard.py for details if (_usb_mouse_abs) { _usb_mouse_abs->sendMove( - (PROTO::merge8_int(data[0], data[1]) + 32768) / 2, - (PROTO::merge8_int(data[2], data[3]) + 32768) / 2 + PROTO::merge8_int(data[0], data[1]), + PROTO::merge8_int(data[2], data[3]) ); } } |