Important: Please read the Qt Code of Conduct -

[SOLVED] problem with Qt and tslib

  • I have a ARM based board in which I want to use Qt4
    I cross compiled qt-everywhere-opensource-src-4.7.0 without tslib and wrote a little program and it worked just fine on the board but without touch screen capability (I could only use mouse)
    After that I tried to compile Qt with tslib. I added following into qmake.conf file
    QMAKE_INCDIR += /home/tslib/include/
    QMAKE_LIBDIR += /home/tslib/lib/
    But when I run a sample program with qws switch nothing happens.
    I went through following procedure for compiling Qt with tslib :
    First cross compiled tslib and eveything seems to be fine. I have bin and lib directories. (tested with readelf for Architecture)
    Then cross compiled Qt with -qt-mouse-tslib and -plugin-mouse-tslib switches in ./configure command
    Transfer Qt_compiled/lib and tslib folder to appropriate directories in the board
    Setting necessary environmental variables in target

    So what's wrong?

  • I even tried :

    @ cat /dev/input/event0 | hexdump

    and I can see that touch driver is working properly as event0 just like the way it was defined in environmental variables

  • Lifetime Qt Champion


    Are you sure tslib is used on your board ? Did you configure tslib correctly ?

  • What do you mean by "Are you sure tslib is used on your board" ?
    The board has Qtopia by itself and the touch is working in Qtopia well and I'm pretty sure it's using tslib because there is ts.conf file. If there is another way to check this out please tell me.
    Anyway I cross compiled tslib just like the way I did it for another board and it worked fine on that board.

    $./configure --host=arm-linux --prefix=/home/tslib --enable-shared=yes --enable-static=yes@

  • Lifetime Qt Champion

    AFAICS, you didn't calibrate tslib

  • I corrected ts.conf file path in TSLIB_CONFFILE variable. It was pointing to a wrong place. Although it didn't solve my problem!

    Ok. How to calibrate tslib? When I run ts_calibrate binary file in the target terminal nothing happens. First question: Is it normal?
    Second: Do I have to edit some header or config file to calibrate tslib instead of running ts_calibrate?

  • Lifetime Qt Champion

    You should see a calibration GUI appearing on your device's screen

    No header needed, the calibration process of tslib generate the configuration files you'll use later on

  • Well that's another problem. When I type ts_calibrate it says in terminal :

    @tslib: Selected device is not a touchscreen (must support ABS_X and ABS_Y events)@

    And a GUI shows up but it doesn't accept my finger when I touch that spot I'm supposed to touch.
    Any Idea?

    Less important question!: Why do I have to calibrate it anyway?

  • Lifetime Qt Champion

    What touchscreen are you using ?

    For the less important question:
    Different hardware setup ?

  • Fair enough !
    I'm pretty sure it's: ft5x0x_ts
    I saw it by "cat /proc/bus/input/devices"

    Can I edit tslib sources so it wouldn't give that error?

  • Lifetime Qt Champion

    IIRC, there was a catch between that device and tslib, I don't rememberer all the details, but if you search for the two together you should find some infos.

  • You mean on this site?
    Cause I didn't find very helpful information on net. Seems like other people have or had the same problem too but nobody posted something useful.

  • SGaist I have another question. Is there an alternative to tslib?
    I mean say I never gonna make it with tslib, do I have other options to work with touch screen inside a Qt program?
    What about Qt5? I was reading this page and seems like Qt5 has some options for new multitouch controllers.
    Another question: How do I know if my board supports Qt5 versions? Can I cross compile a Qt-everywhere-5.2.1 just like the way I did for Qt-everywhere4.7.0 and copy lib folder and stuff?

  • Lifetime Qt Champion

    IIRC, Qt 5 has the evdev plugin in addition to also support tsllib.

    What board are you using ?

    Basically yes, depending on your needs you might have to provide additional libraries in order to fully build Qt 5.

  • Dear SGaist I managed to get tslib to work with touch screen controller by modifying controller driver in kernel. Now I can run ts_calibrate successfully and everything seems to be fine.
    But still Qt doesn't take touch actions. I tried to compile Qt again with some modifications in qmake.conf like:
    Respectively pointing to tslib Header and Lib directory. But still I can not use touch as an input to compiled Qt demo programs.
    I added -qt-mouse-tslib and -plugin-mouse-tslib into configure.
    I've set all necessary environmental variables for Qt and tslib.

    Please help me. I got too excited after solving controller's problem but now I'm stuck at a point all over again.

  • Lifetime Qt Champion

    It's not a build problem.

    tslib is used in a plugin. You have to configure your application to start using the plugin

  • Yeah I kind of have the feelings that it has something to do with the environment variables and things like that. But I went based on this page:
    Then I don't know what is wrong.
    Any specific idea?

  • Lifetime Qt Champion

    Since you talked about both Qt 4 and 5, which version are you currently using ?

  • Ok I figured there was some problems with environment variables. Apparently device name is something else. Now it seems it's working.
    By the way I meant Qt4.

Log in to reply