chiark / gitweb /
extras/keymap/findkeyboards: Filter out non-event devices
authorMartin Pitt <martin.pitt@ubuntu.com>
Wed, 26 Oct 2011 09:03:21 +0000 (11:03 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Wed, 26 Oct 2011 09:03:21 +0000 (11:03 +0200)
This avoids running udevadm info --query=name against a non-existing devnode,
which aborts the script early.

extras/keymap/findkeyboards

index 5a22649ec9caf52411589c17ad0815e844935734..fd64301da66c03104860adeb9ca69ce0b809303b 100755 (executable)
@@ -21,6 +21,11 @@ keyboard_devices() {
     for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do
         walk=`udevadm info --attribute-walk --path=$dev`
        env=`udevadm info --query=env --path=$dev`
+        # filter out non-event devices, such as the parent input devices which
+        # have no devnode
+        if ! echo "$env" | grep -q '^DEVNAME='; then
+            continue
+        fi
         if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then
             echo -n 'AT keyboard: '
        elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then