summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-17 11:11:30 -0700
committerGerrit <chrome-bot@google.com>2012-10-17 15:23:52 -0700
commit90a18599bb3ee0b0f49617a950805eb6bb77dd3f (patch)
tree446657887e670c120ade692dc8ebc612c1b1c9f9
parentc0640ee296acbf8ac3d4cf5246c60056015909c8 (diff)
downloadchrome-ec-90a18599bb3ee0b0f49617a950805eb6bb77dd3f.tar.gz
link: Don't print keyboard state changes by default
The keyboard scan module generates a lot of debug output when the user is typing on the keyboard - enough so that switching to the console, logging in as root, and typing 'ectool console' flushes the EC's console output buffer of any useful data. Default printing this to off. Add a new 'ksstate' command which will print the current keyboard scan state or toggle printing off/on. This is important for debugging LPC communication failures. BUG=chrome-os-partner:13819 BRANCH=link TEST=manual - Boot system - Type on keyboard. At EC console, should not see KB state: output - Hold down space bar. - At EC console, type 'ksstate'. Should print: ksstate [20.943886 KB debounced : -- -- -- -- -- -- -- -- -- -- -- 20 --] [20.945215 KB prev : -- -- -- -- -- -- -- -- -- -- -- 20 --] [20.945568 KB debouncing: -- -- -- -- -- -- -- -- -- -- -- -- --] Keyboard scan state printing off - Release space bar - At EC console, type 'ksstate on' - Type on keyboard. Should see KB state: output - At EC console, type 'ksstate off' - Type on keyboard. At EC console, should not see KB state: output Change-Id: I4343b7b777fd13057b3222eeba77ed099c5e5a93 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35843 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--chip/lm4/keyboard_scan.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/chip/lm4/keyboard_scan.c b/chip/lm4/keyboard_scan.c
index ef7dfd6b94..f2f26faca2 100644
--- a/chip/lm4/keyboard_scan.c
+++ b/chip/lm4/keyboard_scan.c
@@ -67,6 +67,12 @@ static const uint8_t actual_key_masks[4][KB_COLS] = {
{0},
};
+/*
+ * Print all keyboard scan state changes? Off by default because it generates
+ * a lot of debug output, which makes the saved EC console data less useful.
+ */
+static int print_state_changes;
+
/* Key masks for special boot keys */
#define MASK_INDEX_REFRESH 2
#define MASK_VALUE_REFRESH 0x04
@@ -322,7 +328,7 @@ static int check_keys_changed(uint8_t *state)
}
}
- if (any_change) {
+ if (any_change && print_state_changes) {
print_state(state, "state");
#ifdef PRINT_SCAN_TIMES
@@ -510,3 +516,30 @@ void keyboard_enable_scanning(int enable)
keyboard_clear_underlying_buffer();
}
}
+
+/*****************************************************************************/
+/* Console commands*/
+
+static int command_ksstate(int argc, char **argv)
+{
+ if (argc > 1) {
+ if (!strcasecmp(argv[1], "on"))
+ print_state_changes = 1;
+ else if (!strcasecmp(argv[1], "off"))
+ print_state_changes = 0;
+ else
+ return EC_ERROR_PARAM1;
+ } else {
+ print_state(debounced_state, "debounced ");
+ print_state(prev_state, "prev ");
+ print_state(debouncing, "debouncing");
+ }
+
+ ccprintf("Keyboard scan state printing %s\n",
+ print_state_changes ? "on" : "off");
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(ksstate, command_ksstate,
+ "ksstate [on | off]",
+ "Show or toggle printing keyboard scan state",
+ NULL);