summaryrefslogtreecommitdiff
path: root/common/keyboard_scan.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-07 10:16:07 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-08 06:46:03 -0700
commit7c294e0f7b1163d055f95a27f6f344bb525cb010 (patch)
tree3d84aa76cf76e0939d5e90efc64526a7d54f572b /common/keyboard_scan.c
parenteb88a0f5fa4b2909b430e8a16a54dc0f5f15b90c (diff)
downloadchrome-ec-7c294e0f7b1163d055f95a27f6f344bb525cb010.tar.gz
keyboard_scan: Add "ksstate force" to always scan KB matrix
For early bringup, or failure analysis, it is sometimes useful to be able to force enable the keyboard matrix scanning, even though other signals (lid close, usb off) would normally disable it. The only way to disable the scanning again is to wait for an lid/USB event, or reboot the board, which is ok as this is for debugging purpose only. BRANCH=none BUG=b:109743721 TEST=Provide power to whiskers via servo only. ksstate force => key presses are shown Change-Id: I3eaa9552ea52f7e3df45fdb6c8d0aa88c7b164b3 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1090350 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/keyboard_scan.c')
-rw-r--r--common/keyboard_scan.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 96dececd78..7a015c86b3 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -885,8 +885,14 @@ DECLARE_HOST_COMMAND(EC_CMD_KEYBOARD_FACTORY_TEST,
#ifdef CONFIG_CMD_KEYBOARD
static int command_ksstate(int argc, char **argv)
{
- if (argc > 1 && !parse_bool(argv[1], &print_state_changes))
- return EC_ERROR_PARAM1;
+ if (argc > 1) {
+ if (!strcasecmp(argv[1], "force")) {
+ print_state_changes = 1;
+ keyboard_scan_enable(1, -1);
+ } else if (!parse_bool(argv[1], &print_state_changes)) {
+ return EC_ERROR_PARAM1;
+ }
+ }
print_state(debounced_state, "debounced ");
print_state(prev_state, "prev ");
@@ -899,7 +905,7 @@ static int command_ksstate(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(ksstate, command_ksstate,
- "ksstate [on | off]",
+ "ksstate [on | off | force]",
"Show or toggle printing keyboard scan state");
static int command_keyboard_press(int argc, char **argv)