]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
ibmpc_usb: Fix led_set for XT keyobard
authortmk <hasu@tmk-kbd.com>
Tue, 12 May 2020 02:01:33 +0000 (11:01 +0900)
committertmk <hasu@tmk-kbd.com>
Tue, 12 May 2020 02:32:28 +0000 (11:32 +0900)
converter/ibmpc_usb/ibmpc_usb.c

index 2270e1bae4235e8b650d52dddd449b99486e0ce8..98bba1f6f03b556bf282f6ae669fda9c098183bb 100644 (file)
@@ -295,6 +295,8 @@ uint8_t matrix_scan(void)
                 case PC_TERMINAL:
                     // Set all keys to make/break type
                     ibmpc_host_send(0xF8);
+                    // This should not be harmful
+                    led_set(host_keyboard_leds());
                     break;
                 default:
                     break;
@@ -394,9 +396,19 @@ void matrix_clear(void)
 
 void led_set(uint8_t usb_led)
 {
+    // Sending before keyboard recognition may be harmful for XT keyboard
     if (keyboard_kind == NONE) return;
-    //if (keyboard_kind != PC_AT) return;
 
+    // XT keyobard doesn't support any command and it is harmful perhaps
+    // https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-626993437
+    if (keyboard_kind == PC_XT) return;
+
+    // It should be safe to send the command to keyboards with AT protocol
+    // - IBM Terminal doesn't support the command and response with 0xFE but it is not harmful.
+    // - Some other Terminals like G80-2551 supports the command.
+    //   https://geekhack.org/index.php?topic=103648.msg2894921#msg2894921
+
+    // TODO: PC_TERMINAL_IBM_RT support
     uint8_t ibmpc_led = 0;
     if (usb_led &  (1<<USB_LED_SCROLL_LOCK))
         ibmpc_led |= (1<<IBMPC_LED_SCROLL_LOCK);