summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-18 21:19:23 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2011-08-22 15:56:49 +1000
commit159b03e13760920274b573a2bccdbf6a79f059e7 (patch)
tree220ca056977c363cfe09c5190b9b59138ada18ce /config
parent95772598b57f6054fbf88683fa0a492c77605790 (diff)
config: add udev/systemd multi-seat support
Add support for multi-seat-aware input device hotplugging. This implements the multi-seat scheme explained here: http://www.freedesktop.org/wiki/Software/systemd/multiseat This introduces a new X server switch "-seat" which allows configuration of the seat to enumerate hotplugging devices on. If specified the value of this parameter will also be exported as root window property Xorg_Seat. To properly support input hotplugging devices need to be tagged in udev according to the seat they are on. Untagged devices are assumed to be on the default seat "seat0". If no "-seat" parameter is passed only devices on "seat0" are used. This means that the new scheme is perfectly compatible with existing setups which have no tagged input devices. Note that the -seat switch takes a completely generic identifier, and that it has no effect on non-Linux systems. In fact, on other OSes a completely different identifier scheme for seats could be used but still be exposed with the Xorg_Seat and -seat. I tried to follow the coding style of the surrounding code blocks if there was any one could follow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'config')
-rw-r--r--config/udev.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/udev.c b/config/udev.c
index e7383dc36..fc6ee5dac 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -35,6 +35,7 @@
#include "hotplug.h"
#include "config-backends.h"
#include "os.h"
+#include "globals.h"
#define UDEV_XKB_PROP_KEY "xkb"
@@ -65,6 +66,7 @@ device_added(struct udev_device *udev_device)
struct udev_list_entry *set, *entry;
struct udev_device *parent;
int rc;
+ const char *dev_seat;
path = udev_device_get_devnode(udev_device);
@@ -73,6 +75,16 @@ 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"))
+ return;
+
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
LogMessageVerb(X_INFO, 10,
"config/udev: ignoring device %s without "
@@ -284,6 +296,9 @@ config_udev_init(void)
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
+ if (SeatId && strcmp(SeatId, "seat0"))
+ udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
+
if (udev_monitor_enable_receiving(udev_monitor)) {
ErrorF("config/udev: failed to bind the udev monitor\n");
return 0;
@@ -296,6 +311,9 @@ config_udev_init(void)
udev_enumerate_add_match_subsystem(enumerate, "input");
udev_enumerate_add_match_subsystem(enumerate, "tty");
+ if (SeatId && strcmp(SeatId, "seat0"))
+ udev_enumerate_add_match_tag(enumerate, SeatId);
+
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(device, devices) {