evdev: check the first parent of the event node for ID_INPUT tags
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 13 Feb 2015 01:40:19 +0000 (11:40 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 18 Feb 2015 00:08:35 +0000 (10:08 +1000)
Bluetooth tablet devices' rules can't tag the event node directly, they can
only tag the first parent (the /sys/class/input/input1234 node). Check that
parent for tags too, lest we miss something important.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
src/evdev.c

index 11fa89baae1e89ae326b4dfc9c03aead7435c562..cf21d2e2771e595f63e7fad04a605c5dc389eb3d 100644 (file)
@@ -1356,16 +1356,23 @@ evdev_device_get_udev_tags(struct evdev_device *device,
 {
        const char *prop;
        enum evdev_device_udev_tags tags = 0;
-       const struct evdev_udev_tag_match *match = evdev_udev_tag_matches;
-
-       while (match->name) {
-               prop = udev_device_get_property_value(device->udev_device,
+       const struct evdev_udev_tag_match *match;
+       int i;
+
+       for (i = 0; i < 2 && udev_device; i++) {
+               match = evdev_udev_tag_matches;
+               while (match->name) {
+                       prop = udev_device_get_property_value(
+                                                     udev_device,
                                                      match->name);
-               if (prop)
-                       tags |= match->tag;
+                       if (prop)
+                               tags |= match->tag;
 
-               match++;
+                       match++;
+               }
+               udev_device = udev_device_get_parent(udev_device);
        }
+
        return tags;
 }