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>
This commit is contained in:
Nicolas Boichat
2017-05-04 16:40:49 +08:00
committed by chrome-bot
parent 8c26ccbc15
commit 541ddb0f88
2 changed files with 10 additions and 0 deletions

View File

@@ -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);

View File

@@ -1515,6 +1515,12 @@
/* Print keyboard scan time intervals. */
#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