]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
adb_usb: Fix for Macally ADB keyboard
authortmk <hasu@tmk-kbd.com>
Mon, 24 Jun 2019 07:11:36 +0000 (16:11 +0900)
committertmk <hasu@tmk-kbd.com>
Mon, 24 Jun 2019 07:11:36 +0000 (16:11 +0900)
- The odd keyboard sends key0 and key1 inversely for no reason.
  https://deskthority.net/workshop-f7/macally-mk96-t20116.html

converter/adb_usb/matrix.c

index d49adfb248a7d246fa5382068cba9a605c66370c..67ed3d79de5613f4b22667850d0dd4c5c684166c 100644 (file)
@@ -451,12 +451,14 @@ uint8_t matrix_scan(void)
         register_key(0x7F);
     } else if (codes == 0xFFFF) {   // power key release
         register_key(0xFF);
-    } else if (key0 == 0xFF) {      // error
-        xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes);
-        // something wrong or plug-in
-        matrix_init();
-        return key1;
     } else {
+        // Macally keyboard sends keys inversely against ADB protocol
+        // https://deskthority.net/workshop-f7/macally-mk96-t20116.html
+        if (key0 == 0xFF) {
+            key0 = key1;
+            key1 = 0xFF;
+        }
+
         /* Swap codes for ISO keyboard
          * https://github.com/tmk/tmk_keyboard/issues/35
          *