Linux kiosk

I recently did some maintenance on a linux-based kiosk project. It runs linux and has a rails application serving content. Firefox is running in a kiosk mode and there is no keyboard or mouse present.

In adding a touchscreen from a different vendor, I found some details that can help make a kiosk application more responsive to touchscreen taps.

If you use linux in a touchscreen implementation, I recommend staying away from linux drivers offered by the vendor if possible. These were very out of date and X refused to load them. Use evtouch if possible. Install the package:

apt-get install xserver-xorg-input-evtouch

Note that most of the parameters to the driver are meant to discourage it from giving us complicated mouse emulation behavior like mousovers, middle/right clicks, dragging, etc. It needs to be just the simplest it can be for kiosk operation. People will push buttons too long, unintentionally try to drag items, etc. If you’re using an old-style xorg.conf, you can specify the configuration there. This is how we configured it under Ubuntu 8.04.

Section “InputDevice”

Identifier    “touchscreen”
Driver “evtouch”
Option “Device” “/dev/input/touchscreen2”
Option “DeviceName” “touchscreen”

Option        “MinX”        “280”
Option        “MinY”        “276”
Option        “MaxX”        “3872”
Option        “MaxY”        “3852”

Option “ReportingMode” “Raw”
Option “Emulate3Buttons” “Off”
Option “SendCoreEvents” “On”
Option “Rotate” “CCW”
Option “SwapX” “On”

Option “TapTimer” “20”
Option “LongTouchTimer” “2000”
Option “MoveLimit” “45”
Option “DragTimer” “20”
Option “ButtonNumber” “1”


Another thing to note is how orientation/rotation work. You need to specify Rotate if the X and Y axes need to be traded (for example, you move left and right and the mouse moves up and down). It really doesn’t matter if you choose CW or CCW. It will all get worked out in the next step. That’s when you specify SwapX and/or SwapY so that the mouse moves in the same direction as you’re moving your finger along the screen. A better name for these might have been InvertX/Y.

Min/Max X/Y are provided by the calibration program. This program didn’t do much else for me, but this was enough. You really just need to know the largest and smallest values it reports. Then, assuming the touchscreen is aligned with the screen and doesn’t need fine-tuning for more complicated skew,  you’re done.

We run this app using modrails and it helped with performance to preload and never time out and unload the app. It turns out someone in front of a kiosk does not tolerate lag as much as the typical web user.