summaryrefslogtreecommitdiff
path: root/util/ectool_keyscan.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-10-16 15:16:29 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-19 23:21:56 -0700
commit9a890ad22965daa7e9365a0b2cb8c734ae41a842 (patch)
tree27e3f1f0845031e685fc46ffdad44d8cb87adfeb /util/ectool_keyscan.c
parent4d4d8f06e91090336c2eb29ee00ca86fea2bb796 (diff)
downloadchrome-ec-9a890ad22965daa7e9365a0b2cb8c734ae41a842.tar.gz
Keyboard: Allow keyboard size to be set at run time
Currently, the keyboard size (i.e. number of columns) is static. This patch allows it to be configured at run time. It's required to support a keyboard with/without keypad in a single image. KEYBOARD_COLS_MAX has the build time col size. It's used to allocate exact spaces for arrays. Actual keyboard scanning is done using keyboard_cols, which holds a runtime col size. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:117126568 BRANCH=none TEST=Verify keyboard functionality on Sona and Veyron. Change-Id: I4b3552be0b4b315c3fe5a6884cf25e10aba8be7c Reviewed-on: https://chromium-review.googlesource.com/1285292 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/ectool_keyscan.c')
-rw-r--r--util/ectool_keyscan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c
index ce35757a19..46ba221f6e 100644
--- a/util/ectool_keyscan.c
+++ b/util/ectool_keyscan.c
@@ -32,7 +32,7 @@ struct matrix_entry {
struct keyscan_test_item {
uint32_t beat; /* Beat number */
- uint8_t scan[KEYBOARD_COLS]; /* Scan data */
+ uint8_t scan[KEYBOARD_COLS_MAX]; /* Scan data */
};
/* A single test, consisting of a list of key scans and expected ascii input */
@@ -103,7 +103,7 @@ static int keyscan_read_fdt_matrix(struct keyscan_info *keyscan,
/* Hard-code some sanity limits for now */
if (matrix->row >= KEYBOARD_ROWS ||
- matrix->col >= KEYBOARD_COLS) {
+ matrix->col >= KEYBOARD_COLS_MAX) {
fprintf(stderr, "Matrix pos out of range (%d,%d)\n",
matrix->row, matrix->col);
fclose(f);