summaryrefslogtreecommitdiff
path: root/common/keyboard_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/keyboard_scan.c')
-rw-r--r--common/keyboard_scan.c21
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