Skip to contentSkip to conversation

Input: soc_button_array - Set input device name

PATCH Applied Hans de Goede 2 participants 11 messages Jan 9, 2017 – Feb 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/input/misc/soc_button_array.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/input/misc/soc_button_array.c +5 -0
index 9bc1b20..d2e5186 100644
@@ -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;
Signature · 1 line
2.9.3
#1 lore raw

PATCH 2/2 Input: soc_button_array - Debounce the buttons

The soc_button_array driver was initializing (kzalloc) the debounce_interval value to 0, leading to no debouncing at all, while the buttons are simple mechanical switches.

This commit sets debounce_interval to 50ms to avoid spurious button press reports both on press and release of the button. Note 50ms may seem like a lot but soc_button_array is typically used with cheap tablets, with not so great buttons. I tried 10ms on my tablet and it is not enough, where as 50ms works well.

---
 drivers/input/misc/soc_button_array.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/misc/soc_button_array.c +2 -0
index d2e5186..e53b0a1 100644
@@ -101,6 +101,8 @@ soc_button_device_create(struct platform_device *pdev,
 		gpio_keys[n_buttons].active_low = 1;
 		gpio_keys[n_buttons].desc = info->name;
 		gpio_keys[n_buttons].wakeup = info->wakeup;
+		/* These devices often use cheap buttons, use 50 ms debounce */
+		gpio_keys[n_buttons].debounce_interval = 50;
 		n_buttons++;
 	}
 
Signature · 1 line
2.9.3
maintainer
#3 lore raw
In reply to Hans de Goede
Quoted 7 lines · Hans de Goede

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.

Quoted 25 lines
---
 drivers/input/misc/soc_button_array.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/input/misc/soc_button_array.c +5 -0
index 9bc1b20..d2e5186 100644
@@ -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;
Signature · 1 line
2.9.3

Thanks.

Signature · 1 line
Dmitry
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] Input: soc_button_array - Debounce the buttons

In reply to Hans de Goede
Quoted 11 lines · Hans de Goede

The soc_button_array driver was initializing (kzalloc) the debounce_interval value to 0, leading to no debouncing at all, while the buttons are simple mechanical switches.

This commit sets debounce_interval to 50ms to avoid spurious button press reports both on press and release of the button. Note 50ms may seem like a lot but soc_button_array is typically used with cheap tablets, with not so great buttons. I tried 10ms on my tablet and it is not enough, where as 50ms works well.

Applied, thank you.

Quoted 20 lines
---
 drivers/input/misc/soc_button_array.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/misc/soc_button_array.c +2 -0
index d2e5186..e53b0a1 100644
@@ -101,6 +101,8 @@ soc_button_device_create(struct platform_device *pdev,
 		gpio_keys[n_buttons].active_low = 1;
 		gpio_keys[n_buttons].desc = info->name;
 		gpio_keys[n_buttons].wakeup = info->wakeup;
+		/* These devices often use cheap buttons, use 50 ms debounce */
+		gpio_keys[n_buttons].debounce_interval = 50;
 		n_buttons++;
 	}
 
Signature · 1 line
2.9.3
Signature · 1 line
Dmitry
#4 lore raw
In reply to Dmitry Torokhov

Hi,

Quoted 5 lines · Dmitry Torokhov
Quoted 4 lines · Hans de Goede

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.

Quoted 7 lines
Quoted 3 lines

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 29 lines
Quoted 24 lines
---
 drivers/input/misc/soc_button_array.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/input/misc/soc_button_array.c +5 -1
index 9bc1b20..d2e5186 100644
@@ -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;
--
Quoted 2 lines

2.9.3

Thanks.

maintainer
#5 lore raw
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
 RUN{builtin}+="keyboard", GOTO="evdev_end"

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Thanks.

Signature · 1 line
Dmitry
#6 lore raw

Hi,

Quoted 55 lines · Dmitry Torokhov
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
 RUN{builtin}+="keyboard", GOTO="evdev_end"
Quoted 5 lines

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Ah, come one, requiring a custom udev rule for this is a pain, where as this is really easy to fix on the kernel side.

Besides that, the way soc_button_array works is that we currently end up with 2 identical named (gpio_keys) input devices which is all sorts of inconvenient, e.g. during testing the setkeycode support I had to guess which was which when invoking evemu-record to test, they will have the same name in "xinput list", etc.

Input device names really should be unique where ever possible, for various reasons, and here we can easily make them unique.

Regards,

Hans

#7 lore raw

Hi Dmitry,

Quoted 67 lines · Hans de Goede

Hi,

Quoted 55 lines · Dmitry Torokhov
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
 RUN{builtin}+="keyboard", GOTO="evdev_end"
Quoted 5 lines

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Ah, come one, requiring a custom udev rule for this is a pain, where as this is really easy to fix on the kernel side.

Quoted 8 lines

Besides that, the way soc_button_array works is that we currently end up with 2 identical named (gpio_keys) input devices which is all sorts of inconvenient, e.g. during testing the setkeycode support I had to guess which was which when invoking evemu-record to test, they will have the same name in "xinput list", etc.

Input device names really should be unique where ever possible, for various reasons, and here we can easily make them unique.

