[PATCH libinput] evdev: check the first parent of the event node for ID_INPUT tags

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 12 17:51:27 PST 2015


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 at who-t.net>
---
 src/evdev.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 11fa89b..cf21d2e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -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;
+	const struct evdev_udev_tag_match *match;
+	int i;
 
-	while (match->name) {
-		prop = udev_device_get_property_value(device->udev_device,
+	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;
 }
 
-- 
2.1.0



More information about the wayland-devel mailing list