From fa587653258f2713eed8063395a84020435e3dbb Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 12 May 2020 11:01:33 +0900 Subject: [PATCH] ibmpc_usb: Fix led_set for XT keyobard --- converter/ibmpc_usb/ibmpc_usb.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/converter/ibmpc_usb/ibmpc_usb.c b/converter/ibmpc_usb/ibmpc_usb.c index 2270e1ba..98bba1f6 100644 --- a/converter/ibmpc_usb/ibmpc_usb.c +++ b/converter/ibmpc_usb/ibmpc_usb.c @@ -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<