i1. Capability of making seats without framebuffer devices<br> logind.c: The seat is now activated by any device with udev tag "seat-master"<br> <a href="http://71-seat.rules.in">71-seat.rules.in</a>: All framebuffer devices have this tag<br>
multi-seat-x.c: if the seat does not have a framebuffer device, runs X as a proxy, adding -sharevts only<br> if the seat has a framebuffer device, makes a special config for X (like it did before)<br> <br> i2. Supporting of acls on devices shared between all seats (like /dev/snd/seq)<br>
These devices have "shared" udev tag in addition to "uaccess"<br> <br> A user gets permitions on it when he activates a session on any seat.<br> He/she losses the permitions when no his/her active sessions more exist<br>
<br> <a href="http://71-seat.rules.in">71-seat.rules.in</a>: sets "ONE_SEAT" env var to "Y" for all devices with "seat" tag<br> <a href="http://73-seat-late.rules.in">73-seat-late.rules.in</a>: inherits "ONE_SEAT" env from the parent device.<br>
sets "shared" tag to all devices with "uaccess" tag with neither "ONE_SEAT" nor "ID_SEAT" env<br> logind-acl.c: changes acl on shared devices regardless to their seats<br> logind-seat.c: when a user removes an active sessions, checks are other active sessions of this user (on other seats) exists<br>
<br>-------------------------- src/login/<a href="http://71-seat.rules.in">71-seat.rules.in</a> --------------------------<br>index f554d7f..b9921e5 100644<br>@@ -11,6 +11,7 @@ TAG=="uaccess", SUBSYSTEM!="sound", TAG+="seat"<br>
SUBSYSTEM=="sound", KERNEL=="card*", TAG+="seat"<br> SUBSYSTEM=="input", KERNEL=="input*", TAG+="seat"<br> SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", TAG+="seat"<br>
+SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", TAG+="seat-master"<br> SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"<br> <br> # 'Plugable' USB hub, sound, network, graphics adapter<br>
@@ -43,6 +44,8 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product}<br> TAG=="seat", ENV{ID_PATH}=="", IMPORT{builtin}="path_id"<br>
TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH_TAG}!="", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$env{ID_PATH_TAG}"<br> <br>+TAG=="seat", ENV{ONE_SEAT}="Y"<br>+<br> SUBSYSTEM=="input", ATTR{name}=="Wiebetech LLC Wiebetech", RUN+="@rootbindir@/loginctl lock-sessions"<br>
<br> LABEL="seat_end"<br><br>----------------------- src/login/<a href="http://73-seat-late.rules.in">73-seat-late.rules.in</a> -----------------------<br>index 901df75..f043fca 100644<br>@@ -14,4 +14,7 @@ ENV{ID_SEAT}!="", TAG+="$env{ID_SEAT}"<br>
<br> TAG=="uaccess", ENV{MAJOR}!="", RUN{builtin}+="uaccess"<br> <br>+ENV{ONE_SEAT}=="", IMPORT{parent}="ONE_SEAT"<br>+TAG=="uaccess", ENV{ONE_SEAT}!="Y", ENV{ID_SEAT}=="", TAG+="shared"<br>
+<br> LABEL="seat_late_end"<br><br>---------------------------- src/login/logind-acl.c ----------------------------<br>index cb045a9..fb4893a 100644<br>@@ -174,7 +174,7 @@ finish:<br> int devnode_acl_all(struct udev *udev,<br>
const char *seat,<br> bool flush,<br>- bool del, uid_t old_uid,<br>+ bool del, bool del_shared, uid_t old_uid,<br> bool add, uid_t new_uid) {<br>
<br> struct udev_list_entry *item = NULL, *first = NULL;<br>@@ -208,6 +208,7 @@ int devnode_acl_all(struct udev *udev,<br> udev_list_entry_foreach(item, first) {<br> struct udev_device *d;<br>
const char *node, *sn;<br>+ bool is_shared;<br> <br> d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));<br> if (!d) {<br>@@ -215,13 +216,20 @@ int devnode_acl_all(struct udev *udev,<br>
goto finish;<br> }<br> <br>- sn = udev_device_get_property_value(d, "ID_SEAT");<br>- if (isempty(sn))<br>- sn = "seat0";<br>
+ // all devices with shared tag are accessible with all seats<br>+ is_shared = udev_device_has_tag(d, "shared");<br> <br>- if (!streq(seat, sn)) {<br>- udev_device_unref(d);<br>
- continue;<br>+ if (is_shared) {<br>+ sn = "shared";<br>+ } else {<br>+ sn = udev_device_get_property_value(d, "ID_SEAT");<br>
+ if (isempty(sn))<br>+ sn = "seat0";<br>+<br>+ if (!streq(seat, sn)) {<br>+ udev_device_unref(d);<br>+ continue;<br>
+ }<br> }<br> <br> node = udev_device_get_devnode(d);<br>@@ -233,7 +241,7 @@ int devnode_acl_all(struct udev *udev,<br> <br> log_debug("Fixing up %s for seat %s...", node, sn);<br>
<br>- r = devnode_acl(node, flush, del, old_uid, add, new_uid);<br>+ r = devnode_acl(node, flush, is_shared ? del_shared : del, old_uid, add, new_uid);<br> udev_device_unref(d);<br>
<br> if (r < 0)<br><br>---------------------------- src/login/logind-acl.h ----------------------------<br>index ec09843..fe1183c 100644<br>@@ -35,7 +35,7 @@ int devnode_acl(const char *path,<br> int devnode_acl_all(struct udev *udev,<br>
const char *seat,<br> bool flush,<br>- bool del, uid_t old_uid,<br>+ bool del, bool del_shared, uid_t old_uid,<br> bool add, uid_t new_uid);<br>
#else<br> <br><br>--------------------------- src/login/logind-seat.c ---------------------------<br>index 470d08b..544b3b0 100644<br>@@ -225,7 +225,10 @@ int seat_apply_acls(Seat *s, Session *old_active) {<br> r = devnode_acl_all(s->manager->udev,<br>
s->id,<br> false,<br>- !!old_active, old_active ? old_active->user->uid : 0,<br>+ !!old_active,<br>+ // delete acl on shared devices only if no other active sessions<br>
+ old_active && user_get_state(old_active->user) != USER_ACTIVE,<br>+ old_active ? old_active->user->uid : 0,<br> !!s->active, s->active ? s->active->user->uid : 0);<br>
<br> if (r < 0)<br><br>------------------------------ src/login/logind.c ------------------------------<br>index 9cce481..16c504a 100644<br>@@ -450,11 +450,7 @@ int manager_enumerate_devices(Manager *m) {<br> goto finish;<br>
}<br> <br>- r = udev_enumerate_add_match_subsystem(e, "graphics");<br>- if (r < 0)<br>- goto finish;<br>-<br>- r = udev_enumerate_add_match_tag(e, "seat");<br>
+ r = udev_enumerate_add_match_tag(e, "seat-master");<br> if (r < 0)<br> goto finish;<br> <br>@@ -1286,11 +1282,7 @@ static int manager_connect_udev(Manager *m) {<br> if (!m->udev_seat_monitor)<br>
return -ENOMEM;<br> <br>- r = udev_monitor_filter_add_match_tag(m->udev_seat_monitor, "seat");<br>- if (r < 0)<br>- return r;<br>-<br>- r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_seat_monitor, "graphics", NULL);<br>
+ r = udev_monitor_filter_add_match_tag(m->udev_seat_monitor, "seat-master");<br> if (r < 0)<br> return r;<br> <br><br>