summaryrefslogtreecommitdiff
path: root/common/keyboard_8042_sharedlib.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2017-05-16 07:37:33 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-18 18:07:29 -0700
commit76e064815ff5f8091fb7c127c044fa29e1d7e9c1 (patch)
treeaf68f2ae59e3a6f87103dd78e62dc5fe76513bd1 /common/keyboard_8042_sharedlib.c
parent11237d5e911d769cac995e2e1ab9d16598542bc8 (diff)
downloadchrome-ec-76e064815ff5f8091fb7c127c044fa29e1d7e9c1.tar.gz
keyboard_8042: Allow scancode sets to be mutable
Add an option to allow the scancode sets to be mutable. The only reason to use this is to allow a scancode to be changed at runtime, for instance to support different keyboards in one image. The side effect of this is the scancode sets are moved out of the shared RO section. BUG=b:36735408 BRANCH=none TEST=make -j buildall Change-Id: Iefb97691d1f295411d7b5db603d9214d41af49fd Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/506717 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'common/keyboard_8042_sharedlib.c')
-rw-r--r--common/keyboard_8042_sharedlib.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/common/keyboard_8042_sharedlib.c b/common/keyboard_8042_sharedlib.c
index cfc00d5759..7aba63502d 100644
--- a/common/keyboard_8042_sharedlib.c
+++ b/common/keyboard_8042_sharedlib.c
@@ -13,7 +13,11 @@
#include "util.h"
/* The standard Chrome OS keyboard matrix table. */
+#ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS] = {
+#else
SHAREDLIB(const uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS] = {
+#endif
{0x0000, 0xe05b, 0x003b, 0x0030, 0x0044, 0x0073, 0x0031, 0x0000, 0x000d,
0x0000, 0xe038, 0x0000, 0x0000},
{0x0000, 0x0001, 0x003e, 0x0022, 0x0041, 0x0000, 0x0023, 0x0000, 0x0028,
@@ -30,9 +34,17 @@ SHAREDLIB(const uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS] = {
0x000a, 0x0038, 0xe050, 0xe04d},
{0x0000, 0x0010, 0x0012, 0x0013, 0x0011, 0x0017, 0x0016, 0x0036, 0x0019,
0x0018, 0x0000, 0xe048, 0xe04b},
+#ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+};
+#else
});
+#endif
-SHAREDLIB(const uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = {
+#ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = {
+#else
+SHAREDLIB(uint16_t const scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = {
+#endif
{0x0000, 0xe01f, 0x0005, 0x0032, 0x0009, 0x0051, 0x0031, 0x0000, 0x0055,
0x0000, 0xe011, 0x0000, 0x0000},
{0x0000, 0x0076, 0x000c, 0x0034, 0x0083, 0x0000, 0x0033, 0x0000, 0x0052,
@@ -49,7 +61,11 @@ SHAREDLIB(const uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = {
0x0046, 0x0011, 0xe072, 0xe074},
{0x0000, 0x0015, 0x0024, 0x002d, 0x001d, 0x0043, 0x003c, 0x0059, 0x004d,
0x0044, 0x0000, 0xe075, 0xe06b},
+#ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+};
+#else
});
+#endif
/*
* Button scancodes.