From ce5e565f58003eb5144e08e3e8cdcc63a6110b76 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 13 Feb 2020 08:42:37 +0900 Subject: [PATCH] adb_usb: Fix start up delay for AEK/AEKII Without proper delay keyboard the converter starts talking too early before keyboard wakes up. ISO recognition and enabling Extention protocol would be failed in the result. https://github.com/tmk/tmk_keyboard/issues/640#issuecomment-585411393 200ms is enough for AEKs but 1000ms is used here for safety. --- converter/adb_usb/matrix.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index e8ed2da6..f4bf50c1 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -72,8 +72,13 @@ void matrix_init(void) adb_host_init(); - // wait for line and device to be stable - wait_ms(100); + // AEK/AEKII(ANSI/ISO) startup is slower. Without proper delay + // it would fail to recognize layout and enable Extended protocol. + // 200ms seems to be enough for AEKs. 1000ms is used for safety. + // Tested with devices: + // M0115J(AEK), M3501(AEKII), M0116(Standard), M1242(Adjustable), + // G5431(Mouse), 64210(Kensington Trubo Mouse 5) + wait_ms(1000); device_scan(); @@ -94,7 +99,7 @@ void matrix_init(void) is_iso_layout = false; break; } - xprintf("hadler: %02X, ISO: %s\n", handler_id, (is_iso_layout ? "yes" : "no")); + xprintf("handler: %02X, ISO: %s\n", handler_id, (is_iso_layout ? "yes" : "no")); // Adjustable keyboard media keys: address=0x07 and handlerID=0x02 has_media_keys = (0x02 == (adb_host_talk(ADB_ADDR_APPLIANCE, ADB_REG_3) & 0xff)); @@ -113,6 +118,8 @@ void matrix_init(void) led_set(host_keyboard_leds()); + device_scan(); + // LED off DDRD |= (1<<6); PORTD &= ~(1<<6); return; -- 2.46.2