summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-08-09 11:45:15 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-17 11:17:57 -0700
commitcd8cc76e3034c1935245b9b20e7fc4efbb0b0471 (patch)
tree8df7b9e8921d728d0849f9931ed90bf4300ad1d8 /common/keyboard_8042.c
parent195a3e8589312d0bc96f37c08e266539d7895d74 (diff)
downloadchrome-ec-cd8cc76e3034c1935245b9b20e7fc4efbb0b0471.tar.gz
keyboard: Add CONFIG_KEYBOARD_SCANCODE_CALLBACK for board-specific hooks.
Many devices may want board-specific keyboard hooks, for example allowing easter egg (to replace the key_special today), or to provide dynamic translation. Both can be done by having a callback whenever the key state is changed (after scancode is found). The new CONFIG_KEYBOARD_SCANCODE_CALLBACK allows boards to define their own hook keyboard_scancode_callback so the keystrokes can be either changed or monitored. BUG=b:72200093 TEST=make buildall -j BRANCH=eve Change-Id: I02e3bf5c217b2f30b942d96ecb2c493ce200638f Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1168281 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 50320807cb..b178c50066 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -314,6 +314,15 @@ static enum ec_error_list matrix_callback(int8_t row, int8_t col,
if (pressed)
keyboard_special(make_code);
+#ifdef CONFIG_KEYBOARD_SCANCODE_CALLBACK
+ {
+ enum ec_error_list r = keyboard_scancode_callback(
+ &make_code, pressed);
+ if (r != EC_SUCCESS)
+ return r;
+ }
+#endif
+
code_set = acting_code_set(code_set);
if (!is_supported_code_set(code_set)) {
CPRINTS("KB scancode set %d unsupported", code_set);