chiark / gitweb /
terminal: parse ID_SEAT not only for parents but the device itself
authorDavid Herrmann <dh.herrmann@gmail.com>
Sat, 20 Sep 2014 07:29:11 +0000 (09:29 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sat, 20 Sep 2014 09:46:49 +0000 (11:46 +0200)
When deciding what seat a device is on, we have to traverse all parents
to find one with an ID_SEAT tag, otherwise, input devices plugged on a
seated USB-hub are not automatically attached to the right seat. But any
tags on the main device still overwrite the tags of the childs, so fix our
logic to check the device itself first, before traversing the parents.

src/libsystemd-terminal/sysview.c

index fde87d11174b73bdc09a46114a812cb105e99064..6c1a9543b97d46cb22c047bd4842d45c17e91994 100644 (file)
@@ -893,11 +893,11 @@ static int context_ud_hotplug(sysview_context *c, struct udev_device *d) {
 
                 p = d;
                 seatname = NULL;
-                while ((p = udev_device_get_parent(p))) {
+                do {
                         seatname = udev_device_get_property_value(p, "ID_SEAT");
                         if (seatname)
                                 break;
-                }
+                } while ((p = udev_device_get_parent(p)));
 
                 seat = sysview_find_seat(c, seatname ? : "seat0");
                 if (!seat)