summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2018-09-07 16:39:26 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-09-13 18:58:53 -0700
commit04c593b8175b7b73204b6ce800573d769d83cd7a (patch)
tree51137b1669038c4e4e2f4ee7147f382e420d827b /common/keyboard_8042.c
parent10b223dd62ca5178290a201a353e21bcd040b24d (diff)
downloadchrome-ec-04c593b8175b7b73204b6ce800573d769d83cd7a.tar.gz
keyboard: display keycap label in key status debug messages
The current debug message in keyboard_8042.c displays a tuple of row, column, and press status. Additionally, this CL displays a keycap label for better readability. For keycap label mapping table can be adjustable under "CONFIG_KEYBOARD_SCANCODE_MUTABLE" condition as scancode_set2[] is. For coral board, Enabling CONFIG_KEYBOARD_DEBUG (w/o this CL) occupies 652 bytes in flash, and this CL occupies another 312 bytes. BUG=b:111060830 TEST=manually tested by pressing keyboards and check the EC console screen. BRANCH=kblog Signed-off-by: Namyoon Woo <namyoon@chromium.org> Changes to be committed: modified: board/eve/board.c modified: common/keyboard_8042.c modified: common/keyboard_8042_sharedlib.c modified: include/keyboard_8042_sharedlib.h Change-Id: Idd71a5475b1ee313f99e087be9143dcfb6f81550 Reviewed-on: https://chromium-review.googlesource.com/1214543 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 7e906a1c04..e561762843 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -384,7 +384,15 @@ void keyboard_state_changed(int row, int col, int is_pressed)
int32_t len = 0;
enum ec_error_list ret;
- CPRINTS5("KB (%d,%d)=%d", row, col, is_pressed);
+#ifdef CONFIG_KEYBOARD_DEBUG
+ char mylabel = keycap_label[row][col];
+
+ if (mylabel & KEYCAP_LONG_LABEL_BIT)
+ CPRINTS("KB (%d,%d)=%d %s", row, col, is_pressed,
+ keycap_long_label[mylabel & KEYCAP_LONG_LABEL_INDEX_BITMASK]);
+ else
+ CPRINTS("KB (%d,%d)=%d %c", row, col, is_pressed, mylabel);
+#endif
ret = matrix_callback(row, col, is_pressed, scancode_set, scan_code,
&len);