środa, 9 lutego 2011

Multiseat setup - the final feast

In this post I would like to tell you about the actual implementation of the multiseat setup which I use.

Here is the tree of the installed files (filenames are links):

 |  |
 |  +-multiseat
 |  |
 |  +-gdm.conf
 |  |
 |  +-xorg.conf
 |  |
 |  +-multiseat
 |  |
 |  +-/rules.d
 |     |
 |     +-00-multiseat.rules

/etc/default/multiseat as of now contains only a path to the multiseat.conf. /etc/gdm/gdm.conf and /etc/X11/xorg.conf have already been explained. /etc/init.d/multiseat contains only one line, and as I experienced it is necessary to trigger the events once more even though they are triggered by the standard startup scripts. In Debian it is possible to issue this command as root:

update-rc.d multiseat start 70 2 .

to install appropriate link to this script. Please bear in mind that this might be old-fashioned as dependency-based init scripts are used quite often nowadays.

/etc/udev/rules.d/00-multiseat.rules has already been explained; its name starts with 00 so that it is the first rules file processed in the rules.d directory.

/etc/multiseat/multiseat.conf deserves a few words of comment. This file needs to follow a few rules. First, it is composed of sections numbered 0..n. Comments are allowed and start with a # in the beginning of the line

The section [0] describes global settings. Right now it only specifies which section describes the primary display, which is not displaced. It is just that: if all Xephyrs are started in the top left corner of the big Xinerama screen, then one of them can stay where it is, and this is considered the primary display.

The remaining sections describe one seat each. In each section the following keys are used:

KEYBOARD-MATCH: a list of newline-separated patterns against which the output of udevadm info --name /dev/input/eventXX will be matched by match-and-name to match and name the keyboard associated with this seat

MOUSE-MATCH: similar to KEYBOARD-MATCH, but refers to the mouse associated with this seat

SIZE: <width>x<height> in pixels of this seat's Xephyr (=> of this seat monitor if you will)

KEYBOARD: used both by match-and-name to name the keyboard associated with this seat, and by Xephyr-seat to tell this seat's Xephyr which keyboard to use

MOUSE: similar to KEYBOARD, but refers to the mouse to use at this seat

LAYOUT: xkb layout of the keyboard at this seat

DISPLACEMENT: dx,dy where to move this Xephyr's seat to (=> position of this Xephyr in the big Xinerama screen)

DPI: the visual resolution of this seat's Xephyr (influences the size of the base font and so on); typically 96

The multiseat.conf file is parsed only by standard tools: bash, awk and sed. I could have used some more fashionable tool like python, but I wanted as little dependencies as possible. However, the limited possibilities of the chosen tools make it a bit awkward to use a sectioned config file, not to mention reading-in the tables. The helper-functions are devoted to ease this task. They use very simple shell scripting and some moderately difficult awk and sed.

The multiseat-greeter script for each seat performs moving the corresponding Xephyr by an offset specified in its DISPLACEMENT. The correct Xephyr is selected by grepping the text "Xephyr on :<number>" where <number> is 1..n (n = number of seats). The comments on xwininfo and wmctrl can be found here.

The Xephyr-seat script detects which seat it is called for by inspecting its command line parameters. Even though in gdm.conf there are no explicit parameters, they are added by gdm and include the display number. Once the seat is known the script can get all the necessary parameters from the configuration file and finally run Xephyr.

I have used this setup for about a month now and it seems quite promising. The system is stable. Logging in and out does not disturb the work of the other user. I noticed that keyboard leds do not function properly (in fact they do not function at all on both keyboards). There is a satisfying workaround: install lock-keys-applet or something similar.

One more remark. The Xinerama screen with a 1920x1080 and 1280x1024 monitor (positioned logically one above the other) takes quite a lot of memory. I had to add vmalloc=162M option to the kernel command line so that the nVidia can handle it. I did not experiment much with the parameter value, though. My system has 4GB of RAM and I am running a 32-bit Debian squeeze on a Core2Duo E7300@2.66GHz. The video card is GeForce 8400GS. Some two years ago this was not such a bad setup. Now it is, if at all, ordinary. Especially the graphics. Anyway, it is good enough for 2 people to use the same computer; in fact I've been running a two seat setup for more than 7 years now, and used to do it also on a weaker machine, a 1GHz Athlon with nVidia MX 200 and an S3 ViRGE.

By the way. Actually the reason to look for a multiseat setup was a contention for the computer. This way I made my wife use Linux. And she doesn't mind;)

Brak komentarzy:

Prześlij komentarz