В Пт., 23/11/2012 в 18:22 +0100, Lennart Poettering пишет: > > OK. So we need two changes: > > > > (1). Introduce a new udev tag that means "master device" for the seat. > > Support it with logind.c. Add an udev rule that sets this tag for all > > framebuffer device > > Yes, and please name this tag "seat-master". >
The patch is ready (see attached file). I've tested it on my computer with two nvidia cards and closed source driver ant on a virtualbox with one framebuffer device. Seems everything works. But I coudn't test it with two real framebuffer devices. > > (2). multi-seat-x should not trigger an error if there is no framebufer > > device exist on the seat. It is a temporary stuff until X can get device > > from -seat, so it may look for a specially named config file or just > > start X without any addition parameters (or with -sharevts only) > > I'd much prefer if this was done in X instead. i.e. via matching the > -seat parameter when parsing configuration files. > The problem is not the -seat parameter, but the following: 1. The path /usr/lib/systemd/systemd-multi-seat-x path is hardcode in GDM for all seats except seat0 2. If the seat does not contain а framebuffer device then systemd-multi-seat-x stops with "Failed to find device node for seat % s." So some minimal changes of multi-seat-x are necessary: if there is no framebuffer device then it just starts X with -sharevts, but without making a config file. This change is also included in the attached patch > i.e. xorg.conf currently already knows: > > MatchProduct > MatchDevicePath > MatchTag > MatchDriver > > Maybe introducing a MatchSeat construct in this style would be the best > solution? > It is a good idea and I support it. But I think better it should be discussed at Xorg rather here. The next possible activities related to systemd and multi-seat might be: 1. Describe the tag "seat-master" at http://www.freedesktop.org/wiki/Software/systemd/multiseat I do not have a write access on this page, but I can post changed pieces of text here. 2. Make 'loginctl seat-status' to display which device is a seat-master 3. Make 'loginctl attach' capable of adding a device as a seat-master. For example # loginctl attach -master seat1 /sys/devices/pci0000:00/0000:00:06.0/0000:02:00.1/sound/card1 It would create an udev rule with ENV{ID_SEAT}="seat1", TAG+="seat-master" 4. Now the case is not resolved if two or more seat-master devices exist in the same seat and one of them becomes unplugged. Seems according the login.c, manager_process_seat_device function will destroy the seat, but this behavior does not look like a correct. The same issue exists with framebuffer devices. 5. An issue is not related to framebuffer but to user access privileges: users cann't access /dev/snd/seq device in a multi-seat environment. This device is used by all MIDI applications, so they do not work (the workaround is to include users to the audio group, but it causes all sound card are accessible regardless their seats). If nobody is opposite, I'm planning to work with these issues and I'd like to meet any related opinions. Oleg.
From: Oleg Samarin <osamari...@gmail.com> Subject: [PATCH] logind: multi-seat without framebuffer devices The seat is now activated by any device with udev tag "seat-master" All framebuffer devices have this tag multi-seat-x : if the seat does not have a framebuffer device, runs X as a proxy, adding -sharevts only if the seat has a framebuffer device, makes a special config for X (like it did before) diff -Naur systemd-44.old/src/login/71-seat.rules.in systemd-44.new/src/login/71-seat.rules.in --- systemd-44.old/src/login/71-seat.rules.in 2012-11-23 23:35:24.000000000 +0400 +++ systemd-44.new/src/login/71-seat.rules.in 2012-11-23 23:51:48.076271381 +0400 @@ -11,6 +11,7 @@ SUBSYSTEM=="sound", KERNEL=="card*", TAG+="seat" SUBSYSTEM=="input", KERNEL=="input*", TAG+="seat" SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", TAG+="seat" +SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", TAG+="seat-master" SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat" # 'Plugable' USB hub, sound, network, graphics adapter diff -Naur systemd-44.old/src/login/logind.c systemd-44.new/src/login/logind.c --- systemd-44.old/src/login/logind.c 2012-11-23 23:35:27.000000000 +0400 +++ systemd-44.new/src/login/logind.c 2012-11-24 19:30:28.000000000 +0400 @@ -372,11 +372,7 @@ goto finish; } - r = udev_enumerate_add_match_subsystem(e, "graphics"); - if (r < 0) - goto finish; - - r = udev_enumerate_add_match_tag(e, "seat"); + r = udev_enumerate_add_match_tag(e, "seat-master"); if (r < 0) goto finish; @@ -1124,11 +1120,7 @@ if (!m->udev_seat_monitor) return -ENOMEM; - r = udev_monitor_filter_add_match_tag(m->udev_seat_monitor, "seat"); - if (r < 0) - return r; - - r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_seat_monitor, "graphics", NULL); + r = udev_monitor_filter_add_match_tag(m->udev_seat_monitor, "seat-master"); if (r < 0) return r; diff -Naur systemd-44.old/src/login/multi-seat-x.c systemd-44.new/src/login/multi-seat-x.c --- systemd-44.old/src/login/multi-seat-x.c 2012-11-23 23:35:25.000000000 +0400 +++ systemd-44.new/src/login/multi-seat-x.c 2012-11-24 15:51:23.462868648 +0400 @@ -35,6 +35,7 @@ int i; const char *seat = NULL; char **new_argv; + int new_argc; char *path = NULL, *device_node = NULL; int r; FILE *f = NULL; @@ -108,10 +109,7 @@ break; } - if (!device_node) { - log_error("Failed to find device node for seat %s.", seat); - goto fail; - } + if (device_node) { r = mkdir_safe_label("/run/systemd/multi-session-x", 0755, 0, 0); if (r < 0) { @@ -157,15 +155,19 @@ fclose(f); f = NULL; + } new_argv = alloca(sizeof(char*) * (argc + 3 + 1)); memcpy(new_argv, argv, sizeof(char*) * (argc + 2 + 1)); + new_argc = argc; new_argv[0] = (char*) X_SERVER; - new_argv[argc+0] = (char*) "-config"; - new_argv[argc+1] = path; - new_argv[argc+2] = (char*) "-sharevts"; - new_argv[argc+3] = NULL; + if (device_node) { + new_argv[new_argc ++] = (char*) "-config"; + new_argv[new_argc ++] = path; + } + new_argv[new_argc ++] = (char*) "-sharevts"; + new_argv[new_argc] = NULL; udev_enumerate_unref(enumerator); enumerator = NULL; @@ -173,8 +175,10 @@ udev_unref(udev); udev = NULL; - free(device_node); - device_node = NULL; + if (device_node) { + free(device_node); + device_node = NULL; + } execv(X_SERVER, new_argv); log_error("Failed to execute real X server: %m");
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel