diff options
author | Hung-Te Lin <hungte@chromium.org> | 2018-08-08 08:55:38 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-15 20:36:15 -0700 |
commit | 43899e1d9e3f523701d8d8b5c93890322894e6e4 (patch) | |
tree | e1064e69d6b8bbf91e050c34251a77ba3ce959e2 /include/keyboard_8042_sharedlib.h | |
parent | 0c94bad3ebecb4f33544ffb3b136746d044c4ea9 (diff) | |
download | chrome-ec-43899e1d9e3f523701d8d8b5c93890322894e6e4.tar.gz |
keyboard: Keep only scan code set 2 table and do translation for set 1.
The 8042 scan code set 1 can be directly translated from set 2, with a
256 byte table. With this change, we can always process key stroke in
scan code (set 2), and only translate in the single function
`scancode_bytes`. This is very helpful when we need to do key
processing, for example the buttons_8042 can now be simplified with only
one scan code. And is extremely helpful if we want to do dynamic
translation (i.e., to prevent something like CL:1164725).
For `make BOARD=samus', the free space is also increased from 18472 to
18656 (+184) bytes.
BUG=None
TEST=make buildall; manually installed on Eve and tested by
running 'keyboard' factory test to make sure all key scancodes
are not changed.
BRANCH=None
Change-Id: Ieb303d84edcd4375bbeb1ea5f032d0462bbfd250
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1166742
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/keyboard_8042_sharedlib.h')
-rw-r--r-- | include/keyboard_8042_sharedlib.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h index 5c9b559279..e475288ad5 100644 --- a/include/keyboard_8042_sharedlib.h +++ b/include/keyboard_8042_sharedlib.h @@ -13,20 +13,21 @@ #include "keyboard_protocol.h" struct button_8042_t { - uint16_t scancode_set1; - uint16_t scancode_set2; + uint16_t scancode; int repeat; }; /* The standard Chrome OS keyboard matrix table. */ #ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE -extern uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS]; extern uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS]; #else -extern const uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS]; extern const uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS]; #endif +/* Translation from scan code set 2 to set 1. */ +extern const uint8_t scancode_translate_table[]; +extern uint8_t scancode_translate_set2_to_1(uint8_t code); + /* Button scancodes (Power, Volume Down, Volume Up, etc.) */ extern const struct button_8042_t buttons_8042[KEYBOARD_BUTTON_COUNT]; |