Linux Touch Screen HOWTO
This document describes how to set up a touch screen input device under XFree86. As the author had only the opportunity to work with devices from !EloTouch?(R) and !MicroTouch?(R) this HOWTO is rather specific for these devices.
The GNU Free Documentation License applies to this document.
This HOWTO concentrates on devices connected via the serial port i.e. /dev/ttyS0 or /dev/ttyS1. Some Usb support
For USB
If you have a USB touch screen you will need to insert the module
with modprobe or insmod and create the device with mknod (if not
using devfs) before the device is available.
Ex. For egalax drivers
modprobe tkusb (this creates /dev/usb/tkpanel0 and /dev/usb/tkpanel1)
Other usb drivers for microtouch and elo are similar.
Note: this is NOT the device name to put in XF86Config, that would
be /dev/tkpanel0 or something simliar. You can check to see if it exists
and if it is correct if it has permissions crw--w--w-, the world writeable
device is for XF86Config, the world readable device is for the usb panel daemon
(in this case, tpaneld) to use in it's conf file.
You will probably also need to be running a usb pnp daemon such as usbpnpd.
Touch screen devices are configured in the Xinput section in the XF86Config file (mostly /etc/X11/XF86Config or /etc/XF86Config). At first verify that the device driver modules exist. They are located in /usr/X11R6/lib/modules/ (the modules for the above mentioned devices are xf86Elo.so and xf86MuTouch.so). Now have a look into XF86Config. There should be a section looking like this:
Section "Files" ...
...
To get the module loaded by the X server there has to be a section like this:
Section "Module" Load "xf86Elo.so"
Now the more tricky part. X needs to know some parameters about the device. The section for this looks like this (see "man XF86Config" for more details):
Section "Xinput"
Port "/dev/ttyS1" # for a device at serial port 2
MinimumXPosition 300 MaximumXPosition 3700 MinimumYPosition 300 MaximumYPosition 3700
The values for the entries MinimumXPosition etc. are of course specific for the setup of the hardware (i.e. depend on the position of the touch screen relative to the monitor). The values determine where the points (0,0) and (xmax,ymax) on your monitor (xmax and ymax depend on the resolution chosen for the Xserver, such as 1024x768) are mapped on the touch screen. The device driver reads these values and interpolishes the other coordinates. For illustration:
--------------touch screen area----------------- I I I ########visible monitor area############## I I #x # I I # (0,0) # I I # (MinimumXPosition,MinimumYPosition) # I I # # I I # # I I # # I I # # I I # # I I # # I I # # I I # (MaximumXPosition,MaximumYPosition)# I I # (xmax,ymax)# I I # x# I I ########################################## I I I
This mapping can be done by trial and error or by reading the raw output of the device (needs some serial port programming, see "The Linux Serial Programming HOWTO"). For the types !EloTouch? and !MicroTouch? exists a rudimentary calibration tool (written by the author of this document, it can be found at ftp://metalab.unc.edu/pub/linux/X11/xutils/touchcal-0.1.tar.gz).
After starting X, type in an Xterminal the command
xsetpointer <devicename>
where<devicename> is the name defined in XF86Config with the line
To get the device working on startup use the !AlwaysCore? option in the touch screen section (see above)
To use the touch screen and a mouse in parallel you need to enter the mouse specs in the Xinput-section. This definitions should be the same as in the Pointer-section. The following example is for a PS/2-mouse:
Section "Xinput"
Protocol "PS/2" Port "/dev/mouse" #could also be /dev/psaux
...
Several people pointed this out, especially the usage of the
(from Lee Monamy, modified by dithi)
Example XF86Config-4 for an ELO touch screen: (Many distros now ship with XF86Config-4 named simply XF86Config. The syntax is the same.)
Section "!InputDevice?" Identifier "ELO touchscreen" Driver "elographics" Option "Device" "/dev/ttyS0" Option "MinimumXPosition" "300" Option "MaximumXPosition" "3700" Option "MinimumYPosition" "300" Option "MaximumYPosition" "3700" Option "!UntouchDelay?" "10" Option "!ReportDelay?" "10" Option "!SendCoreEvents?" "yes"
Noteable differences between this and the version 3 config are that you specify a Device, not a Port, otherwise you get an error. Also, !AlwaysCore? from v3 has been replaced with !SendCoreEvents?.
You must also add to the !ServerLayout? section, despite that X might say: "(II) XINPUT: Adding extended input device "TOUCHSCREEN" (type: Elographics Touch Screen)"
Section "!ServerLayout?" Identifier "Default Layout" Screen "Default Screen"
...
For egalax touch screen users
Section "!InputDevice?" Identifier "TKPANEL" Driver "touchkit" Option "Device" "/dev/tkpanel0" Option "!SendCoreEvents?" "yes"
****Manpage for XF86Config ****
**** http://www.elotouch.com/Support/linux.asp ****
**** http://www.microtouch.com/mthtml/05a1_drivers.htm ****
**** http://www.hof-berlin.de/tablet/tablet.html (Thanks to Christer Olofsson for sending me this URL) ****
****The manual shipped with your touch screen :-) ****
One page links to HowToXFree86TouchScreenHOWTO:
lib/blame.php:177: Warning: Invalid argument supplied for foreach()
lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()