diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-10-16 12:37:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-19 12:19:32 -0700 |
commit | 9fda2eea0861911537922ce3e45b118297f5030d (patch) | |
tree | c3d6822f5088ee561a2b0414300e3efb755e33d6 /common | |
parent | 59dc8df73fa71f3064fd225cf89fed65bf1b25a9 (diff) | |
download | chrome-ec-9fda2eea0861911537922ce3e45b118297f5030d.tar.gz |
Keyboard: switch column and row of scancode table
This patch switches column and row of scancode_set2. That is,
scancode_set2[ROWS][COLS] =
{0x00, 0x01, 0x02, ...,
0x10, 0x11, ...,
0x20, ...,
becomes
scancode_set2[COLS][ROWS] =
{0x00, 0x10, 0x20, ...,
0x01, 0x11, ...,
0x02, ...,
This will allow us to extend the table for a keypad without losing
too much readability.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:117126568
BRANCH=none
TEST=Verify keyboard functionality on Sona.
Change-Id: I49a7c0796d5c91989f1d3686c80743fb4bcd5ba7
Reviewed-on: https://chromium-review.googlesource.com/1285291
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/keyboard_8042.c | 4 | ||||
-rw-r--r-- | common/keyboard_8042_sharedlib.c | 83 |
2 files changed, 43 insertions, 44 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c index e561762843..124ac8adee 100644 --- a/common/keyboard_8042.c +++ b/common/keyboard_8042.c @@ -309,7 +309,7 @@ static enum ec_error_list matrix_callback(int8_t row, int8_t col, if (row >= KEYBOARD_ROWS || col >= KEYBOARD_COLS) return EC_ERROR_INVAL; - make_code = scancode_set2[row][col]; + make_code = scancode_set2[col][row]; #ifdef CONFIG_KEYBOARD_SCANCODE_CALLBACK { @@ -385,7 +385,7 @@ void keyboard_state_changed(int row, int col, int is_pressed) enum ec_error_list ret; #ifdef CONFIG_KEYBOARD_DEBUG - char mylabel = keycap_label[row][col]; + char mylabel = keycap_label[col][row]; if (mylabel & KEYCAP_LONG_LABEL_BIT) CPRINTS("KB (%d,%d)=%d %s", row, col, is_pressed, diff --git a/common/keyboard_8042_sharedlib.c b/common/keyboard_8042_sharedlib.c index 214eaafb5a..98d71cc1f9 100644 --- a/common/keyboard_8042_sharedlib.c +++ b/common/keyboard_8042_sharedlib.c @@ -16,23 +16,20 @@ #ifndef CONFIG_KEYBOARD_SCANCODE_MUTABLE SHAREDLIB(const #endif -uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = { - {0x0000, 0xe01f, 0x0005, 0x0032, 0x0009, 0x0051, 0x0031, 0x0000, 0x0055, - 0x0000, 0xe011, 0x0000, 0x0000}, - {0x0000, 0x0076, 0x000c, 0x0034, 0x0083, 0x0000, 0x0033, 0x0000, 0x0052, - 0x0001, 0x0000, 0x0066, 0x0064}, - {0x0014, 0x000d, 0x0004, 0x002c, 0x000b, 0x005b, 0x0035, 0x0061, 0x0054, - 0x000a, 0x006a, 0x0000, 0x0000}, - {0xe01f, 0x000e, 0x0006, 0x002e, 0x0003, 0x0000, 0x0036, 0x0000, 0x004e, - 0x002f, 0x0000, 0x005d, 0x0067}, - {0xe014, 0x001c, 0x0023, 0x002b, 0x001b, 0x0042, 0x003b, 0x0000, 0x004c, - 0x004b, 0x005d, 0x005a, 0x0000}, - {0xe007, 0x001a, 0x0021, 0x002a, 0x0022, 0x0041, 0x003a, 0x0012, 0x004a, - 0x0049, 0x0000, 0x0029, 0x0000}, - {0x0000, 0x0016, 0x0026, 0x0025, 0x001e, 0x003e, 0x003d, 0x0000, 0x0045, - 0x0046, 0x0011, 0xe072, 0xe074}, - {0x0000, 0x0015, 0x0024, 0x002d, 0x001d, 0x0043, 0x003c, 0x0059, 0x004d, - 0x0044, 0x0000, 0xe075, 0xe06b}, +uint16_t scancode_set2[KEYBOARD_COLS][KEYBOARD_ROWS] = { + {0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0xe007, 0x0000, 0x0000}, + {0xe01f, 0x0076, 0x000d, 0x000e, 0x001c, 0x001a, 0x0016, 0x0015}, + {0x0005, 0x000c, 0x0004, 0x0006, 0x0023, 0x0021, 0x0026, 0x0024}, + {0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x002a, 0x0025, 0x002d}, + {0x0009, 0x0083, 0x000b, 0x0003, 0x001b, 0x0022, 0x001e, 0x001d}, + {0x0051, 0x0000, 0x005b, 0x0000, 0x0042, 0x0041, 0x003e, 0x0043}, + {0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x003a, 0x003d, 0x003c}, + {0x0000, 0x0000, 0x0061, 0x0000, 0x0000, 0x0012, 0x0000, 0x0059}, + {0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x004a, 0x0045, 0x004d}, + {0x0000, 0x0001, 0x000a, 0x002f, 0x004b, 0x0049, 0x0046, 0x0044}, + {0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000}, + {0x0000, 0x0066, 0x0000, 0x005d, 0x005a, 0x0029, 0xe072, 0xe075}, + {0x0000, 0x0064, 0x0000, 0x0067, 0x0000, 0x0000, 0xe074, 0xe06b}, } #ifndef CONFIG_KEYBOARD_SCANCODE_MUTABLE ) @@ -82,31 +79,33 @@ char * const keycap_long_label[KLLI_MAX & KEYCAP_LONG_LABEL_INDEX_BITMASK] = { #ifndef CONFIG_KEYBOARD_SCANCODE_MUTABLE SHAREDLIB(const #endif -char keycap_label[KEYBOARD_ROWS][KEYBOARD_COLS] = { - {KLLI_UNKNO, KLLI_SEARC, KLLI_F1, 'b', KLLI_F10, - KLLI_UNKNO, 'n', KLLI_UNKNO, '=', KLLI_UNKNO, - KLLI_R_ALT, KLLI_UNKNO, KLLI_UNKNO}, - {KLLI_UNKNO, KLLI_ESC, KLLI_F4, 'g', KLLI_F7, - KLLI_UNKNO, 'h', KLLI_UNKNO, '\'', KLLI_F9, - KLLI_UNKNO, KLLI_B_SPC, KLLI_UNKNO}, - {KLLI_L_CTR, KLLI_TAB, KLLI_F3, 't', KLLI_F6, - ']', 'y', KLLI_UNKNO, '[', KLLI_F8, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {KLLI_UNKNO, '~', KLLI_F2, '5', KLLI_F5, - KLLI_UNKNO, '6', KLLI_UNKNO, '-', KLLI_UNKNO, - KLLI_UNKNO, '\\', KLLI_UNKNO}, - {KLLI_R_CTR, 'a', 'd', 'f', 's', - 'k', 'j', KLLI_UNKNO, ';', '|', - KLLI_UNKNO, KLLI_ENTER, KLLI_UNKNO}, - {KLLI_UNKNO, 'z', 'c', 'v', 'x', - ',', 'm', KLLI_L_SHT, '/', '.', - KLLI_UNKNO, KLLI_SPACE, KLLI_UNKNO}, - {KLLI_UNKNO, '1', '3', '4', '2', - '8', '7', KLLI_UNKNO, '0', '9', - KLLI_L_ALT, KLLI_DOWN, KLLI_RIGHT}, - {KLLI_UNKNO, 'q', 'e', 'r', 'w', - 'i', 'u', KLLI_R_SHT, 'p', 'o', - KLLI_UNKNO, KLLI_UP, KLLI_LEFT}, +char keycap_label[KEYBOARD_COLS][KEYBOARD_ROWS] = { + {KLLI_UNKNO, KLLI_UNKNO, KLLI_L_CTR, KLLI_UNKNO, + KLLI_R_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + {KLLI_SEARC, KLLI_ESC, KLLI_TAB, '~', + 'a', 'z', '1', 'q'}, + {KLLI_F1, KLLI_F4, KLLI_F3, KLLI_F2, + 'd', 'c', '3', 'e'}, + {'b', 'g', 't', '5', + 'f', 'v', '4', 'r'}, + {KLLI_F10, KLLI_F7, KLLI_F6, KLLI_F5, + 's', 'x', '2', 'w'}, + {KLLI_UNKNO, KLLI_UNKNO, ']', KLLI_UNKNO, + 'k', ',', '8', 'i'}, + {'n', 'h', 'y', '6', + 'j', 'm', '7', 'u'}, + {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_L_SHT, KLLI_UNKNO, KLLI_R_SHT}, + {'=', '\'', '[', '-', + ';', '/', '0', 'p'}, + {KLLI_UNKNO, KLLI_F9, KLLI_F8, KLLI_UNKNO, + '|', '.', '9', 'o'}, + {KLLI_R_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_L_ALT, KLLI_UNKNO}, + {KLLI_UNKNO, KLLI_B_SPC, KLLI_UNKNO, '\\', + KLLI_ENTER, KLLI_SPACE, KLLI_DOWN, KLLI_UP}, + {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_RIGHT, KLLI_LEFT}, } #ifndef CONFIG_KEYBOARD_SCANCODE_MUTABLE ) |