Installing TSLib and Calibrating it

From previous blogs, I successfully cross-compiled TSLib. It installed it in /usr/local/linux-arm. So on my board I created a similar path. Since I am doing a secure copy up, I need to give /usr/local/linux-arm a new owner (eclipse).

$ mkdir /usr/local/linux-arm
$ chown -R eclipse:eclipse /usr/local/linux-arm

In VMWare:
$ cd /usr/local
$ scp -r linux-arm/ eclipse@192.168.0.50:/usr/local/

Now TSLib requires environment variables set up. Edit /root/.bashrc and add these lines:

export TSLIB_TSEVENTTYPE=H3600
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/linux-arm/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/linux-arm/lib/ts

Do a switch user to load these
$ su

Now open /usr/local/linux-arm/etc/ts.conf file and delete all lines and add this:

module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

(Make sure that there are no empty lines above or below)

Now to calibrate the device navgiate to the bin directory and run the program. It will display on screen points to tip. Once it is calibrated it will create a file /etc/pointercal. Don’t touch this file. If it fails to create it, ensure neccessary permissions on /etc to allow it. DO NOT CREATE a blank file before hand or you will get a segmentation fault.

$ cd /usr/local/linux-arm/bin
$ ./ts_calibrate

And that is all to installing and configuring TSLib.

Thursday, January 29th, 2009 QT Embdedded Programming, Single Board Computer

15 Comments to Installing TSLib and Calibrating it

  • albertogomezisaza says:

    Hi Donal,
    I have been following all the proceedures on the blog since I am using QT/Embedded and TSLib on a TS-TPC-7390 for a finger print reader project.

    I compiled everything, but when I run the TSLib calibration utility I get a “selected deselected device is not a touchscreen I understand” message. Did you have a similar problem? if so how did you solve it?

    BTW, I tested under both debian etch (arm) and lenny (armel) using the compiled library (the way specified in the blog) and a package downloaded from lenny repositories.

    Cheers,
    Alberto

    PS. If you need to setup an EABI distribution you could take a look at Ted Roth’s page, he helped me setting lenny and crosscompiling the kernel for compatibility (http://ted.openavr.org/Lenny-on-ts7390/)

  • admin says:

    Hi Alberto,

    Did you try chmodding /dev/event0 to 777. Could be permissions related.
    However I did compile tslib recently on Ubuntu again and I got that same message. I might be missing something. I’ll give a reply later on when I have more of a look.

  • admin says:

    Hi again,

    In the mean time if you are in hurry I have a compiled binary for the TS7390 that works. http://automon.killarneyonline.eu/files/tslib.zip

    Don’t forget to export all the variables:

    export TSLIB_TSEVENTTYPE=H3600
    export TSLIB_CONSOLEDEVICE=none
    export TSLIB_FBDEVICE=/dev/fb0
    export TSLIB_TSDEVICE=/dev/input/event0
    export TSLIB_CALIBFILE=/etc/pointercal
    export TSLIB_CONFFILE=/usr/local/linux-arm/etc/ts.conf
    export TSLIB_PLUGINDIR=/usr/local/linux-arm/lib/ts

  • albertogomezisaza says:

    Thanks! I loaded your compiled tslib and chmodded event0 and it finally recognized the device. However it detected all the inputs as X=0 and Y=0. This might have to do with the way event0 is sending the data…

    This was under lenny armel so it might also be that. I’ll give it a try with the original etch distribution and let you know how it goes.

    BTW under what OS did you compile it?

  • admin says:

    Strange that it not finding the co ordinates. – Did ts_calibrate work successfully finding where you touched the boxes?

    I compiled it on Xubuntu but I also installed Ubuntu another time and compiled from there but I got the same thing as you, device not recognized as touchscreen or something.

    If you havn’t already, you should sign up to http://tech.groups.yahoo.com/group/ts-7390 (Theres a ts-7000 as well that a lot more active but won’t see as much QT/TSLib on it).

    In the files section there is a tarball uploaded by Jason that includes steps to copiling Tslib and includes the actual source files all in one. Might be worth trying that.

    However I amn’t sure why I got same error as you when using Ubuntu. It could be possible that I was using another compiler. Are you using the GCC 3 compiler that came on SD card or on embeddedarm’s ftp?

  • admin says:

    I’ve uploaded my /etc/pointercal file, in theory should work same as yours since same device. http://automon.killarneyonline.eu/files/pointercal

  • albertogomezisaza says:

    Ok so I just tested it with the original distribution provided by TS and your compiled version works like a charm!

    I might have to stick to etch for a while until I can setup event0 the same way under lenny.

    Anyways Thanks, and let me know if you can find the flaw in the Ubuntu compilation or if I can assist in any way.

    Cheers,
    Alberto

  • admin says:

    Ah I see excellent stuff.

    Thanks for the link to setting up EABI distribution. Might look into that later on.

    Cheers,

    Regards,
    Donal

  • Stefan says:

    I am wondering what version of tslib you used? I seem not to get it working with: http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2

    In that version TSLIB_TSEVENTTYPE is not there anymore. The h3600 plugin seems not to work. What I also find strange is that the ts.conf file in your compiled example does not have a ‘module_raw’ specified, how can this be?

    Thx

    Stefan

  • Donal says:

    Hi Stefan,

    I used the one from berlios too and that seemed to work fine. I do have the module_raw parameter in my configure file but it was a typo. It should be “module_raw input”, I’ve corrected that now.

  • Stefan says:

    That is strange the 1.0 version requires ABS_PRESSURE from the driver. The ts_lcd driver from the 7390 does not support it. Can you post a tar with the sources you used to generate those binaries?

    TIA

  • Donal says:

    I don’t have them currently here but they somewhere on my other machine. For now you might like to sign up to http://tech.groups.yahoo.com/group/ts-7390/ and look in the files section. One of the guys uploaded sources with instructions on how to compile. I don’t know if I used this one or not but it has worked for a few of us anyways. I think the instructions are very similar.

  • Stefan says:

    Hi Donal,

    Thx for the tip.

  • Donal says:

    No problems, if ya have any problems let me know.

  • Vinay says:

    Im Working ARM board i.mx31. i have ts_calibrate on board itself. But now i want to use this touch screen for my GUI built by Qt embedded, When execute ts_calibrate it shows window with small buttons DRAG and DRAW. when touch screen it shows the co ordinates on PC of my TS.but when i run my application cursor wont move at all. Cursor will be on left top. Im not able to pass input from this TS.i ave downloaded TSLIB-1.0 lib and compiled acc ARM compiler. Now im not able to activate TouchScreen

  • Leave a Reply

    You must be logged in to post a comment.