Input/HID: Consolidate ChromeOS Vivaldi keyboard logic
Subsystems (3)
v3 cover Input/HID: Consolidate ChromeOS Vivaldi keyboard logic
This is a follow-on to this thread[1] where we discussed the need to support the vivaldi keyboard function row keys in the google hammer driver. I've extracted the common code into a new vivaldi-keymap.c file that can be used by the various keyboard drivers used on ChromeOS devices to expose the function_row_physmap sysfs attribute. That's a good place to keep the HID parsing logic for the vivaldi and hammer keyboards too, so one function goes there for that as well. Finally, we add support for the function row physmap attribute to the hammer driver.
Changes from v2 (https://lore.kernel.org/r/[email protected]):
* Drop first patch to change to u16
* Change array type to u32 in vivaldi_data
Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Yet another new file for HID part to fix compilation problems
Stephen Boyd (3):
Input: Extract ChromeOS vivaldi physmap show function
HID: Extract vivaldi hid feature mapping for use in hid-hammer
HID: google: Add support for vivaldi to hid-hammer
Zhengqiao Xia (1):
HID: google: modify HID device groups of eel
drivers/hid/Kconfig | 11 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-google-hammer.c | 97 +++++++++++++++++++++------ drivers/hid/hid-vivaldi-common.c | 97 +++++++++++++++++++++++++++ drivers/hid/hid-vivaldi.c | 88 ++---------------------- drivers/input/Kconfig | 7 ++ drivers/input/Makefile | 1 + drivers/input/keyboard/Kconfig | 2 + drivers/input/keyboard/atkbd.c | 22 ++---- drivers/input/keyboard/cros_ec_keyb.c | 32 +++------ drivers/input/vivaldi-keymap.c | 39 +++++++++++ include/linux/input/vivaldi-keymap.h | 37 ++++++++++ 12 files changed, 292 insertions(+), 142 deletions(-) create mode 100644 drivers/hid/hid-vivaldi-common.c create mode 100644 drivers/input/vivaldi-keymap.c create mode 100644 include/linux/input/vivaldi-keymap.h
[1] https://lore.kernel.org/r/[email protected]
base-commit: dfd42facf1e4ada021b939b4e19c935dcdd55566
Signature · 1 line
https://chromeos.dev
PATCH v3 1/4 Input: Extract ChromeOS vivaldi physmap show function
Let's introduce a common library file for the physmap show function duplicated between three different keyboard drivers. This largely copies the code from cros_ec_keyb.c which has the most recent version of the show function, while using the vivaldi_data struct from the hid-vivaldi driver. This saves a small amount of space in an allyesconfig build.
$ ./scripts/bloat-o-meter vmlinux.before vmlinux.after
add/remove: 3/0 grow/shrink: 2/3 up/down: 412/-720 (-308)
Function old new deltavivaldi_function_row_physmap_show - 292 +292
_sub_I_65535_1 1057564 1057616 +52 _sub_D_65535_0 1057564 1057616 +52 e843419@49f2_00062737_9b04 - 8 +8 e843419@20f6_0002a34d_35bc - 8 +8 atkbd_parse_fwnode_data 480 472 -8 atkbd_do_show_function_row_physmap 316 76 -240 function_row_physmap_show 620 148 -472
Total: Before=285581925, After=285581617, chg -0.00%
--- drivers/hid/Kconfig | 1 + drivers/hid/hid-vivaldi.c | 27 +++++-------------- drivers/input/Kconfig | 7 +++++ drivers/input/Makefile | 1 + drivers/input/keyboard/Kconfig | 2 ++ drivers/input/keyboard/atkbd.c | 22 +++++---------- drivers/input/keyboard/cros_ec_keyb.c | 32 ++++++++-------------- drivers/input/vivaldi-keymap.c | 39 +++++++++++++++++++++++++++ include/linux/input/vivaldi-keymap.h | 28 +++++++++++++++++++ 9 files changed, 102 insertions(+), 57 deletions(-) create mode 100644 drivers/input/vivaldi-keymap.c create mode 100644 include/linux/input/vivaldi-keymap.h
drivers/hid/Kconfig +1 -0
@@ -411,6 +411,7 @@ config HID_GOOGLE_HAMMER config HID_VIVALDI tristate "Vivaldi Keyboard" + select INPUT_VIVALDIFMAP depends on HID help Say Y here if you want to enable support for Vivaldi keyboards.
drivers/hid/hid-vivaldi.c +6 -21
@@ -8,37 +8,22 @@#include <linux/device.h> #include <linux/hid.h> +#include <linux/input/vivaldi-keymap.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/sysfs.h> -#define MIN_FN_ROW_KEY 1 -#define MAX_FN_ROW_KEY 24#define HID_VD_FN_ROW_PHYSMAP 0x00000001#define HID_USAGE_FN_ROW_PHYSMAP (HID_UP_GOOGLEVENDOR | HID_VD_FN_ROW_PHYSMAP) -struct vivaldi_data { -u32 function_row_physmap[MAX_FN_ROW_KEY -MIN_FN_ROW_KEY +1 ]; -int max_function_row_key; -}; -static ssize_t function_row_physmap_show (struct device *dev,struct device_attribute *attr,char *buf) {struct hid_device *hdev =to_hid_device (dev);struct vivaldi_data *drvdata =hid_get_drvdata (hdev); -ssize_t size =0 ; -int i; - -if (!drvdata->max_function_row_key) -return 0 ; -for (i =0 ; i < drvdata->max_function_row_key; i++) - size +=sprintf (buf + size,"%02X " , - drvdata->function_row_physmap[i]); - size +=sprintf (buf + size,"\n" ); -return size; +return vivaldi_function_row_physmap_show (drvdata, buf); }static DEVICE_ATTR_RO (function_row_physmap);
@@ -86,10 +71,10 @@ static void vivaldi_feature_mapping(struct hid_device *hdev,return ; fn_key = (usage->hid &HID_USAGE ); -if (fn_key <MIN_FN_ROW_KEY || fn_key >MAX_FN_ROW_KEY ) +if (fn_key <VIVALDI_MIN_FN_ROW_KEY || fn_key >VIVALDI_MAX_FN_ROW_KEY )return ; -if (fn_key > drvdata->max_function_row_key) - drvdata->max_function_row_key = fn_key; +if (fn_key > drvdata->num_function_row_keys) + drvdata->num_function_row_keys = fn_key; report_data = buf =hid_alloc_report_buf (report,GFP_KERNEL );if (!report_data)
@@ -134,7 +119,7 @@ static void vivaldi_feature_mapping(struct hid_device *hdev, goto out; } - drvdata->function_row_physmap[fn_key -MIN_FN_ROW_KEY ] = + drvdata->function_row_physmap[fn_key -VIVALDI_MIN_FN_ROW_KEY ] = field->value[usage->usage_index]; out:
drivers/input/Kconfig +7 -0
@@ -77,6 +77,13 @@ config INPUT_MATRIXKMAP To compile this driver as a module, choose M here: the module will be called matrix-keymap. +config INPUT_VIVALDIFMAP + tristate + help + ChromeOS Vivaldi keymap support library. This is a hidden + option so that drivers can use common code to parse and + expose the vivaldi function row keymap. + comment "Userland interfaces" config INPUT_MOUSEDEV
drivers/input/Makefile +1 -0
@@ -12,6 +12,7 @@ input-core-y += touchscreen.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o +obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-keymap.o obj-$(CONFIG_INPUT_LEDS) += input-leds.o obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
drivers/input/keyboard/Kconfig +2 -0
@@ -103,6 +103,7 @@ config KEYBOARD_ATKBD select SERIO_LIBPS2 select SERIO_I8042 if ARCH_MIGHT_HAVE_PC_SERIO select SERIO_GSCPS2 if GSC + select INPUT_VIVALDIFMAP help Say Y here if you want to use a standard AT or PS/2 keyboard. Usually you'll need this, unless you have a different type keyboard (USB, ADB
@@ -749,6 +750,7 @@ config KEYBOARD_XTKBD config KEYBOARD_CROS_EC tristate "ChromeOS EC keyboard" select INPUT_MATRIXKMAP + select INPUT_VIVALDIFMAP depends on CROS_EC help Say Y here to enable the matrix keyboard used by ChromeOS devices
drivers/input/keyboard/atkbd.c +7 -15
@@ -19,6 +19,7 @@#include <linux/interrupt.h> #include <linux/init.h> #include <linux/input.h> +#include <linux/input/vivaldi-keymap.h> #include <linux/serio.h> #include <linux/workqueue.h> #include <linux/libps2.h>
@@ -237,8 +238,7 @@ struct atkbd {/* Serializes reconnect(), attr->set() and event work */ struct mutex mutex; -u32 function_row_physmap[MAX_FUNCTION_ROW_KEYS ]; -int num_function_row_keys; +struct vivaldi_data vdata; };/*
@@ -308,17 +308,9 @@ static struct attribute *atkbd_attributes[] = {static ssize_t atkbd_show_function_row_physmap (struct atkbd *atkbd,char *buf) { -ssize_t size =0 ; -int i; - -if (!atkbd->num_function_row_keys) -return 0 ; +const struct vivaldi_data *data = &atkbd->vdata; -for (i =0 ; i < atkbd->num_function_row_keys; i++) - size +=scnprintf (buf + size,PAGE_SIZE - size,"%02X " , - atkbd->function_row_physmap[i]); - size +=scnprintf (buf + size,PAGE_SIZE - size,"\n" ); -return size; +return vivaldi_function_row_physmap_show (data, buf); } static umode_t atkbd_attr_is_visible(struct kobject *kobj,
@@ -329,7 +321,7 @@ static umode_t atkbd_attr_is_visible(struct kobject *kobj,struct atkbd *atkbd =serio_get_drvdata (serio);if (attr == &atkbd_attr_function_row_physmap.attr && - !atkbd->num_function_row_keys) + !atkbd->vdata.num_function_row_keys)return 0 ;return attr->mode;
@@ -1208,8 +1200,8 @@ static void atkbd_parse_fwnode_data(struct serio *serio) n =device_property_count_u32 (dev,"function-row-physmap" );if (n >0 && n <=MAX_FUNCTION_ROW_KEYS && !device_property_read_u32_array (dev,"function-row-physmap" , - atkbd->function_row_physmap, n)) { - atkbd->num_function_row_keys = n; + atkbd->vdata.function_row_physmap, n)) { + atkbd->vdata.num_function_row_keys = n;dev_dbg (dev,"FW reported %d function-row key locations\n" , n); } }
drivers/input/keyboard/cros_ec_keyb.c +11 -21
@@ -15,6 +15,7 @@#include <linux/bitops.h> #include <linux/i2c.h> #include <linux/input.h> +#include <linux/input/vivaldi-keymap.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/notifier.h>
@@ -44,9 +45,7 @@* @idev: The input device for the matrix keys. * @bs_idev: The input device for non-matrix buttons and switches (or NULL). * @notifier: interrupt event notifier for transport devices -* @function_row_physmap: An array of the encoded rows/columns for the top -* row function keys, in an order from left to right -* @num_function_row_keys: The number of top row keys in a custom keyboard +* @vdata: vivaldi function row data */ struct cros_ec_keyb {unsigned int rows;
@@ -64,8 +63,7 @@ struct cros_ec_keyb {struct input_dev *bs_idev;struct notifier_block notifier; -u16 function_row_physmap[MAX_NUM_TOP_ROW_KEYS ]; -size_t num_function_row_keys; +struct vivaldi_data vdata; };/**
@@ -537,7 +535,7 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)int err;struct property *prop;const __be32 *p; -u16 *physmap; +u32 *physmap;u32 key_pos;int row, col;
@@ -591,10 +589,10 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev) ckdev->idev = idev;cros_ec_keyb_compute_valid_keys (ckdev); - physmap = ckdev->function_row_physmap; + physmap = ckdev->vdata.function_row_physmap;of_property_for_each_u32 (dev->of_node,"function-row-physmap" , prop, p, key_pos) { -if (ckdev->num_function_row_keys ==MAX_NUM_TOP_ROW_KEYS ) { +if (ckdev->vdata.num_function_row_keys ==MAX_NUM_TOP_ROW_KEYS ) {dev_warn (dev,"Only support up to %d top row keys\n" ,MAX_NUM_TOP_ROW_KEYS );break ;
@@ -603,7 +601,7 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev) col =KEY_COL (key_pos); *physmap =MATRIX_SCAN_CODE (row, col, ckdev->row_shift); physmap++; - ckdev->num_function_row_keys++; + ckdev->vdata.num_function_row_keys++; } err =input_register_device (ckdev->idev);
@@ -619,18 +617,10 @@ static ssize_t function_row_physmap_show(struct device *dev,struct device_attribute *attr, char *buf) { - ssize_t size = 0; -int i; -struct cros_ec_keyb *ckdev =dev_get_drvdata (dev); -u16 *physmap = ckdev->function_row_physmap; - -for (i =0 ; i < ckdev->num_function_row_keys; i++) - size +=scnprintf (buf + size,PAGE_SIZE - size, -"%s%02X" , size ?" " :"" , physmap[i]); -if (size) - size +=scnprintf (buf + size,PAGE_SIZE - size,"\n" ); + const struct cros_ec_keyb *ckdev = dev_get_drvdata(dev); +const struct vivaldi_data *data = &ckdev->vdata; -return size; +return vivaldi_function_row_physmap_show (data, buf); }static DEVICE_ATTR_RO (function_row_physmap);
@@ -648,7 +638,7 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,struct cros_ec_keyb *ckdev =dev_get_drvdata (dev);if (attr == &dev_attr_function_row_physmap.attr && - !ckdev->num_function_row_keys) + !ckdev->vdata.num_function_row_keys)return 0 ;return attr->mode;
drivers/input/vivaldi-keymap.c new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Helpers for ChromeOS Vivaldi keyboard function row mapping +* +* Copyright (C) 2022 Google, Inc +*/ + +#include <linux/export.h> +#include <linux/input/vivaldi-keymap.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/types.h> + +/** +* vivaldi_function_row_physmap_show - Print vivaldi function row physmap attribute +* @data: The vivaldi function keymap +* @buf: Buffer to print the function row phsymap to +*/ +ssize_t vivaldi_function_row_physmap_show (const struct vivaldi_data *data, +char *buf) +{ +ssize_t size =0 ; +int i; +const u32 *physmap = data->function_row_physmap; + +if (!data->num_function_row_keys) +return 0 ; + +for (i =0 ; i < data->num_function_row_keys; i++) + size +=scnprintf (buf + size,PAGE_SIZE - size, +"%s%02X" , size ?" " :"" , physmap[i]); +if (size) + size +=scnprintf (buf + size,PAGE_SIZE - size,"\n" ); + +return size; +} +EXPORT_SYMBOL_GPL (vivaldi_function_row_physmap_show); + +MODULE_LICENSE ("GPL" );
include/linux/input/vivaldi-keymap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _VIVALDI_KEYMAP_H +#define _VIVALDI_KEYMAP_H + +#include <linux/types.h> + +#define VIVALDI_MIN_FN_ROW_KEY 1 +#define VIVALDI_MAX_FN_ROW_KEY 24 + +/** +* struct vivaldi_data - Function row keymap data for ChromeOS vivaldi keyboards +* @function_row_physmap: An array of the encoded rows/columns for the top +* row function keys, in an order from left to right +* @num_function_row_keys: The number of top row keys in a custom keyboard +* +* This structure is supposed to be used by ChromeOS keyboards using +* the vivaldi keyboard function row design. +*/ +struct vivaldi_data { +u32 function_row_physmap[VIVALDI_MAX_FN_ROW_KEY -VIVALDI_MIN_FN_ROW_KEY +1 ]; +int num_function_row_keys; +}; + + +ssize_t vivaldi_function_row_physmap_show (const struct vivaldi_data *data, +char *buf); + +#endif /* _VIVALDI_KEYMAP_H */
Signature · 1 line
https://chromeos.dev
A message that is not in the archive (sent off-list or not yet received): CAOOzhkpDvR14-D9YcZzbAQdQkDmas_XUtV-CLBR7+a3AuxgstQ@mail.gmail.com
Re: [PATCH v3 1/4] Input: Extract ChromeOS vivaldi physmap show function
Quoting Sean O'Brien (2022-02-15 13:50:03)
Quoted 5 lines
Hi Stephen,
Thanks for updating the vivaldi functionality with these patches. I took a look at your changes and I don't have any objections. I also tested on a couple of HID vivaldi keyboards and they worked as expected.
Thanks. Can you provide a Tested-by: tag with your name and email?
Sean O'Brien
Tested-byRe: [PATCH v3 1/4] Input: Extract ChromeOS vivaldi physmap show function
Quoted 1 line · Stephen Boyd
Thanks. Can you provide a Tested-by: tag with your name and email?
Yes,
Dmitry Torokhov
maintainerRe: [PATCH v3 1/4] Input: Extract ChromeOS vivaldi physmap show function
In reply to Stephen BoydQuoted 26 lines · Stephen Boyd
Let's introduce a common library file for the physmap show function duplicated between three different keyboard drivers. This largely copies the code from
cros_ec_keyb.cwhich has the most recent version of the show function, while using thevivaldi_datastruct from the hid-vivaldi driver. This saves a small amount of space in an allyesconfig build.$ ./scripts/bloat-o-meter vmlinux.before vmlinux.afteradd/remove: 3/0 grow/shrink: 2/3 up/down: 412/-720 (-308)
Function old new deltavivaldi_function_row_physmap_show- 292 +292_sub_I_65535_1 1057564 1057616 +52 _sub_D_65535_0 1057564 1057616 +52 e843419@49f2_00062737_9b04 - 8 +8 e843419@20f6_0002a34d_35bc - 8 +8 atkbd_parse_fwnode_data 480 472 -8 atkbd_do_show_function_row_physmap 316 76 -240 function_row_physmap_show 620 148 -472Total: Before=285581925, After=285581617, chg -0.00%
Cc Jiri Kosina <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc "Sean O'Brien" <[email protected]>Cc Douglas Anderson <[email protected]>Cc Zhengqiao Xia <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 10 lines
--- drivers/hid/Kconfig | 1 + drivers/hid/hid-vivaldi.c | 27 +++++-------------- drivers/input/Kconfig | 7 +++++ drivers/input/Makefile | 1 + drivers/input/keyboard/Kconfig | 2 ++ drivers/input/keyboard/atkbd.c | 22 +++++---------- drivers/input/keyboard/cros_ec_keyb.c | 32 ++++++++-------------- drivers/input/vivaldi-keymap.c | 39 +++++++++++++++++++++++++++ include/linux/input/vivaldi-keymap.h | 28 +++++++++++++++++++
Since you called the config INPUT_VIVALDIFMAP I think we should call these files vivaldi-fmap.(h|c) as well. They are not really keymaps.
Anyway, this makes sense to me. Jiri, Benjamin, do you want to merge this or do you want to take it all throgh your tree?
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH v3 1/4] Input: Extract ChromeOS vivaldi physmap show function
Quoted 2 lines · Dmitry Torokhov
Anyway, this makes sense to me. Jiri, Benjamin, do you want to merge this or do you want to take it all throgh your tree?
The more substantial changes are happening in generic Input code, so I guess it makes more sense for you to take it.
Please feel free to add
to the HID parts.
Thanks!
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH v3 1/4] Input: Extract ChromeOS vivaldi physmap show function
In reply to Dmitry TorokhovQuoting Dmitry Torokhov (2022-02-15 21:36:09)
Quoted 11 lines · Stephen Boyd
Quoted 7 lines
drivers/input/Kconfig | 7 +++++ drivers/input/Makefile | 1 + drivers/input/keyboard/Kconfig | 2 ++ drivers/input/keyboard/atkbd.c | 22 +++++---------- drivers/input/keyboard/cros_ec_keyb.c | 32 ++++++++-------------- drivers/input/vivaldi-keymap.c | 39 +++++++++++++++++++++++++++ include/linux/input/vivaldi-keymap.h | 28 +++++++++++++++++++Since you called the config
INPUT_VIVALDIFMAPI think we should call these files vivaldi-fmap.(h|c) as well. They are not really keymaps.
Sure. I used 'f' for 'function'. It could also be INPUT_VIVALDI_PHYSMAP and vivaldi-physmap.(h|c) if that's more appropriate. I'll resend this with fmap and we can take it from there.
PATCH v3 2/4 HID: Extract vivaldi hid feature mapping for use in hid-hammer
In reply to Stephen BoydWe need to support parsing the HID device in both the vivaldi and the hammer drivers so that we can properly expose the function row physmap to userspace when a hammer device uses a vivaldi keyboard layout for the function row keys. Extract the feature mapping logic from the vivaldi driver into an hid specific vivaldi library so we can use it from both HID drivers.
--- drivers/hid/Kconfig | 9 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-vivaldi-common.c | 97 ++++++++++++++++++++++++++++ drivers/hid/hid-vivaldi.c | 69 +------------------- include/linux/input/vivaldi-keymap.h | 9 +++ 5 files changed, 118 insertions(+), 67 deletions(-) create mode 100644 drivers/hid/hid-vivaldi-common.c
drivers/hid/Kconfig +9 -0
@@ -403,14 +403,23 @@ config HOLTEK_FF Say Y here if you have a Holtek On Line Grip based game controller and want to have force feedback support for it. +config HID_VIVALDI_COMMON + tristate + help + ChromeOS Vivaldi HID parsing support library. This is a hidden + option so that drivers can use common code to parse the HID + descriptors for vivaldi function row keymap. + config HID_GOOGLE_HAMMER tristate "Google Hammer Keyboard" + select HID_VIVALDI_COMMON depends on USB_HID && LEDS_CLASS && CROS_EC help Say Y here if you have a Google Hammer device. config HID_VIVALDI tristate "Vivaldi Keyboard" + select HID_VIVALDI_COMMON select INPUT_VIVALDIFMAP depends on HID help
drivers/hid/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o obj-$(CONFIG_HID_GFRM) += hid-gfrm.o obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o +obj-$(CONFIG_HID_VIVALDI_COMMON) += hid-vivaldi-common.o obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o obj-$(CONFIG_HID_GT683R) += hid-gt683r.o
drivers/hid/hid-vivaldi-common.c new file +97 -0
97 lines not on this page · raw message
drivers/hid/hid-vivaldi.c +2 -67
81 lines not on this page · raw message
include/linux/input/vivaldi-keymap.h +9 -0
@@ -4,6 +4,10 @@#include <linux/types.h> +struct hid_device ; +struct hid_field ; +struct hid_usage ; +#define VIVALDI_MIN_FN_ROW_KEY 1#define VIVALDI_MAX_FN_ROW_KEY 24
@@ -25,4 +29,9 @@ struct vivaldi_data {ssize_t vivaldi_function_row_physmap_show (const struct vivaldi_data *data,char *buf); +void vivaldi_hid_feature_mapping (struct vivaldi_data *data, +struct hid_device *hdev, +struct hid_field *field, +struct hid_usage *usage); +#endif /* _VIVALDI_KEYMAP_H */
Signature · 1 line
https://chromeos.dev
PATCH v3 3/4 HID: google: Add support for vivaldi to hid-hammer
In reply to Stephen BoydAdd support to the hammer driver to parse vivaldi keyboard layouts and expose them to userspace. This allows hammer devices to use vivaldi function row keys while also supporting the other features this driver supports, like the CBAS (chrome base attached switch) and a keyboard backlight.
--- drivers/hid/Kconfig | 1 + drivers/hid/hid-google-hammer.c | 95 +++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 21 deletions(-)
drivers/hid/Kconfig +1 -0
@@ -413,6 +413,7 @@ config HID_VIVALDI_COMMON config HID_GOOGLE_HAMMER tristate "Google Hammer Keyboard" select HID_VIVALDI_COMMON + select INPUT_VIVALDIFMAP depends on USB_HID && LEDS_CLASS && CROS_EC help Say Y here if you have a Google Hammer device.
drivers/hid/hid-google-hammer.c +74 -21
158 lines not on this page · raw message
Signature · 1 line
https://chromeos.dev
PATCH v3 4/4 HID: google: modify HID device groups of eel
In reply to Stephen BoydFrom: Zhengqiao Xia <[email protected]>
If HID_GROUP of eel is set to HID_GROUP_GENERIC, Whiskers Tablet Mode Switch of eel hammer will not be detected by system because the hid-vivaldi driver probes the device. When it is set to HID_GROUP_VIVALDI, system will detect Whiskers Tablet Mode Switch successfully and also support the vivaldi keyboard layout.
--- drivers/hid/hid-google-hammer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-google-hammer.c +1 -1
@@ -636,7 +636,7 @@ static void hammer_remove(struct hid_device *hdev)static const struct hid_device_id hammer_devices[] = { {HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC ,USB_VENDOR_ID_GOOGLE ,USB_DEVICE_ID_GOOGLE_DON ) }, - {HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC , + {HID_DEVICE (BUS_USB ,HID_GROUP_VIVALDI ,USB_VENDOR_ID_GOOGLE ,USB_DEVICE_ID_GOOGLE_EEL ) }, {HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC ,USB_VENDOR_ID_GOOGLE ,USB_DEVICE_ID_GOOGLE_HAMMER ) },
Signature · 1 line
https://chromeos.dev