- Research Overview
- MPhil Information
- Wireless Comms
- Bat System
- Broadband Phone
- Sentient Vehicles
- Task Assignment
- Computing for the Future of the Planet
- Active Floor
- Open-Source CSK Energy
DTG Local Pages
- Cambridge Weather
- Contact Details
Getting Touchscreens Working in Linux
Author: Jonathan Davies
Here are some brief notes describing how to get a Lilliput 809GL-80NP-T touchscreen display working under Linux. They also may be appropriate for other makes of touchscreen.
- Ensure that the touchkitusb and evdev modules are loaded or are compiled into the kernel.
Event interface X driver
- The evdev X driver (which is distinct from the evdev Kernel module) will be required to operate touchscreens because an event-based absolute positioning model is the most well-suited. (Using a standard mouse driver will work to some extent, but the cursor movement may move at a different speed to the movement across the screen.)
- The evdev driver can be downloaded from http://opensource.idealcorp.com/evdev/. At the time of writing, the current version is evdev_1.0-1.
- The driver's ReadInput method needs to be modified to cope with the particular events that the Lilliput outputs. In particular, this is the code of the touch event and the order in which the events are sent. A patch is provided to assist with this modification. Apply it using patch -p0 < xf86Evdev-lilliput.patch.
- After the driver has been modified, run
./mkheader.pl make make install
- Then start X and test it out! (Refer to the section below to configure X if it's not already configured to use this touchscreen.)
- If there are still problems, or if you're using a different make of touchscreen, then use the evtest utility to determine the characteristics of your screen.
- Note that the installation instructions for the evdev driver suggest that you put the findevdev script into /etc/init.d, but this is not necessary.
- Add a new InputDevice? section to the /etc/X11/XF86Config or xorg.conf file. It will look something like this:
Section "InputDevice" Identifier "TouchScreen0" Driver "evdev" Option "SendCoreEvents" "true" Option "Device" "/dev/input/event2" Option "MinX" "1965" Option "MaxX" "60" Option "MinY" "1870" Option "MaxY" "120" EndSection
The option /dev/input/event2 should be changed to refer to the event interface for your touchscreen provided by the kernel evdev module. To determine the appropriate value, look in /proc/bus/input/devices and look for the Handlers line for your touchscreen device. To verify that you've got the right device, you can try executing cat /etc/input/eventX, for your value of X, and you should see characters appear when you touch the screen.
- If you have multiple screens, a further option should be added to the InputDevice section. This will allow you to couple a particular screen with a particular touch device. The following line should be added to indicate the the device is related to the first named screen in the ServerLayout section. The number 0 should be replaced by 1 if the device refers to the second named screen, and so on.
Option "ScreenNumber" "0"
However, this option should be used with caution: X will crash if you use a ScreenNumber higher than the index of the highest available screen.
- Add a new line to the ServerLayout? section of the configuration file:
Section "ServerLayout" ... InputDevice "TouchScreen0" "SendCoreEvents" ... EndSection
where TouchScreen0 refers back to the Identifier in the InputDevice? section. SendCoreEvents should be changed to CorePointer if your touchscreen will be the only pointing device for this layout.
- Finally, by trial and error, tweak the MinX, MaxX, MinY, MaxY options in the InputDevice? section, restarting X each time a change is made, until the cursor lies directly underneath the point of touch at all points on the screen. Note that the value of MinX may be larger than the value of MaxX depending on the touchscreen.