Thread (11 messages) 11 messages, 2 authors, 2017-02-12

Re: [PATCH 1/2] Input: soc_button_array - Set input device name

flat view

From: Hans de Goede <hidden>
Date: 2017-01-22 08:49:28

Hi,

On 21-01-17 20:13, Dmitry Torokhov wrote:
On Mon, Jan 09, 2017 at 06:57:06PM +0100, Hans de Goede wrote:
quoted
On some tablets using the soc_button_array driver the buttons do not
follow the standard home, power, volume_up, volume_down, rotation_lock
button order as published by Microsoft.

We can use the existing udev hwdb mechanism to fix this up, but then
the created devices must have a unique name, therefor this commit adds
a unique name for the 2 created gpio-keys input devices.
Why does it have to have unique name? You should be able to match on
other input device properties, for example ATTR{capabilities/ev} or
ATTR{capabilities/keys} to identify the device you want to adjust.
hwdb entries do not have access to full udev data, basically there
are 2 match formats:

# Supported hardware matches are:
#  - Generic input devices match:
#      evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV
#    This matches on the kernel modalias of the input-device, mainly:
#    ZZZZ is the bus-id (see /usr/include/linux/input.h BUS_*), YYYY, XXXX and
#    WWW are the 4-digit hex uppercase vendor, product and version ID and VVVV
#    is an arbitrary length input-modalias describing the device capabilities.
#    The vendor, product and version ID for a device node "eventX" is listed
#    in /sys/class/input/eventX/device/id.
#
#  - Input driver device name and DMI data match:
#      evdev:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn*
#    <input device name> is the name device specified by the
#    driver, <vendor> is the firmware-provided string exported
#    by the kernel DMI modalias, see /sys/class/dmi/id/modalias


Since we want to match on DMI info we need to use the second, and
the info you are referring to is not available here.

Regards,

Hans

quoted
Signed-off-by: Hans de Goede <redacted>
---
 drivers/input/misc/soc_button_array.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 9bc1b20..d2e5186 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -113,6 +113,11 @@ soc_button_device_create(struct platform_device *pdev,
 	gpio_keys_pdata->nbuttons = n_buttons;
 	gpio_keys_pdata->rep = autorepeat;

+	if (autorepeat)
+		gpio_keys_pdata->name = "SoC Button Array (autorepeat buttons)";
+	else
+		gpio_keys_pdata->name = "SoC Button Array";
+
 	pd = platform_device_alloc("gpio-keys", PLATFORM_DEVID_AUTO);
 	if (!pd) {
 		error = -ENOMEM;
--
2.9.3
Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help