A few months ago i got my hand on a cheap touch screen monitor made by a chinese vendor named lilliput on ebay which connects to the VGA and a USB port:

Coming up with a project

when i bought it i did not really had any project in mind, but shortely thereafter i realised a particular lack of technology in my kitchen.
My flat contains all the (by now normal) modern media tech stuff it should... i use GB-PVR as a media centre hooked up to a samsung tv in my living room, a NOXON iRadio hooked up to a (bit antique...) sony stereo to listen to webradios or my mp3 collection in my bedroom and in my car i use an (ancient) DMP3A player to listen to good music and escape the annoying radio jingles while driving :)

but in the kitchen there is this cheap portable radio CD/cassette recorder. ok, it does read mp3s from a CD and even allows USB sticks to be hooked up, but navigation through the directories is a PITA. The only good thing: it does also come with an AUX input and the quality of the speakers is OK (audiophiles out there may beg to differ on that one, i guess :) )
anyway: this situation was truly unsatisfying, as i would like to listen to webradio or MP3s while cooking.

So i planned to set up a small computer with a (customized) linux. i was sure there will be free software out there so i did not spend much thought on this as the task at hand was getting this cheap no name touch screen work under linux.

The hardware

i got my hands on a fanless asus AT5NM10-I mini itx and organised some small computer case (a Thermaltake Element Q).
originally i thought about using a SATAtoCF converter and use a 8GB compactflash card setting it up like a Live CD, but i was not able to get a decent speed with that setup.
so i went for a standard sata2 harddisk, leaving room for future improvement :)

A touchy touch screen

the day the touch screen arrived i hooked it up to a ubuntu system (10.04 or something i think ) and it worked... sort of.
lsusb reported it as "ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen" and when touching it, it did control the mouse pointer. but both X and Y axes were inverted.

some searching in the intertubes revealed that eGalax actually offers linux drivers on their homepage, but i was not able to get them to install/work.
Besides.. the module usbtouchscreen did recognise the touch screen, so i figured it is just a matter of finding the right config.

but before i continued i had to think about what flavour of linux i was going to settle.
I did not want to build an entire system from scratch so i checked out distros which advertise themselves as being lightweight.
after a long and complicated decission process (read: looking at screenshots and checking out live CD ISO sizes) i settled for Lubuntu.
I was giving some thoughts into a android, which has been ported over to the x86 platform, but with my hardware it didn't even boot :-)

after i set up a minimal system and grabbed an image from it (just in case i 'break' the installation in some way) i started digging up info on how to set up an eGalax touch screen.

some people claimed to have make their touch screen work by adding a file with an InputClass section to their evdev config in /usr/lib/X11/xorg.conf.d (changed by now to /usr/share/X11/xorg.conf.d/)

i tried this by adding this to 05-evdev.conf


Section "InputClass"
   Identifier "eGalax"
   MatchProduct "eGalax"
   MatchDevicePath "/dev/input/event*"
   Driver "evdev"
   Option "SwapAxes" "1"
   Option "Calibration" "43 1981 86 1942"

SwapAxes obviously swaps X and Y axes, while the calibration entry matches up the position of the touch event and the X/Y pixel coordinates on the screen.
Both can be obtained by running xinput_calibrator.

it works for single "click" events but as soon as you start to keep your finger on the screen and start to move it (which should cause the mouse cursor to drag), the cursor jumps to 0,0 and then back to the 'real' position in a wild fashion.

after some frustration i found that there is something called coordinate transformation matrix which should achieve the same. Having nothing to lose i tried to do this (8 is the device id of the touch screen):

xinput set-prop 8 "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

and it worked all nice and flawless!
right... finally some progress. "just put that stuff into your evdev.conf and that was it", i thought. guess what: it's not that easy:
as of the time of this writing, the coordinate transformation matrix cannot be set from within evdev conf. only by calling xinput in a script.

problem with this is: the setting is not persistent. rebooting the system or switching the monitor off and on goes back to the default state with swapped axes.

i did not want to write a shell script which continuously calls xinput. the solution: a udev rule. Whenever the USB device gets connected a script in /usr/local/ is invoked which then calls xinput.

