This is an overview of how touchscreen devices are handled under linux.
If you discover anything mentioned on this page outdated, please tell me at tias@@@ulyssis.org (one @).
OverviewBasically, there is a kernel module and an Xorg driver involved: the kernel module talks to the hardware and exports it as an input device, the Xorg driver reads the input device and turns it into a pointer.
Depending on your type of device, you need a different kernel module:
- USB device
- HID-compliant HID-compliant means it follows the standard USB-HID specification (see WIkipedia on HID for more info). The linux kernel automatically detects these devices and uses the hiddev module to export it as a generic input device.
You can check if your USB touchscreen is HID-compliant by checking the website of the manufacturer, or just plugging it in.
- non HID-compliant The usbtouchscreen module has support for several touchscreens. It decodes the protocol of the touchscreen and exports it as a generic input device.
To check if your USB touchscreen is supported just plug it in (will be automatically detected), or dive into the Kconfig file (TOUCHSCREEN_USB_* entries).
- Serial device
Serial devices need a separate kernel module that translates the touchscreen protocol into a generic input device. If the device is supported in the kernel, the inputattach program must be used to set up the serial connection (available in all major distributions, some more details here).
To check if your serial touchscreen device is supported, dive into the Kconfig file. Finding an up-to-date inputattach can be harder, check this file and bugreports of distributions like ubuntu.
There are 3 modern Xorg drivers that can handle the generic kernel input devices:
- evdev The official Xorg driver for input devices (Recommended)
- evtouch Unmaintained as-good-as-dead driver, its only advantage is that it has right-click emulation support (touch and holdng the touchscreen for some seconds results in a right-click). Your distribution might not even ship it, the debian X strike force keeps it alive and compatible with the latest X server.
- tslib Originally created for embedded devices, it is an Xorg driver especially for touchscreens. It is feature rich and extensible, however it is poorly documented and needs a framebuffer video device (Only for experts).
Extra: the old times and calibration in the new timesIn the old times, there was no generic input subsystem in Linux and almost all devices were serial devices. Every device had its own protocol, and some way to implemented it in the X server. This, of course, resulted in many different calibrator programs, of which you can find a list on this other page.
In current times, with the generic input subsystem, things have become much easier. The xinput_calibrator is a generic calibrator program that can calibrate any Xorg driver (except tslib). It uses the Xinput XI protocol to do this.