# 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 video cards combinations.

## Operating System

Debian Sarge (you can use other GNU/Linux distributions 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:
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:
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:
To load the kernel module, execute the following command:

## 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:
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.

## Driver installation to SiS video card

1. Add the following line to /etc/apt/sources.list file:
2. Update the information for the system packages and install the x-driver-sis driver:

## Hotplug

Install the hotplug package:

## 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:
3. Install the xserver-xorg package:

## XOrg server Configuration
### 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:
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.
* Manually:
At a Debian system using a standard schema of initialization, creat a link:
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:

## 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.

## External links

* How I made my linux Multiseat X setup using faketty