Linux Input Drivers




InputMain - LinuxConsole









Quick Start

This section describes how to download, compile and use the Input Drivers. Change to your source directory, fasten your seatbelts, and here we go:

cd /usr/src

Download

You can get the development tree and necessary utilities via CVS. To access the CVS you can use the following commands (use an empty password):

cvs -d :pserver:anonymous@cvs1.sourceforge.net:/cvsroot/linuxconsole login
cvs -z3 -d :pserver:anonymous@cvs1.sourceforge.net:/cvsroot/linuxconsole checkout ruby

Once you have downloaded the CVS, you can always update it to the most recent version using the following command:

cvs -z3 update ruby

Patching

To compile and use the files you download, you first have to get a 2.4 kernel to use the drivers with. You can get it from ftp.kernel.org.

wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.13.tar.bz2
mv linux linux-old
tar xIvf linux-2.4.13.tar.bz2

When you've got the kernel unpacked, you have to copy the ruby files over it, and clean files not used anymore:

cd ruby/linux
cp -avP * ../../linux/
cd ../../linux
sh ../ruby/utils/remove-unused-files

Configuration

Then you configure the kernel:

make menuconfig

You will see because the subsystems that compose the different types of TTYs can exist independently that even the main menu has changed. You will noticed in the top level menu we now have:

Parallel port support --->
Serial drivers --->
Block devices --->

and we have:

USB support --->
Input device support --->
Character devices --->

This order is important since the devices in the next menu depend on the devices before them. Also we have renamed the Console driver menu to:

Video --->

The Serial Driver menu selects the new experimental serial drivers based on Russel King's code from the ARM tree. We have taken this code to make it less and less TTY dependent. This menu comes before the input and char menus since alot of things are effected by this. If you select the new serial drivers you can't select the old drivers. This prevents clashs. If you decided to try out the new serial drivers you will see:

   Serial port support

If you enable it for the ix86 platform you will see:

   Serial port support
   8250/16550 and compatible serial support (EXPERIMENTAL) (NEW)

Now if you enable 8250/16550 support you will see support for a serial console on the 8250/16550. You will also see support for extended options for more advance 16550 types devices. Enabling extended options you will end up seeing:

   Serial port support
   8250/16550 and compatible serial support (EXPERIMENTAL) (NEW)
   Console on 8250/16550 and compatible serial port (EXPERIMENTAL)
   Extended 8250/16550 serial driver options
   Support more than 4 serial ports
   Support for sharing serial interrupt
   Autodetect IRQ on standard ports (unsafe)
   Support special multiport boards
   Support Bell Technologies HUB6 card

Now you have finished the serial configuration if you decided to give it a try we go onto configuring your Input Drivers. This part is a little tricky. You have to select quite a bunch of options to have your system operate correctly. For a most usual setup with a PS/2 mouse and a AT keyboard you need to select:

Input device support --->
  Input device support
  i8042 aux+kbd controller
  AT and PS/2 keyboards
  PS/2 mouse
  Mouse interface
  Event interface

The reason for this is because the i8042 chipset that controls PS/2 devices is used on many platforms. A result of this is often the way to program the chip varies. So the input api was designed to be modular for this. This allows us to use the same PS/2 keybaord driver on different platforms. It is the underlying driver for the chipset that could vary. For example I can use the same PS/2 keyboard for my intel box as well as for the iPAQ I have. I have a special adaptor that allows me to plug in my PS/2 keyboard into a iPAQ.

For a setup with an USB mouse and keyboard you'd use:

USB support --->
  Support for USB
  Preliminary USB device filesystem
  UHCI (Intel PIIX4, VIA, ...) support
  OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
Input device support --->
  Input device support
  USB Human Interface Device
  Mouse interface
  Event interface

The USB selection above will be in the USB menu.

Please note the Event interface can be used with any type of input device. This is how we can access keyboards with a tty as well as talk to touchscreens, joysticks, mice, and other various devices in a standard way. The mouse interface is for backwards compatibility. Please use the Event interface for userland apps. For serial mice you need:

Input device support --->
  Serial port input line discipline
  Serial mouse
  Mouse interface
  Event interface

And in your init scripts a call to the inputattach utility (can be found in the utils subdir in the ruby tree). See the help for this utility about what the command line will be for your mouse - there are quite a couple different types of them. Over time the inputattach utility has grow to be used with a varity of different types of serial devices besides mice. We hope with the serial layer being written that in the future you will not need this.

  inputattach -t mman /dev/ttyS0 &

To get an analog joystick working, you add:

Input device support --->
  ns558 gameports
  Analog joysticks and gamepads
  Joystick interface

For other joystick types and gameport types you can select other joystick and gameport drivers if you have them. The same for mice, keyboards and other drivers. Please note the Event interface can be used with any type of input device. This is how we can access keyboards with a tty as well as talk to touchscreens, joysticks, mice, and other various devices in a standard way. The mouse interface is for backwards compatibility. Please use the Event interface for userland apps.

Now that you have all your input devices configured now to the graphics devices and the VT layer. Remember you don't need the Console system to access your keyboard, but you do need Input support for the VT Console system. The same is also true for the framebuffer drivers. Go from the top menu into:

Character devices --->

Now you will see something like:

  Virtual terminal
    Support for console on virtual terminal

You need to enable these if you want standard VT support. Now for say a embedded device which lacks a keyboard you don't need to select this. You can just use the input layer to access your device instead and the framebuffer to access the display if it has one. If you don't see:

  Standard/generic (8250/16550 and compatible UARTs) serial support

This just means you will use the new serial drivers instead. Select the other devices you need in the character menu and then we can go onto the Video menu. When you enter the video menu you will see either:

 Support for frame buffer devices (EXPERIMENTAL)
 Frame-buffer support --->

You would see the above if you didn't select VT support. This would be what you would want for a embedded device lacking a keyboard. Or if we selected VT support we see:

 Support for frame buffer devices (EXPERIMENTAL)
 Frame-buffer support --->
 --- Console drivers
 VGA text console
 Video mode selection support
 MDA text console (EXPERIMENTAL)
 NVIDIA hardware text console
 Support for frame buffer console
   Select compiled-in fonts

Even with VT support we still can select framebuffer support without framebuffer console support. When you're done with configuring the kernel, you compile and install it (make sure your /etc/lilo.conf has an entry for this new kernel):

make dep modules modules_install bzImage
cp arch/i386/boot/bzImage /boot/vmlinuz
lilo

Then, to keep a working system after you boot with the new kernel, you also need to change a couple nodes in /dev:

cd /dev
mkdir old
mv mouse js? old
mkdir input
cd input
mknod js0 c 13 0
mknod js1 c 13 1
mknod js2 c 13 2
mknod js3 c 13 3
mknod mouse0 c 13 32
mknod mouse1 c 13 33
mknod mouse2 c 13 34
mknod mouse3 c 13 35
mknod mice c 13 63
mknod event0 c 13 64
mknod event1 c 13 65
mknod event2 c 13 66
mknod event3 c 13 67
cd ..
ln -s input/js0 js0
ln -s input/js1 js1
ln -s input/mice mouse

After this, reboot, load any modules you didn't compile straight into the kernel, and everything should work. If it doesn't, well, something went wrong.

Send any questions, comments, bug reports to: Vojtech Pavlik <vojtech@suse.cz>

Sponsored by SuSE