Lilliput touchscreen under X.org (Ubuntu)

After suprisingly little stuffing about, I managed to get my Lilliput 7" touchscreen working under X.org in Ubuntu.

The lilliput touchscreens are powered by eGalax touch controllers, which is supported by usbhid in the 2.6 kernel - so if you check the contents of dmesg, you will see an entry corresponding to the touchscreen device. For example:

input: eGalax Inc. Touch as /class/input/input4
input,hiddev96: USB HID v1.12 Pointer [eGalax Inc. Touch] on usb-0000:00:1d.2-2
usbcore: registered new interface driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver

If you have a look at /proc/bus/input/devices you should also see a corresponding entry for the device:

I: Bus=0003 Vendor=0eef Product=0001 Version=0112
N: Name="eGalax Inc. Touch"
P: Phys=usb-0000:00:1d.2-2/input0
S: Sysfs=/class/input/input4
H: Handlers=mouse1 event4 ts1
B: EV=b
B: KEY=401 0 30000 0 0 0 0 0 0 0 0
B: ABS=f

Then it’s as simple as installing the xserver-xorg-input-evtouch package which will install x support for this device. However, the HAL policy for this device doesn’t work reliably to being with - as the X and Y coordinates on these panels are swapped.

To fix this, edit the file /usr/share/hal/fdi/policy/20thirdparty/50-eGalax.fdi, and insert the following line:

<merge key="input.x11_options.rotate" type="string">cw</merge>

I also found that the min/max X/Y options to be poor choices for this display, I set the min and max values in both directions to 0 and 2000 respectively.

Then all you have to do is add an InputDevice section into your x.org configuration as follows. Make sure the Device key points to the event handler listed in the /proc entry from above:

Section "InputDevice"
Identifier "touchscreen0"
Driver "evtouch"
Option "Device" "/dev/input/event4"
Option "DeviceName" "touchscreen"
Option "MinX" "0"
Option "MinY" "0"
Option "MaxX" "2000"
Option "MaxY" "2000"
EndSection

Voila! Start X and your touchscreen should work like a charm. If you don’t want X to whinge that it’s your only input device, make sure you enable the CoreInput option in the InputDevice definition.

There you go!