summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/keyboard_8042_sharedlib.c18
-rw-r--r--include/config.h5
-rw-r--r--include/keyboard_8042_sharedlib.h5
3 files changed, 27 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.
diff --git a/include/config.h b/include/config.h
index 7d8d3900d1..c48ffbc5d1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1552,6 +1552,11 @@
#define CONFIG_KEYBOARD_RUNTIME_KEYS
/*
+ * Allow the keyboard scan code set tables to be modified at runtime.
+ */
+#undef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+
+/*
* Call board-supplied keyboard_suppress_noise() function when the debounced
* keyboard state changes. Some boards use this to send a signal to the audio
* codec to suppress typing noise picked up by the microphone.
diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h
index 054795e86d..5c9b559279 100644
--- a/include/keyboard_8042_sharedlib.h
+++ b/include/keyboard_8042_sharedlib.h
@@ -19,8 +19,13 @@ struct button_8042_t {
};
/* The standard Chrome OS keyboard matrix table. */
+#ifdef CONFIG_KEYBOARD_SCANCODE_MUTABLE
+extern uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS];
+extern uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS];
+#else
extern const uint16_t scancode_set1[KEYBOARD_ROWS][KEYBOARD_COLS];
extern const uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS];
+#endif
/* Button scancodes (Power, Volume Down, Volume Up, etc.) */
extern const struct button_8042_t buttons_8042[KEYBOARD_BUTTON_COUNT];