Dmitry, can you please respond to the above ? I still believe that having a unique name for the 2 devices is a good idea, see above for my reasons. Can you please merge this patch ?

I would like to send matching patches to the hwdb upstream to fix home and power being swapped on some devices but first this needs to be resolved...

Regards,

Hans

maintainer
#8 lore raw
In reply to Hans de Goede
Quoted 58 lines · Hans de Goede

Hi,

Quoted 55 lines · Dmitry Torokhov
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
RUN{builtin}+="keyboard", GOTO="evdev_end"
Quoted 7 lines
Quoted 5 lines

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Ah, come one, requiring a custom udev rule for this is a pain, where as

OK, do not require custom property. Provide an extended one:

# device matching the input device properties and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:phys:$attr{phys}:ev:$attr{capabilities/ev}:$attr{[dmi/id]modalias}'", \
  RUN{builtin}+="keyboard"

and either migrate old keymaps to the extended one, or keep both. In the end, there is nothing special in 'evdev:name:...' prefix, it matches across all lines of hwdb with whatever is provided in the rule.

Quoted 1 line

this is really easy to fix on the kernel side.

Even if changing the kernel seems most convenient for you it does not mean it is the right approach.

Quoted 9 lines

Besides that, the way soc_button_array works is that we currently end up with 2 identical named (gpio_keys) input devices which is all sorts of inconvenient, e.g. during testing the setkeycode support I had to guess which was which when invoking evemu-record to test, they will have the same name in "xinput list", etc.

Input device names really should be unique where ever possible, for various reasons, and here we can easily make them unique.

We never provided any guarantees about uniqueness of names of input devices and I do not think we should start now. If you plug 2 same USB keyboards you'll get 2 devices with same names. Same goes for mice, tablets, etc. I do not see why SOC buttons should be different.

Thanks.

Signature · 1 line
Dmitry
maintainer
#9 lore raw
Quoted 90 lines · Dmitry Torokhov
Quoted 58 lines · Hans de Goede

Hi,

Quoted 55 lines · Dmitry Torokhov
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
RUN{builtin}+="keyboard", GOTO="evdev_end"
Quoted 7 lines
Quoted 5 lines

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Ah, come one, requiring a custom udev rule for this is a pain, where as

OK, do not require custom property. Provide an extended one:

# device matching the input device properties and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:phys:$attr{phys}:ev:$attr{capabilities/ev}:$attr{[dmi/id]modalias}'", \
  RUN{builtin}+="keyboard"

and either migrate old keymaps to the extended one, or keep both. In the end, there is nothing special in 'evdev:name:...' prefix, it matches across all lines of hwdb with whatever is provided in the rule.

Quoted 1 line

this is really easy to fix on the kernel side.

Even if changing the kernel seems most convenient for you it does not mean it is the right approach.

Quoted 7 lines

Besides that, the way soc_button_array works is that we currently end up with 2 identical named (gpio_keys) input devices which is all sorts of inconvenient, e.g. during testing the setkeycode support I had to guess which was which when invoking evemu-record to test, they will have the same name in "xinput list", etc.

Quoted 7 lines
Quoted 2 lines

Input device names really should be unique where ever possible, for various reasons, and here we can easily make them unique.

We never provided any guarantees about uniqueness of names of input devices and I do not think we should start now. If you plug 2 same USB keyboards you'll get 2 devices with same names. Same goes for mice, tablets, etc. I do not see why SOC buttons should be different.

Forgot to add: for ordinary users, distinction between between autorepeat and not-autorepeat SOC buttons devices is absolutely uninteresting. They could care less. You just want something different about them to trigger hwdb match, and we already have that, but not in name.

Thanks.

Signature · 1 line
Dmitry
#10 lore raw
In reply to Dmitry Torokhov

Hi,

Quoted 69 lines · Dmitry Torokhov
Quoted 58 lines · Hans de Goede

Hi,

Quoted 55 lines · Dmitry Torokhov
Quoted 38 lines · Hans de Goede

Hi,

Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Hans de Goede

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.

Quoted 8 lines
Quoted 3 lines

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*

Quoted 7 lines
#    <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.

Well, you can either teach hwdb new tricks or mangle the name in udev rule. As far as I can see the original invocation is:

# device matching the input device name and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
RUN{builtin}+="keyboard", GOTO="evdev_end"
Quoted 7 lines
Quoted 5 lines

You can add a similar rule that also looks at ATTR{whatever}, but instead of using "name:$attr{name}" you can use whatever string you want.

There is no need to change kernel, it already exports all necessary data.

Ah, come one, requiring a custom udev rule for this is a pain, where as

OK, do not require custom property. Provide an extended one:

Quoted 8 lines
# device matching the input device properties and the machine's DMI data
KERNELS=="input*", IMPORT{builtin}="hwdb
'evdev:name:$attr{name}:phys:$attr{phys}:ev:$attr{capabilities/ev}:$attr{[dmi/id]modalias}'", \
  RUN{builtin}+="keyboard"

and either migrate old keymaps to the extended one, or keep both. In the end, there is nothing special in 'evdev:name:...' prefix, it matches across all lines of hwdb with whatever is provided in the rule.

Ok, I've send a pull-req to the systemd maintainers with a new rule for extended input matches + a hwdb entry for the tablet with the issue using the new extended rule.

Regards,

Hans