summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajat Jain <rajatja@google.com>2020-04-08 17:55:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-05 00:03:51 +0000
commitb2f2eb6525169756f8cae1896e096bcb0754bb58 (patch)
treec021a3a6e0870cb345c191b1c3689efbbd531e8d
parent8d2187232e858d5f85501a2afcbb4b1ec1d1b59c (diff)
downloadchrome-ec-b2f2eb6525169756f8cae1896e096bcb0754bb58.tar.gz
common/keyboard_vivaldi: Enable vivaldi by default for all boards
Enable vivaldi for all boards with a default layout which is the standard chromeos layout. THe default layout means the following keys (in this order) in the top row: BACK, FORWARD, REFRESH, FULLSCREEN, OVERVIEW, BRIGHTNESS_DOWN, BRIGHTNESS_UP, MUTE, VOL_DOWN, VOL_UP It also means no "Fn" key and screenlock key is present. Note that if a board does not have the screenlock key physically, the omission of screenlock key is now needed to comply with kernel requirement that only those keys to be provided which are actually present on the keyboard. So Any boards that actually do not have the screenlock key need to provide set_vivaldi_keybd_config() function. Also, any keyboards that have chosen to use the config for keyboard customization have been left alone. [Note: For this to work, a kernel with 3 atkbd patches ending at this patchset is needed: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2174387 These have been currently backported to 4.19 and 5.4 kernels] BUG=b:146501925 TEST=Build BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: I3c3596bd0eaf5241288473c27bcf61ba7da39593 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2142536 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/keyboard_vivaldi.c35
-rw-r--r--include/config.h4
2 files changed, 39 insertions, 0 deletions
diff --git a/common/keyboard_vivaldi.c b/common/keyboard_vivaldi.c
index 46360187e4..dd3b75466d 100644
--- a/common/keyboard_vivaldi.c
+++ b/common/keyboard_vivaldi.c
@@ -80,12 +80,47 @@ ec_status get_vivaldi_keybd_config(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_GET_KEYBD_CONFIG, get_vivaldi_keybd_config,
EC_VER_MASK(0));
+#ifdef CONFIG_KEYBOARD_CUSTOMIZATION
+
+/*
+ * Boards selecting CONFIG_KEYBOARD_CUSTOMIZATION are likely to not
+ * want vivaldi code messing with their customized keyboards.
+ */
__overridable
const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
{
return NULL;
}
+#else
+
+static const struct ec_response_keybd_config default_keybd = {
+ /* Default Chromeos keyboard config */
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_FORWARD, /* T2 */
+ TK_REFRESH, /* T3 */
+ TK_FULLSCREEN, /* T4 */
+ TK_OVERVIEW, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ /* No function keys, no numeric keypad, has screenlock key */
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__overridable
+const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
+{
+ return &default_keybd;
+}
+
+#endif /* CONFIG_KEYBOARD_CUSTOMIZATION */
+
static void vivaldi_init(void)
{
uint8_t i;
diff --git a/include/config.h b/include/config.h
index 9c08c6901d..82a27bff7c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2438,6 +2438,10 @@
* the refresh key column.
* 2. the scancode_set2 and keycap_label array
* 3. keyboard_customization.h which is similar to keyboard_config.h
+ *
+ * Note that if your board has the standard chromeos keyboard layout other
+ * than the top row, and you are looking only for top row customization, then
+ * you should be looking at overriding board_vivaldi_keybd_config() instead.
*/
#undef CONFIG_KEYBOARD_CUSTOMIZATION