]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rules: Add extended evdev/input match rules for event nodes with the same name
authorHans de Goede <hdegoede@redhat.com>
Sun, 12 Feb 2017 11:33:22 +0000 (12:33 +0100)
committerHans de Goede <hdegoede@redhat.com>
Sun, 12 Feb 2017 11:43:23 +0000 (12:43 +0100)
Sometimes a system may have 2 input event nodes with the same name where
we only want to apply keyboard hwdb rules to 1 of the 2 devices.

This problem happens e.g. on devices where the soc_button_array driver is
used (e.g. intel atom based tablets) which registers 2 event nodes with
the name "gpio-keys".

This commit adds a new extended match rule which extends the match to also
check $attr{phys} and $attr{capabilities/ev}, allowing to differentiate
between devices with an identical name.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
hwdb/60-keyboard.hwdb
rules/60-evdev.rules

index c8452f47d0d7d4db8a27b82ca7177b05e077d3a5..036f2cc7ccdbd9700cac25a39597af56a10878ce 100644 (file)
 #    driver, <vendor> is the firmware-provided string exported
 #    by the kernel DMI modalias, see /sys/class/dmi/id/modalias
 #
+#  - Extended input driver device name, properties and DMI data match:
+#      evdev:name:<input device name>:phys:<phys>:ev:<ev>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn*
+#    <input device name> is the name device specified by the
+#    driver, <phys> is the physical-device-path, "cat
+#    /sys/class/input/input?/phys", <ev> is the event bitmask, "cat
+#    /sys/class/input/input?/capabilities/ev" and <vendor> is the
+#    firmware-provided string exported by the kernel DMI modalias,
+#    see /sys/class/dmi/id/modalias
+#
 # Scan codes are specified as:
 #   KEYBOARD_KEY_<hex scan code>=<key code identifier>
 # The scan code should be expressed in hex lowercase. The key codes
index ade7e7f64648c3c6220cdd506db5550d679227b5..f5d5ba6a5f8393fbbc501d43af76b0bac72937ea 100644 (file)
@@ -12,6 +12,10 @@ ENV{ID_INPUT_KEY}=="?*", DRIVERS=="atkbd", \
   IMPORT{builtin}="hwdb 'evdev:atkbd:$attr{[dmi/id]modalias}'", \
   RUN{builtin}+="keyboard", GOTO="evdev_end"
 
+# device matching the input device name + properties + 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", GOTO="evdev_end"
+
 # 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"