From c4ab832be0f110a127b20e8df2b5223bceb8dcd1 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 12 Mar 2013 12:10:12 +0900 Subject: [PATCH] Fix Locking CapsLock support in ADB converter --- converter/adb_usb/README.md | 7 ++----- converter/adb_usb/config.h | 15 ++++++++++++--- converter/adb_usb/keymap.c | 2 +- converter/adb_usb/matrix.c | 27 --------------------------- keyboard/gh60/config.h | 2 +- 5 files changed, 16 insertions(+), 37 deletions(-) diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md index 33fd55040..3033cfa62 100644 --- a/converter/adb_usb/README.md +++ b/converter/adb_usb/README.md @@ -20,10 +20,7 @@ Build LOCKING CAPSLOCK ---------------- -Many old ADB keyboards have mechanical push-lock switch for Capslock key. This converter support the locking Capslock key by default. -This feature will prevent you from remaping as normal key. You can disable the feature by *commenting out* a macro in config.h like this: - - //#define MATRIX_HAS_LOCKING_CAPS +Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature. Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch. http://www.youtube.com/watch?v=9wqnt2mGJ2Y @@ -58,7 +55,7 @@ effort at this time. ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, PWR, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, + LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT ), diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h index 094252f74..da87eed6a 100644 --- a/converter/adb_usb/config.h +++ b/converter/adb_usb/config.h @@ -32,13 +32,22 @@ along with this program. If not, see . #define MATRIX_ROWS 16 // keycode bit: 3-0 #define MATRIX_COLS 8 // keycode bit: 6-4 -/* Locking Caps Lock support */ -#define MATRIX_HAS_LOCKING_CAPS - #define MATRIX_ROW(code) ((code)>>3&0x0F) #define MATRIX_COL(code) ((code)&0x07) +/* Locking Caps Lock support */ +//#define MATRIX_HAS_LOCKING_CAPS +/* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ +#define CAPSLOCK_LOCKING_ENABLE +/* Locking CapsLock resynchronize hack */ +#define CAPSLOCK_LOCKING_RESYNC_ENABLE + + +/* legacy keymap support */ +#define USE_LEGACY_KEYMAP + + /* mouse keys */ #ifdef MOUSEKEY_ENABLE # define MOUSEKEY_DELAY_TIME 192 diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap.c index bde829de3..5d42980d5 100644 --- a/converter/adb_usb/keymap.c +++ b/converter/adb_usb/keymap.c @@ -155,7 +155,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, + LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index 18e71aa49..9b26a2a18 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -25,8 +25,6 @@ along with this program. If not, see . #include "print.h" #include "util.h" #include "debug.h" -#include "host.h" -#include "led.h" #include "adb.h" #include "matrix.h" @@ -38,8 +36,6 @@ along with this program. If not, see . # error "MATRIX_ROWS must not exceed 255" #endif -#define ADB_CAPS_UP (ADB_CAPS | 0x80) - static bool is_modified = false; @@ -98,12 +94,6 @@ uint8_t matrix_scan(void) print("adb_host_kbd_recv: "); phex16(codes); print("\n"); } -#ifdef MATRIX_HAS_LOCKING_CAPS - // Send Caps key up event - if (matrix_is_on(MATRIX_ROW(ADB_CAPS), MATRIX_COL(ADB_CAPS))) { - register_key(ADB_CAPS_UP); - } -#endif if (codes == 0) { // no keys return 0; } else if (codes == 0x7F7F) { // power key press @@ -116,23 +106,6 @@ uint8_t matrix_scan(void) for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; return key1; } else { -#ifdef MATRIX_HAS_LOCKING_CAPS - if (host_keyboard_leds() & (1<. /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ #define CAPSLOCK_LOCKING_ENABLE -/* Locking CapsLock resynchronize hack, which won't work on Linux */ +/* Locking CapsLock resynchronize hack */ #define CAPSLOCK_LOCKING_RESYNC_ENABLE /* key combination for command */