chiark / gitweb /
rules: avoid 'device/' accesses
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 20 Mar 2015 11:28:12 +0000 (12:28 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 20 Mar 2015 11:28:12 +0000 (12:28 +0100)
We should never access parents, as the sysfs hierarchy is in no way
stable. Use KERNELS== etc. to match on a parent, then access it via
$attr{} (which accesses the matching device, not the current device).

rules/60-keyboard.rules

index af3edb5f58fa9708ceed28128da4765156a45aca..fe616917da8569baad1412cc70e9d4f7ec1d6750 100644 (file)
@@ -13,7 +13,7 @@ DRIVERS=="atkbd", IMPORT{builtin}="hwdb 'keyboard:atkbd:$attr{[dmi/id]modalias}'
   RUN{builtin}+="keyboard", GOTO="keyboard_end"
 
 # device matching the input device name and the machine's DMI data
   RUN{builtin}+="keyboard", GOTO="keyboard_end"
 
 # device matching the input device name and the machine's DMI data
-IMPORT{builtin}="hwdb 'keyboard:name:$attr{device/name}:$attr{[dmi/id]modalias}'", \
+KERNELS=="input*", IMPORT{builtin}="hwdb 'keyboard:name:$attr{name}:$attr{[dmi/id]modalias}'", \
   RUN{builtin}+="keyboard", GOTO="keyboard_end"
 
 LABEL="keyboard_end"
   RUN{builtin}+="keyboard", GOTO="keyboard_end"
 
 LABEL="keyboard_end"