This is an How-To guide on getting a Touch Screen Film working in Linux. The Touch screen I use here was purchased from Deal Extreme. It is a 7″ USB based touch film layered on a glass screen. This can be used along with a 7″ monitor like the one I used here.
Jump to Beta Drivers - The download site has some beta drivers for xorg 1.3 / 32bit. From what I can see, it simply automates the above. I did not try them.
In this case, I have set it up with a Raspberry-Pi system + 7″ Lilliput monitor + raspbian OS (Debian derivative Linux). Setting up a 7″ Lilliput monitor is documented here in another post. This guide focuses on getting touch screen worked. Winstar express v3. This one is coming from D-WAV Scientific Co. It comes with USB interface.
Here is how to identify the device I mentioned here.
$ lsusb
. . . . . .
Bus 006 Device 002: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen
. . . . . .
Bus 006 Device 002: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen
The Linux kernel version is 3.2.27-cutdown+ from raspbian.
UPDATE: The first step in getting this done is to compile the raspbian kernel with necessary kernel module. Here is a nice article on compiling your kernel for Raspberry Pi. Before compiling, in menuconfig we include usbtouchscreen module, which supports this touch screen film. Here is where do we need to find this module.
Device Drivers -> Input device support -> Generic input layer (needed for keyboard, mouse, …) -> Touchscreens (INPUT_TOUCHSCREEN [=y]) -> TOUCHSCREEN_USB_EGALAX [=y]
Once kernel compiled and rebooted with new kernel, it should be detected as USB Touch Screen of Serial Input device as observed below. The usbtouchscreen module loaded automatically.
$ demsg
. . . . . . . .
usb 1-1.3.3.2: new low-speed USB device number 9 using dwc_otg
usb 1-1.3.3.2: New USB device found, idVendor=0eef, idProduct=0001
usb 1-1.3.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.3.3.2: Product: USB TouchController
usb 1-1.3.3.2: Manufacturer: eGalax Inc.
input: eGalax Inc. USB TouchController as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3.2/1-1.3.3.2:1.0/input/input2
usbcore: registered new interface driver usbtouchscreen
. . . . . . . .
usb 1-1.3.3.2: new low-speed USB device number 9 using dwc_otg
usb 1-1.3.3.2: New USB device found, idVendor=0eef, idProduct=0001
usb 1-1.3.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.3.3.2: Product: USB TouchController
usb 1-1.3.3.2: Manufacturer: eGalax Inc.
input: eGalax Inc. USB TouchController as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3.2/1-1.3.3.2:1.0/input/input2
usbcore: registered new interface driver usbtouchscreen
$ lsmod | grep touch
usbtouchscreen 8856 0
usbtouchscreen 8856 0
$ cat /proc/bus/input/devices
I: Bus=0003 Vendor=0eef Product=0001 Version=0100
N: Name=”eGalax Inc. USB TouchController”
P: Phys=usb-bcm2708_usb-1.3.3.2/input0
S: Sysfs=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3.2/1-1.3.3.2:1.0/input/input2
U: Uniq=
H: Handlers=mouse1 event2
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3
I: Bus=0003 Vendor=0eef Product=0001 Version=0100
N: Name=”eGalax Inc. USB TouchController”
P: Phys=usb-bcm2708_usb-1.3.3.2/input0
S: Sysfs=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3.2/1-1.3.3.2:1.0/input/input2
U: Uniq=
H: Handlers=mouse1 event2
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3
Now we need to install the right X input driver. For me the xserver-xorg-input-evtouch package in repository failed to function. So I downloaded the source tar file and patch from Ubuntu’s launchpad here.
Apply the patch and build the source to get evtouch_drv.so. Once installed you should have it in /usr/local/lib/xorg/modules/input/.
Now it is time to edit xorg.conf file. Here is my xorg.conf file highlighted with touch screen specific configuration lines:
#################################################
Section “ServerLayout”
Identifier “Server Layout”
InputDevice “touchscreen” “CorePointer”
Screen 0 “DisplayLinkScreen” 0 0
EndSection
Identifier “Server Layout”
InputDevice “touchscreen” “CorePointer”
Screen 0 “DisplayLinkScreen” 0 0
EndSection
#################################################
Section “Files”
ModulePath “/usr/lib/xorg/modules”
ModulePath “/usr/local/lib/xorg/modules”
ModulePath “/usr/local/lib/xorg/modules/drivers”
ModulePath “/usr/local/lib/xorg/modules/input”
EndSection
ModulePath “/usr/lib/xorg/modules”
ModulePath “/usr/local/lib/xorg/modules”
ModulePath “/usr/local/lib/xorg/modules/drivers”
ModulePath “/usr/local/lib/xorg/modules/input”
EndSection
############### DisplayLink Stuff ###############
Section “Device”
Identifier “DisplayLinkDevice”
Driver “displaylink”
Option “fbdev” “/dev/fb1”
Option “DPI” “140×140”
EndSection
Identifier “DisplayLinkDevice”
Driver “displaylink”
Option “fbdev” “/dev/fb1”
Option “DPI” “140×140”
EndSection
Section “Monitor”
Identifier “DisplayLinkMonitor”
#DisplaySize 152 92
EndSection
Identifier “DisplayLinkMonitor”
#DisplaySize 152 92
EndSection
Section “InputDevice”
Identifier “touchscreen”
Driver “evtouch”
Option “Device” “/dev/input/event0”
Option “DeviceName” “touchscreen”
Option “MinX” “98”
Option “MinY” “43”
Option “MaxX” “940”
Option “MaxY” “925”
Option “ReportingMode” “Raw”
Option “Emulate3Buttons”
Option “Emulate3Timeout” “50”
Option “SendCoreEvents” “On”
EndSection
Identifier “touchscreen”
Driver “evtouch”
Option “Device” “/dev/input/event0”
Option “DeviceName” “touchscreen”
Option “MinX” “98”
Option “MinY” “43”
Option “MaxX” “940”
Option “MaxY” “925”
Option “ReportingMode” “Raw”
Option “Emulate3Buttons”
Option “Emulate3Timeout” “50”
Option “SendCoreEvents” “On”
EndSection
Section “InputClass”
Identifier “calibration”
MatchProduct “eGalax Inc. USB TouchController”
Option “Calibration” “1962 81 1923 129”
EndSection
Identifier “calibration”
MatchProduct “eGalax Inc. USB TouchController”
Option “Calibration” “1962 81 1923 129”
EndSection
Section “Screen”
Identifier “DisplayLinkScreen”
Device “DisplayLinkDevice”
Monitor “DisplayLinkMonitor”
SubSection “Display”
Depth 16
Modes “800×480”
EndSubSection
EndSection
Identifier “DisplayLinkScreen”
Device “DisplayLinkDevice”
Monitor “DisplayLinkMonitor”
SubSection “Display”
Depth 16
Modes “800×480”
EndSubSection
EndSection
#################################################
In the above file, the line “Option “Calibration” “1962 81 1923 129″” was obtained with xinput calibration tool mentioned below. Initially I did not add this line, once calibrated the tool gave these values, so that I added to the xorg.conf file.
Build and install xinput_calibrator tool as per this guide. Download the source code from here. Then follow the usual ./configure, make and make install to install the tool.
Next step is to run the xinput_calibrator tool as root user, follow the wizard to press the arrows shown on screen using a stylus. Once the wizard is done, a piece of configuration is shown on terminal, use that configuration snippet in xorg.conf. Note that this tool should be run X windows environment. Logout and login back.
Here is the touch screen in action:
Enjoy your own touch screen build!