diff options
author | paris_yeh <pyeh@google.com> | 2018-06-01 16:15:24 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-20 14:23:49 -0700 |
commit | 5d825c5c9b9b805b2677b13a891a7edce0802e69 (patch) | |
tree | b2d65413008ec901575e8c291ae338600cf2f87d /common/keyboard_scan.c | |
parent | 7fdaa393dfd0b4da381f62ee50e4b1c056d6eda4 (diff) | |
download | chrome-ec-5d825c5c9b9b805b2677b13a891a7edce0802e69.tar.gz |
ec/google: Add command to fetch keyboard ID from EC
Sort k-prefix host commands and descriptions in alphabetical order
BRANCH=master
BUG=b:80168723
TEST=Check 'ectool kbid' on a reworked DUT using keyboard samples
Change-Id: If2ad654e5ef269d03365db7c3286c2281aa9d9ef
Signed-off-by: paris_yeh <pyeh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1097997
Commit-Ready: Paris Yeh <pyeh@chromium.org>
Tested-by: Paris Yeh <pyeh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Paris Yeh <pyeh@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'common/keyboard_scan.c')
-rw-r--r-- | common/keyboard_scan.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 7a015c86b3..cc3379ef16 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -9,6 +9,7 @@ #include "clock.h" #include "common.h" #include "console.h" +#include "ec_commands.h" #include "hooks.h" #include "host_command.h" #include "keyboard_config.h" @@ -880,6 +881,26 @@ DECLARE_HOST_COMMAND(EC_CMD_KEYBOARD_FACTORY_TEST, EC_VER_MASK(0)); #endif +#ifdef CONFIG_KEYBOARD_LANGUAGE_ID +int keyboard_get_keyboard_id(void) +{ + int c; + uint32_t id = 0; + + BUILD_ASSERT(sizeof(id) >= KEYBOARD_IDS); + + for (c = 0; c < KEYBOARD_IDS; c++) { + /* Check ID ghosting if more than one bit in any KSIs was set */ + if (keyboard_id[c] & (keyboard_id[c] - 1)) + /* ID ghosting is found */ + return KEYBOARD_ID_UNREADABLE; + else + id |= keyboard_id[c] << (c * 8); + } + return id; +} +#endif + /*****************************************************************************/ /* Console commands */ #ifdef CONFIG_CMD_KEYBOARD |