3.5. Keyboard numbering(order of detection)

In the following chapters you will read about 1st keyboard, 2nd keyboard and so on, so here I will explain what is meant by n-th keyboard.

When a keyboard device is found, it is bound to a free VT (given that there are free VT's). The first keyboard found will be bound to VT0 (tty1-tty16), the second to VT1 (tty17), the third to VT2 (tty18).


Older versions of the bruby patch (released before Oct 7 2003) use :

first keyboard found => VT0 (tty0-tty7)

second => VT1 (tty8-tty15)

third => VT2 (tty16-tty23)

The order of detecting the keyboards depends on the configuration of your kernel :

But there are some caveats:

Most USB keyboards represent themselves as more than one keyboard; it is common that the multimedia keys or the number-pad identify themselves as a different keyboard device. So if you are running a kernel with integrated USB input and have one USB keyboard with multimedia keys and one PS2 keyboard, the USB keyboard will be bound to VT0(real keyboard) and VT1(multimedia keys), the PS2 keyboard will be bound to VT2 (in case you have enough DUMB consoles).

There are several ways to work around these issues. Here I'll explain the easiest way to follow. It's definitely not the best one, but the shortest explanation, and I just want to make it clear to you that the problem is not that big. The better solutions will follow later in their own section.

All you need to do is to start the Backstreet Ruby/ Ruby kernel with dumbcon=n , where n is the sum of your AT/PS2 keyboards plus the sum of your USB keyboards multiplied by 2 (I suppose this is the maximum number of interfaces a USB keyboard registers), so all keyboards will be bound to a VT. Now you should find out which VT's the real keyboards are bound to (the keyboards excluding the multimedia keys) and start X using the appropriate tty ranges. Thanks to the proc interface integrated in Backstreet Ruby, you can easily find the assignment of keyboards to VT's. Each VT creates a file /proc/bus/console/[n]/keyboard (n is the number of the VT, for VT0 n will be 00, for VT1 - 01, ... , for VT11 - 11); reading this file will give you the assigned keyboard.

[root@svetljo root]# cat /proc/bus/console/*/*
tells us that:

Now we can start X on the VT's with real keyboards, in this case VT0 and VT2.

Of course in this simple example with only 2 keyboards (one USB and one PS2) the problem could be easily avoided by using a kernel with primary PS2 input support. The PS2 keyboard would be found first and bound to VT0, the USB keyboard would follow and it's real keyboard interface would be bound to VT1, so there is no need for additional dumb consoles (for the multimedia interfaces of USB keyboards).