Multiseat Configuration/faketty

This article teaches how a Multiterminal with Faketty works, and how to do it. It uses the faketty module, developed by Aivils Stoss, and it doesn't use the evdev protocol or kernel patches. It is one of the most famous ways to make multiterminals.

Introduction
This text describes the necessary steps to configure a multiterminal system using the faketty module. The faketty is a kernel module, developed by Aivils Stoss, that associates system keyboards to device files named as /dev/fttyXX (where XX is a number that identifies the keyboard), which the X uses to read keyboard events. This module uses the same protocol that X usually uses to read events from the keyboard, that is, the TTY protocol, that dismisses the use of evdev. Another advantage of this method is that isn't necessary some patch to the kernel.

The disadvantages are that this solution needs that one kernel module had been compiled, and that this approach only works fine(stable) with few number of video cards combinations.

Operating System
Debian Sarge (you can use other GNU/Linux distribution too, with only minor changes)

Hardware used
Video Cards


 * 4 SiS 315 video cards (can be other cards too, but not all the cards are supported).

Keyboards and Mouses


 * 1 keyboard PS/2
 * 1 mouse PS/2
 * 3 keyboards USB
 * 3 mouses USB

Udev installation
It's necessary to install udev, that provides a dynamic and updated directory /dev in accordance with the connected devices:

apt-get install udev

The udev demands a kernel 2.6.12 or newer.

Compiling and loading the faketty module
Certify yourself that the headers of the kernel(in use) are installed. Case you use Debian, do the following command:

apt-get install linux-headers-$(uname -r)

The next step is compile the faketty module for your kernel. You can find the module source code here: http://www.ltn.lv/~aivils/files/faketty-0.05.tar.bz2

