A13 Touchscreen support for Debian

Image

I posted for how to add Touchscreen support for Debian for A13 in December 2012, but things changed a bit since then so I got GitHub pull request from Nikita Maslov. We tested his patches and they work fine on A13 so his request was pull and merged in our GitHub account.

On top of this he made small post on his blog how to implement it, which I link here: http://www.dimrobotics.com/2013/06/olinuxino-a13-touchscreen-support-in.html

A13-LCD7TS support in Linux

Image

A13-LCD7TS 7″ LCD with Touchscreen works perfect under Android, but the normal Debian image we have didn’t support it.

You can see some discussion on our forum about it: https://www.olimex.com/forum/index.php?topic=444.0 part of the problem is that touchscreen driver is not registered as such in the linux kernel. This could be fixed relatively easy by adding the info written on the forum, so now you can use the touchscreen by your apps, but you still can’t do this under X, why?

Because Debian is missing xf86-input-tslib library in it’s repositories and to have working touchscreen on XFCE4 you have to download and compile this library yourself.

Dimitar Gamishev (a.k.a. HEHOPMAJIEH form #olimex irc channel) yesterday teach me how to do this step by step so now I can share. First you have to download the Touchscreen patched which Dimitar did from https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/TOUCHSCREEN

1. ENABLE TOUCHSCREEN

then you follow these steps:

step 1.

$ git clone https://github.com/kergoth/tslib

step 2.

$ cd tslib

step 3.

$ patch -p1 < ../tslib.patch

(if asks for the filename it is plugins/input-raw.c)

step  4.

$ autoreconf -vi

step 5.

$ ./configure

step 6.

$ make

step 7.

$ make install

so far fo good, now touchscreen event is exported and to see which number it is do

$ dmesg | grep sun4i-ts

[ 18.190000] sun4i-ts.c: sun4i_ts_init: start …
[ 18.200000] sun4i-ts: tp_screen_size is 7 inch.
[ 18.210000] sun4i-ts: tp_regidity_level is 5.
[ 18.220000] sun4i-ts: tp_press_threshold_enable is 0.
[ 18.230000] sun4i-ts: rtp_sensitive_level is 15.
[ 18.230000] sun4i-ts: rtp_exchange_x_y_flag is 0.
[ 18.240000] sun4i-ts.c: sun4i_ts_probe: start…
[ 18.260000] input: sun4i-ts as /devices/platform/sun4i-ts/input/input4
[ 18.280000] sun4i-ts.c: sun4i_ts_probe: end
[ 18.260000] input: sun4i-ts as /devices/platform/sun4i-ts/input/input4

so in this case the event is 4

then you have to do some EXPORTs where you replace X with “4” in this case:

$ export TSLIB_TSEVENTTYPE=raw
$ export TSLIB_CONSOLEDEVICE=none
$ export TSLIB_FBDEVICE=/dev/fb0
$ export TSLIB_TSDEVICE=/dev/input/eventX
$ export TSLIB_CALIBFILE=/etc/pointercal
$ export TSLIB_CONFFILE=/path/to/ts.conf
$ export TSLIB_PLUGINDIR=/path/to/lib/ts

note you should write your correct path which depend on what OS you are running and what –prefix you used to compile them

if you did everything correctly you can check with

$ ts_test

or

$ ts_calibrate

if everything is OK

2. ENABLE TOUCHSCREEN FOR X

$ wget http://ftp.de.debian.org/debian/pool/main/x/xf86-input-tslib/xf86-input-tslib_0.0.6.orig.tar.gz

$ tar zxfv xf86-input-tslib_0.0.6.orig.tar.gz

$ cd xf86-input-tslib-0.0.6/

$ patch -p1 < ../1-xf86tslib-sigfault.patch

$ patch -p1 < ../xf86-input-tslib-port-ABI-12-r48.patch

$ ./configure –prefix=/your/x11/lib/dir/

$ make

$ make install

add this in the X- configuration:

Section “InputDevice”
Identifier “Sun4iTouchscreen”
Option “Device” “/dev/input/eventX”
Driver “tslib”
Option “ScreenNumber” “0”
Option “Rotate” “NONE”
Option “Width” “800”
Option “Height” “480”
Option “SendCoreEvents” “yes”

EndSection

and like in point 1 /dev/input/eventX replace X with “4”

then pray and start X 😉 if you did everything correctly X should start with Touchscreen support like show on these videos:

http://www.youtube.com/watch?v=DjTYji93xNY

http://www.youtube.com/watch?v=-4COA3ZBacY