summaryrefslogtreecommitdiff
path: root/util/ectool_keyscan.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-03-21 13:28:11 -0700
committerChromeBot <chrome-bot@google.com>2013-03-22 11:24:29 -0700
commit10ac310605b32bf7fbd6fc83066e72e1e70a803c (patch)
treef7784c6416902032d6fd49164f9e8c1fbc94aa85 /util/ectool_keyscan.c
parent743c05f01f8f2b19dbf565bee645076fff75c42d (diff)
downloadchrome-ec-10ac310605b32bf7fbd6fc83066e72e1e70a803c.tar.gz
Move keyboard dimension and key constants to keyboard_config.h
These were previously duplicated between multiple keyboard_scan.c and board.c files, and there were a bunch of different constants #defined to be 13. BUG=chrome-os-partner:18360 BRANCH=none TEST=compile all boards; test keyboard on spring and link Change-Id: I91bf9d56d2a56ff25ff307ff10883ca87b6937e5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46165
Diffstat (limited to 'util/ectool_keyscan.c')
-rw-r--r--util/ectool_keyscan.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c
index 7ca0af660e..868fbd11ab 100644
--- a/util/ectool_keyscan.c
+++ b/util/ectool_keyscan.c
@@ -12,6 +12,7 @@
#include <sys/stat.h>
#include "comm-host.h"
+#include "keyboard_config.h"
#include "ectool.h"
enum {
@@ -21,13 +22,6 @@ enum {
KEYSCAN_MAX_INPUT_LEN = 20, /* Maximum characters we can receive */
};
-#ifdef KB_OUTPUTS
-#define KEYSCAN_OUTPUTS KB_OUTPUTS
-#else
-/* Use a suitable default */
-#define KEYSCAN_OUTPUTS 13
-#endif
-
/* A single entry of the key matrix */
struct matrix_entry {
int row; /* key matrix row */
@@ -37,7 +31,7 @@ struct matrix_entry {
struct keyscan_test_item {
uint32_t beat; /* Beat number */
- uint8_t scan[KEYSCAN_OUTPUTS]; /* Scan data */
+ uint8_t scan[KEYBOARD_COLS]; /* Scan data */
};
/* A single test, consisting of a list of key scans and expected ascii input */
@@ -107,7 +101,8 @@ static int keyscan_read_fdt_matrix(struct keyscan_info *keyscan,
matrix->keycode = word & 0xffff;
/* Hard-code some sanity limits for now */
- if (matrix->row >= 8 || matrix->col >= 13) {
+ if (matrix->row >= KEYBOARD_ROWS ||
+ matrix->col >= KEYBOARD_COLS) {
fprintf(stderr, "Matrix pos out of range (%d,%d)\n",
matrix->row, matrix->col);
return -1;