i created a new file 85-egalax.rules in /etc/udev/rules.d and added the following (The values for idVendor and idProduct i got by executing lsusb):


ACTION=="add", ATTRS(idVendor)=="0eef", ATTRS(idProduct)=="0001", RUN+="/usr/local/" itself contained the xinput calls to set the calibration and the coordinate transformation matrix.
when switching on the monitor (or replug the USB plug of it) got called (with root)

but xinput threw an error "Cannot connect to X server".
this is because in the context of the shell script, the enivornment variables $DISPLAY and $XAUTHORITY are not defined.

as my installation always uses just one X session and is set to autologin, i simply hard coded the DISPLAY and XAUTHORITY values (somewhere a linux admin is crying).

this brought me one step closer: now xinput whines something about "unable to find device 8".
a closer look revealed that the device is not being reported by e.g. lsusb before this script has finished! adding sleep commandsLTNT has no effect on this behaviour. as soon as the called script has finished executing, the device is present.

so i did what every (in)sane person would: moving the content of to another file (surprisingly called and calling that with a trailing & character

/usr/local/ &

export XAUTHORITY="/home/kmedia/.Xauthority"
export DISPLAY=":0.0"
xinput set-prop 8 "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop 8 "Evdev Axis Calibration" 43 1981 86 1942

this worked. and it worked great. until i rebooted the system and noticed that this somehow broke the 'autologin' function. the system just ended up on the greeter screen asking for user and password.

it seems that setting DISPLAY and XAUTHORITY is stopping that autologin process (probably thinking that it has logged in already, since XAUTHORITY is set...).

the calibration and transformation matrix are set once after the login anyway (i added them to /etc/xdg/lxsession/Lubuntu/autostart) so i just have to make sure it does not get called before LXDE has loaded :

xrunning=`ps -ef | grep lxsession | grep -cv grep`

if [ "$xrunning" = "1" ];
 export XAUTHORITY="/home/kmedia/.Xauthority"
 export DISPLAY=":0.0"
 xinput set-prop 8 "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
 xinput set-prop 8 "Evdev Axis Calibration" 43 1981 86 1942

i know, i know there surely is a much more elegant way to check if lxsession is running, and hard-coding the username is highly offensive as well, but hey... i am not a shell script expert and it was late when i wrote that.

after that last change, the correct settings were applied whenever the screen was connected/switched on.
booting into LXFE without a password prompt also works.

Playing Media

finally i could put some thoughts into the software. Originally i thought about a touch screen friendly GUI like Unity or Gnome III and some player like rhythmbox, as the primary purpose is accessing my MP3 collection by UPNP and play some web radio stations.

But the problem here lies within the limits of my body: with my stumpy fingers and my general clumsiness it is not easy to hit those small buttons, which obviously were not defined for touch screens.
I needed something that is skinnable (read: something someone has already made a touch screen friendly skin for as i lack the time, patience and most certainly the artistic skills to do something like this myself).

i figured that fully featured media centres (like the windows based GB-PVR i use in my living room) are more likely to offer this features and a contributing skinning community. And since they are -desinged- to be used without a physical keyboard they most certainly come with features like on screen keyboards and big nice button intended to be seen from distance on the tv screen).

it did not take long for me to find XBMC. it originally started out as media centre software for the original Xbox hardware but it has been made available as a native application for Linux, Windows, MacOS and iOS since quite a while now.
It is highly skinnable and offers a variety of plug ins.

Browsing the net

Of course, being able to browse the internet would be great, but with the normal browsers it is not that much of a delight experience.
I checked out Firefox which offers a variety of extensions including one with an on screen keyboard. It did work, but not as nice as we are now used to from our mobile phones :)
Same goes for chrome.

I started to check out if chrome or firefox for mobile devices have been backported to x86 and found the -perfect- solution with my (all time favourite) browser opera.
They ported their opera mobile browser to the x86 architecture providing rpm packages (which can be turned into deb packages for the debian based distro with alien).

i installed it and it works great just out of the box. with all the features you are used from a touch screen browser: on-screen keyboard, draging, zooming, etc.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer