[systemd-devel] Preventing automatic seat assignments
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Tue Aug 26 02:17:21 PDT 2014
Hi,
If I want to designate some sound card to be shared between seats, then
I suppose that sound card shouldn't be assigned to any seats. However,
currently /usr/lib/udev/rules.d/71-seat.rules unconditionally tags all
sound cards with the "seat" tag. How should this be solved?
My current solution is to copy 71-seat.rules under /etc and apply the
following changes to it:
--- /usr/lib/udev/rules.d/71-seat.rules 2014-06-23 13:30:30.000000000 -0700
+++ /etc/udev/rules.d/71-seat.rules 2014-08-26 01:52:52.144853486 -0700
@@ -7,11 +7,15 @@
ACTION=="remove", GOTO="seat_end"
-TAG=="uaccess", SUBSYSTEM!="sound", TAG+="seat"
-SUBSYSTEM=="sound", KERNEL=="card*", TAG+="seat"
-SUBSYSTEM=="input", KERNEL=="input*", TAG+="seat"
-SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", TAG+="seat",
TAG+="master-of-seat"
-SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
+# If the device or any of its parents has the "seatless" tag set, then we
+# should not assign the device to any seat.
+TAGS=="seatless", ENV{SEATLESS}="1"
+
+ENV{SEATLESS}!="1", TAG=="uaccess", SUBSYSTEM!="sound", TAG+="seat"
+ENV{SEATLESS}!="1", SUBSYSTEM=="sound", KERNEL=="card*", TAG+="seat"
+ENV{SEATLESS}!="1", SUBSYSTEM=="input", KERNEL=="input*", TAG+="seat"
+ENV{SEATLESS}!="1", SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*",
TAG+="seat", TAG+="master-of-seat"
+ENV{SEATLESS}!="1", SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
# 'Plugable' USB hub, sound, network, graphics adapter
SUBSYSTEM=="usb", ATTR{idVendor}=="2230", ATTR{idProduct}=="000[13]",
ENV{ID_AUTOSEAT}="1"
(Sorry if the diff is wrapped wrongly, I don't know how to tell
Thunderbird to not do that.)
Then in another rule file I have this:
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card0", TAG+="seatless"
This works, but these rules will probably end up being packaged so that
the configuration can be easily installed in systems that want to use
this seat configuration (it's of course very hardware-specific, so not
all systems will want it). I don't like the idea of installing packaged
rules under /etc, but that's the only option if I want to override
71-seat.rules. Would upstream accept this change to 71-seat.rules, or
some other solution for marking devices as "do not assign to seat"?
Another thing is that introducing the SEATLESS environment variable
could be avoided if I could test whether the "seatless" tag does *not*
exist in any parent devices. Is there any way to do this?
TAGS!="seatless" didn't work.
--
Tanu
More information about the systemd-devel
mailing list