diff options
author | Brian Norris <briannorris@chromium.org> | 2018-05-01 16:01:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-02 22:21:11 -0700 |
commit | db55f6866bc33f740761f642c2b0138f4dd6fa2d (patch) | |
tree | cab0789b4f2f5c00fb032a0099479700816e0750 | |
parent | afb5e282ac7af5af053b427bdaa40c661fe0ca2d (diff) | |
download | chrome-ec-db55f6866bc33f740761f642c2b0138f4dd6fa2d.tar.gz |
ectool: add 'kbinfo' command
We might use this in the kernel, so it's nice to have a diagnostic
command for it too.
BRANCH=none
BUG=chromium:836279
TEST=`ectool kbinfo` on kevin and scarlet
Change-Id: I746badf0d2be53d471592a2ca0d7b8ff8070f7a1
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038729
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | util/ectool.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index ac6dbcb0d4..87f30a9bc5 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -156,6 +156,8 @@ const char help_str[] = " Get info about USB type-C accessory attached to port\n" " inventory\n" " Return the list of supported features\n" + " kbinfo\n" + " Dump keyboard matrix dimensions\n" " keyscan <beat_us> <filename>\n" " Test low-level key scanning\n" " led <name> <query | auto | off | <color> | <color>=<value>...>\n" @@ -7024,6 +7026,29 @@ static int show_fields(struct ec_mkbp_config *config, int argc, char *argv[]) return 0; } +static int cmd_kbinfo(int argc, char *argv[]) +{ + struct ec_params_mkbp_info info = { + .info_type = EC_MKBP_INFO_KBD, + }; + struct ec_response_mkbp_info resp; + int rv; + + if (argc > 1) { + fprintf(stderr, "Too many args\n"); + return -1; + } + rv = ec_command(EC_CMD_MKBP_INFO, 0, &info, sizeof(info), &resp, + sizeof(resp)); + if (rv < 0) + return rv; + + printf("Matrix rows: %d\n", resp.rows); + printf("Matrix columns: %d\n", resp.cols); + + return 0; +} + static int cmd_keyconfig(int argc, char *argv[]) { struct ec_params_mkbp_set_config req; @@ -7858,6 +7883,7 @@ const struct command commands[] = { {"led", cmd_led}, {"lightbar", cmd_lightbar}, {"keyconfig", cmd_keyconfig}, + {"kbinfo", cmd_kbinfo}, {"keyscan", cmd_keyscan}, {"kbfactorytest", cmd_keyboard_factory_test}, {"motionsense", cmd_motionsense}, |