diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-05-04 16:40:49 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-08 07:04:06 -0700 |
commit | 541ddb0f889c2630e457fbab475cf6e2f781b54c (patch) | |
tree | 93f07a7df2523b0ca60fcd72b2af3fd2b311d451 | |
parent | 8c26ccbc151e8e270e04af74719d5e4befcc8ff3 (diff) | |
download | chrome-ec-541ddb0f889c2630e457fbab475cf6e2f781b54c.tar.gz |
keyboard_scan: Add option to not handle special key combinations
On some boards, the special alt-volup-r/h combinations do not make
a lot of sense, so we can just not process them and save a little
bit of code space.
BRANCH=none
BUG=b:37422577
TEST=Flash hammer, alt-volup-r/h does not do anything special
TEST=make newsizes shows we save 124 bytes in hammer RW.
Change-Id: I92770fd6b8ff90780162a6b1de428a550bb44e9b
Reviewed-on: https://chromium-review.googlesource.com/495967
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/keyboard_scan.c | 4 | ||||
-rw-r--r-- | include/config.h | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index fa8ce3d98f..3ad4805b90 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -272,6 +272,7 @@ static int read_matrix(uint8_t *state) return pressed ? 1 : 0; } +#ifdef CONFIG_KEYBOARD_RUNTIME_KEYS /** * Check special runtime key combinations. * @@ -365,6 +366,7 @@ static int check_runtime_keys(const uint8_t *state) return 0; } +#endif /* CONFIG_KEYBOARD_RUNTIME_KEYS */ /** * Check for ghosting in the keyboard state. @@ -506,9 +508,11 @@ static int check_keys_changed(uint8_t *state) CPRINTF("]\n"); #endif +#ifdef CONFIG_KEYBOARD_RUNTIME_KEYS /* Swallow special keys */ if (check_runtime_keys(state)) return 0; +#endif #ifdef CONFIG_KEYBOARD_PROTOCOL_MKBP keyboard_fifo_add(state); diff --git a/include/config.h b/include/config.h index 817dc659f6..07c02acd5a 100644 --- a/include/config.h +++ b/include/config.h @@ -1516,6 +1516,12 @@ #undef CONFIG_KEYBOARD_PRINT_SCAN_TIMES /* + * Support for extra runtime key combinations (e.g. alt+volup+h/r for hibernate + * and warm reboot, respectively). + */ +#define CONFIG_KEYBOARD_RUNTIME_KEYS + +/* * Call board-supplied keyboard_suppress_noise() function when the debounced * keyboard state changes. Some boards use this to send a signal to the audio * codec to suppress typing noise picked up by the microphone. |