(Note: A new version of faketty is available at http://www.ltn.lv/~aivils/files/faketty-0.06.tar.bz2, try it if you run into any problems with the old one) Recent is this one http://www.ltn.lv/~aivils/files/faketty-2.6.30.tar.bz2. Fit under kernel > 2.6.23

Unpacks the file and execute the following command in the directory where the "Makefile" file is, to compile and install the module:

make && make install

To load the kernel module, execute the following command:

modprobe faketty

Making links to /dev/fttyXX files
It's necessary to verify the /proc/bus/input/devices file to know what ffty file each keyboard was associated. An example of /proc/bus/input/devices file is shown below:

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41 N: Name="AT Translated Set 2 keyboard" P: Phys=isa0060/serio0/input0 H: Handlers=kbd event0 ftty1 B: EV=120013 B: KEY=4 2000000 3802078 f840d001 f2ffffdf ffefffff ffffffff fffffffe B: MSC=10 B: LED=7

I: Bus=0011 Vendor=0002 Product=0005 Version=0000 N: Name="ImPS/2 Generic Wheel Mouse" P: Phys=isa0060/serio1/input0 H: Handlers=mouse0 event1 B: EV=7 B: KEY=70000 0 0 0 0 0 0 0 0 B: REL=103

I: Bus=0003 Vendor=0a81 Product=0101 Version=0110 N: Name="CHESEN USB Keyboard" P: Phys=usb-0000:00:10.2-1/input0 H: Handlers=kbd event2 ftty2 B: EV=120003 B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe B: LED=7

I: Bus=0003 Vendor=0a81 Product=0101 Version=0110 N: Name="CHESEN USB Keyboard" P: Phys=usb-0000:00:10.2-1/input1 H: Handlers=kbd event3 ftty3 B: EV=3 B: KEY=1f 0 20000 3878 d801d101 1e0000 0 0 0

I: Bus=0003 Vendor=04fc Product=0013 Version=06b0 N: Name="USB OpticalWheel Mouse" P: Phys=usb-0000:00:10.2-2/input0 H: Handlers=mouse1 event4 B: EV=7 B: KEY=70000 0 0 0 0 0 0 0 0 B: REL=103

It's possible to note that there are three keyboards being shown, where the first is associated to the /dev/ftty1 file and the second to the /dev/ftty2 file. The keyboards for which attribute "P: Phys" ends with input1, on the contrary of input0, like the third keyboard of this file, should be reconsidered, because it refers to special keys and special functions of some keyboards.

Also is possible see, in the example file, the presence of two mouses, that are associated to the /dev/input/mouse0 and /dev/input/mouse1, respectively.

The X, when initialized, opens the /dev/ttyXX file to read keyboards events, where XX is the VT(Virtual Terminal) number that the X receives as parameter. Being not possible to solicit to X to open another file, it's necessary to make the /dev/ttyXX files to be links to the ftty files indicated in the /proc/bus/input/devices file. In the following example we have made 4 links, one to each keyboard, beginning by the /dev/tty50 file.

rm -f /dev/tty5[0-3] ln -s /dev/ftty1 /dev/tty50 ln -s /dev/ftty2 /dev/tty51 ln -s /dev/ftty3 /dev/tty52 ln -s /dev/ftty4 /dev/tty53

Driver installation to SiS video card
1. Add the following line to /etc/apt/sources.list file:

deb http://www.winischhofer.net/sis/debian/stable ./

2. Update the information for the system packages and install the x-driver-sis driver:

apt-get update apt-get install x-driver-sis

Hotplug
Install the hotplug package:

apt-get update apt-get install hotplug

XOrg server installation
The next step is install the XOrg server.

1. Do a backup and remove the /etc/init.d/xfree-common file. 2. Add the following lines to /etc/apt/sources.list file:

deb http://people.debian.org/~nobse/xorg-x11/ sarge main deb-src http://people.debian.org/~nobse/xorg-x11/ sarge main

3. Install the xserver-xorg package:

apt-get update apt-get install xserver-xorg apt-get upgrade

xorg.conf
This configuration will be used during the multiterminal running. In this file will be created additional sections in accordance with the number of terminals we're configuring. For each terminal, we'll create section for mouse, keyboard, video card, monitor, screen and layout. For example, in the case of a multiterminal with four terminals, the file will have four sections for mouse, four sections for keyboard, and thus for ahead.

The values suggested for “Identifier” at each section aren't mandatory. They can be modified, since that kept the coherence of names in all configuration.

The physical address(option “Dev Phys”) of each device can be obtained from /proc/bus/input/devices file, as seen previously.

Following, an example for each kind of section.

xorg.conf.probe
Beyond the xorg.conf default file, will be necessary to create one second configuration file, the xorg.conf.probe. During the use of multiterminal, we disable the interruptions at the 10 canal (IRQ 10) to prevent that VGA calls (and VESA VBE) of one card intervene others. However, with this calls disabled the secondary cards aren't initialized. To resolve this problem, during the system initialization process, the XOrg will be run with the xorg.conf.probe file. It will make one check (probe) for the presence of this cards, with the IRQ 10 active during the test, initializing it.

To create the xorg.conf.probe, take the xorg.conf as base, remove the sections relative to the primary video card (that is initialized for the BIOS when turning on the computer) and change the NoInt10 option to "No". Will be necessary only one layout, but including all secondary cards. As example, see above some stretchs of xorg.conf.probe file, devired from the xorg.conf:

To run the test (probe) is supplied the xorg-multiterminal file. It executes the X server int probeonly mode (only test the devices and finish), with xorg.conf.probe file. How explained above, this step initializes the secondary video cards. The content of file is:

file=/etc/X11/xorg.conf.probe

-f "file" && /usr/X11R6/bin/X -config "$file" -probeonly 2>/dev/null

Save it as one executable script and configure the initialization system to run it. In the case of Debian, the patch should be /etc/init.d/xorg-multiterminal, and exist two forms to configurate the system:


 * Through of update-rc.d command. This command functions in such a way to users of the system standard debian (sysv-rc) as to file-rc package users.

update-rc.d xorg-multiterminal start 70 S.

At a Debian system using a standard schema of initialization, creat a link:
 * Manually:

ln -s /etc/init.d/xorg-multiterminal /etc/rcS.d/S70xorg-multiterminal

At a Debian system with the file-rc package installed, add the following line in some place appropriate in the /etc/init.d/runlevel.conf file:

70       -        S        /etc/init.d/xorg-multiterminal

GDM
The last step is configure the login manager to initialize all X servers. We'll treat only the GDM. Another managers like the XDM and the KDM can be configurated by a similar process.

Is necessary to edit the “[servers]” section of /etc/gdm/gdm.conf file so that it contains multiplies input, like at following example to four terminals:

The server names are arbitrary, but is need to add one section for each server, with the contents below:

Observe that the four servers are using the 50, 51, 52 e 53 VT's, respectively. Thus, the X servers will use, to read keyboard events, the /dev/tty50, /dev/tty51, /dev/tty52 e /dev/tty53 files, that actually are links to /dev/fttyXX files, as we've had created previously.

Solving Problems
Problems in multiterminal initialization can be analyzed at /var/log/Xorg.*.log files. The X server of each terminal will create its proper log file.