Multiseat Configuration/faketty

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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[edit | edit source]

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[edit | edit source]

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

Hardware used[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Install the hotplug package:

apt-get update
apt-get install hotplug

XOrg server installation[edit | edit source]

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 server Configuration[edit | edit source]

xorg.conf[edit | edit source]

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.

Section "InputDevice"
        Identifier      "Generic Keyboard 0"
        Driver          "keyboard"

        # The options below are adjusted to a brazilian keyboard
        # with cedilha (ABNT2).
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "abnt2"
        Option          "XkbLayout"     "br"
        Option          "XkbVariant"    "abnt2"
        Option          "XkbOptions"    "abnt2"
        Option          "CoreKeyboard"
EndSection


Section "InputDevice"
        Identifier      "Configured Mouse 0"
        Driver          "mouse"

        # Substitute the value of "Device" option by the correspondent
        # mouse file, obtained from /proc/bus/input/devices file        
        Option          "Protocol"      "ImPS/2"
        Option          "Device"      "/dev/input/mouse0"

        # All mouses should have the "CorePointer" option
        Option          "CorePointer"
        Option          "ZAxisMapping"          "4 5"
EndSection


Section "Device"
        Identifier      "Placa de Vídeo Genérica 0"
        Driver          "sis"
        Screen          0

        # It's mandatory to explicit the BusID of all cards. 
        # To obtain it, use "lspci | grep VGA". Be carefull with the values,
        # while the address supplied by lspci is in hexadecimal base
        # the XOrg wait a decimal value.  To convert this, use
        # "echo $((0xHEXADECIMAL_VALUE))".
        BusID           "PCI:1:0:0"

        # This option disables the VGA and VBE calls of IRQ 10, to 
        # prevent that some card intervenes with others.  See also the
        # "xorg.conf.probe" file.
        Option          "NoInt10"       "Yes"

        # This option to sis video cards, prevents problems during alternating between
        # virtual terminals or while exiting X server.
        Option          "RestoreBySetMode"      "no"

EndSection


# The values below are default.  Maintain the configuration that you normally would use
# to your monitors.
Section "Monitor"
        Identifier      "Monitor Genérico 0"
        HorizSync       30-60
        VertRefresh     50-75
        Option          "DPMS"
EndSection


# The screen configuration below also is illustrative, personalize it
# in accordance with your preferences.
Section "Screen"
        Identifier      "Default Screen 0"
        Device          "Placa de Vídeo Genérica 0"
        Monitor         "Monitor Genérico 0"
        DefaultDepth    24
        SubSection "Display"
        Depth           24
                Modes           "1024x768" "800x600" "640x480"
        EndSubSection
EndSection


Section "ServerLayout"
        # The Identifier will be used at the call in command line.
        Identifier      "Layout0"
        Screen          "Default Screen 0"
        InputDevice     "Generic Keyboard 0"
        InputDevice     "Configured Mouse 0"

        Option          "SingleCard"
EndSection

xorg.conf.probe[edit | edit source]

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:

# At all Device sections (of video cards), change the option
# NoInt10 to:
        Option          "NoInt10"               "no"

# Declare only one layout, and without to use the "SingleCard" option.
# All the secondary screens should be included. The
# screens disposal (LeftOf, etc.) isn't important, so little
# the input devices used.
Section "ServerLayout"
        Identifier      "probe"
        Screen          "Default Screen 1"
        Screen          "Default Screen 2"   LeftOf  "Default Screen 1"
        Screen          "Default Screen 3"   LeftOf  "Default Screen 2"
        InputDevice     "Generic Keyboard 1"
        InputDevice     "Configured Mouse 1"
EndSection

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 .
  • Manually:

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

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[edit | edit source]

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:

[servers]
0=XServer0
1=XServer1
2=XServer2
3=XServer3

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

[server-XServer0]
name=Standard server
command=/usr/X11R6/bin/X -br -audit 0 -layout Layout0 :0 vt50
flexible=true

[server-XServer1]
name=Standard server
mmand=/usr/X11R6/bin/X -br -audit 0 -layout Layout1 :1 vt51
flexible=true

[server-XServer2]
name=Standard server
mmand=/usr/X11R6/bin/X -br -audit 0 -layout Layout2 :2 vt52
flexible=true

[server-XServer3]
name=Standard server
mmand=/usr/X11R6/bin/X -br -audit 0 -layout Layout3 :3 vt53
flexible=true

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[edit | edit source]

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[edit | edit source]