[systemd-devel] [PATCH] Ship new udev rules file to create per-seat symlinks for input devices

Laércio de Sousa lbsousajr at gmail.com
Fri Feb 14 07:52:54 PST 2014

This rules file tells udev to create symlinks for input devices
(keyboard and mouse, at this moment) separated by seat, so it could
be easier for one to get quickly the devpath of a given input
device attached to a given seat.

Example: the keyboard attached to seat-foo will receive a symlink
with path /dev/input/by-seat/seat-foo.kbd-event

It can be very handful specially for Xephyr-based multiseat setups,
where input devpaths must be passed via command line options
like -keybd and -mouse.
 Makefile.am                   | 3 ++-
 src/login/74-seat-input.rules | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 src/login/74-seat-input.rules

diff --git a/Makefile.am b/Makefile.am
index 79c49e6..b78df52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4262,7 +4262,8 @@ endif
 dist_udevrules_DATA += \
 	src/login/70-uaccess.rules \
-	src/login/70-power-switch.rules
+	src/login/70-power-switch.rules \
+	src/login/74-seat-input.rules
 nodist_udevrules_DATA += \
 	src/login/71-seat.rules \
diff --git a/src/login/74-seat-input.rules b/src/login/74-seat-input.rules
new file mode 100644
index 0000000..059a8de
--- /dev/null
+++ b/src/login/74-seat-input.rules
@@ -0,0 +1,9 @@
+# Rules for seat0
+SUBSYSTEM=="input", ENV{ID_SEAT}=="", ENV{ID_INPUT_KEYBOARD}=="1", SYMLINK+="input/by-seat/seat0.kbd-event"
+SUBSYSTEM=="input", ENV{ID_SEAT}=="", ENV{ID_INPUT_MOUSE}=="1", KERNEL=="event*", SYMLINK+="input/by-seat/seat0.mouse-event"
+SUBSYSTEM=="input", ENV{ID_SEAT}=="", ENV{ID_INPUT_MOUSE}=="1", KERNEL=="mouse*", SYMLINK+="input/by-seat/seat0.mouse"
+# Rules for other seats
+SUBSYSTEM=="input", ENV{ID_SEAT}!="", ENV{ID_INPUT_KEYBOARD}=="1", SYMLINK+="input/by-seat/$env{ID_SEAT}.kbd-event"
+SUBSYSTEM=="input", ENV{ID_SEAT}!="", ENV{ID_INPUT_MOUSE}=="1", KERNEL=="event*", SYMLINK+="input/by-seat/$env{ID_SEAT}.mouse-event"
+SUBSYSTEM=="input", ENV{ID_SEAT}!="", ENV{ID_INPUT_MOUSE}=="1", KERNEL=="mouse*", SYMLINK+="input/by-seat/$env{ID_SEAT}.mouse"

More information about the systemd-devel mailing list