summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-01-30 09:59:49 +1000
committerKeith Packard <keithp@keithp.com>2015-01-30 14:09:24 +0100
commit697b696e5e24d0679f133183a3bb0852025377c2 (patch)
tree7e7772265bae13c5726a60dbd4dc4fd673d6e69f /config
parentdf1b401f57ad4b4925bad66684445b476562f26f (diff)
config/udev: Respect seat assignments when assigned devices
Jonathan Dieter posted a few patches to do this inside the Xorg server but it makes no sense to do it there, just have the code we use to probe the device list at startup check seat assignments using the same code we check at hotplug time. Bugilla: https://bugzilla.redhat.com/show_bug.cgi?id=1183654 Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Jonathan Dieter <jdieter@lesbg.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'config')
-rw-r--r--config/udev.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/config/udev.c b/config/udev.c
index 1d2140afd..28c265817 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -69,6 +69,24 @@ static const char *itoa(int i)
return itoa_buf;
}
+static Bool
+check_seat(struct udev_device *udev_device)
+{
+ const char *dev_seat;
+
+ dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
+ if (!dev_seat)
+ dev_seat = "seat0";
+
+ if (SeatId && strcmp(dev_seat, SeatId))
+ return FALSE;
+
+ if (!SeatId && strcmp(dev_seat, "seat0"))
+ return FALSE;
+
+ return TRUE;
+}
+
static void
device_added(struct udev_device *udev_device)
{
@@ -83,7 +101,6 @@ device_added(struct udev_device *udev_device)
struct udev_list_entry *set, *entry;
struct udev_device *parent;
int rc;
- const char *dev_seat;
dev_t devnum;
path = udev_device_get_devnode(udev_device);
@@ -93,14 +110,7 @@ device_added(struct udev_device *udev_device)
if (!path || !syspath)
return;
- dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
- if (!dev_seat)
- dev_seat = "seat0";
-
- if (SeatId && strcmp(dev_seat, SeatId))
- return;
-
- if (!SeatId && strcmp(dev_seat, "seat0"))
+ if (!check_seat(udev_device))
return;
devnum = udev_device_get_devnum(udev_device);
@@ -505,6 +515,8 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
goto no_probe;
else if (strncmp(sysname, "card", 4) != 0)
goto no_probe;
+ else if (!check_seat(udev_device))
+ goto no_probe;
config_udev_odev_setup_attribs(path, syspath, major(devnum),
minor(devnum), probe_callback);