summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2022-05-16 17:18:50 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-17 18:53:10 +0000
commit201c108a37350ee83f214cd4c8cd046ab71b6eaa (patch)
tree8224e2fe5f56938be9523cb66829914a10710300
parent5a3274d2d804b552da9f72b3fb18cd3acaf6c2a5 (diff)
downloadchrome-ec-201c108a37350ee83f214cd4c8cd046ab71b6eaa.tar.gz
keyboard: Add register_scancode_set2 API
register_scancode_set2 API allows each board to install an entire scancode set. BUG=b:220800586 BRANCH=None TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ideafef9a4fce6197e56eee6e28acceff77803681 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3644693 Reviewed-by: Parth Malkan <parthmalkan@google.com>
-rw-r--r--common/keyboard_8042_sharedlib.c8
-rw-r--r--include/keyboard_8042_sharedlib.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/common/keyboard_8042_sharedlib.c b/common/keyboard_8042_sharedlib.c
index 1d024d3f47..8617d13871 100644
--- a/common/keyboard_8042_sharedlib.c
+++ b/common/keyboard_8042_sharedlib.c
@@ -5,6 +5,8 @@
* Objects which can be shared between RO and RW for 8042 keyboard protocol.
*/
+#include <stddef.h>
+
#include "button.h"
#include "keyboard_8042_sharedlib.h"
#include "keyboard_config.h"
@@ -37,6 +39,12 @@ static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
#endif
};
+void register_scancode_set2(uint16_t **scancode_set, size_t size)
+{
+ ASSERT(size == sizeof(scancode_set2));
+ memcpy(scancode_set2, scancode_set, size);
+}
+
uint16_t get_scancode_set2(uint8_t row, uint8_t col)
{
if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h
index 6c2e37fbf4..b03380ce4c 100644
--- a/include/keyboard_8042_sharedlib.h
+++ b/include/keyboard_8042_sharedlib.h
@@ -8,6 +8,8 @@
#ifndef __CROS_EC_KEYBOARD_8042_SHAREDLIB_H
#define __CROS_EC_KEYBOARD_8042_SHAREDLIB_H
+#include <stddef.h>
+
#include "button.h"
#include "keyboard_config.h"
#include "keyboard_protocol.h"
@@ -18,6 +20,14 @@ struct button_8042_t {
};
/**
+ * Register scancode set for the standard ChromeOS keyboard matrix set 2.
+ *
+ * @param scancode_set Scancode set to register.
+ * @param size Size of the scancode set in bytes.
+ */
+void register_scancode_set2(uint16_t **scancode_set, size_t size);
+
+/**
* Get the standard Chrome OS keyboard matrix set 2 scanset
* @param row Row number
* @param col Column number