Touchscreen with Qt5 embedded not working

9.2k views Asked by At

I have qt5 embedded with Linux. My touchscreen does not work when I run my program with Linux frame buffer, for example:

./myprog -plugin tslib:/dev/input/event0

More details:

  • ts_calibrate works fine
  • when I run my program with ./myprog -platform eglfs, touchscreen works fine
  • my environment:

    TSLIB_TSDEVICE=/dev/input/event0
    USER=root
    LD_LIBRARY_PATH=/usr/local/Qt-5.3.2/lib/
    TSLIB_TSEVENTTYPE=INPUT
    OLDPWD=/usr/local/Qt-5.3.2
    HOME=/root
    QTDIR=/
    TSLIB_FBDEVICE=/dev/fb0
    QT_QPA_EVDEV_KEYBOARD_PARAMETERS=/dev/input/event1
    TSLIB_PLUGINDIR=/usr/lib/ts
    TSLIB_CONSOLEDEVICE=none
    LOGNAME=root
    TERM=vt102
    QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=270
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    QT_QPA_GENERIC_PLUGINS=evdevmouse:/dev/input/event0
    TSLIB_CONFFILE=/etc/ts.conf
    SHELL=/bin/sh
    QWS_DISPLAY=powervr
    QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=0
    PWD=/root
    QWS_MOUSE_PROTO=tslib
    TSLIB_CALIBFILE=/etc/pointercal
    
  • Qt 5.3.2 config.status :

     configure -verbose -confirm-license -release -no-xcb -no-pch -icu -tslib -qpa eglfs -no-c++11 -no-cups -no-gtkstyle -make libs -opensource -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtenginio -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtsensors -skip qtserialport -skip qttranslations -skip qttools -skip qtwebkit-examples -skip qtwinextras -skip qtx11extras -xplatform linux-omap3-g++ -qpa eglfs -qpa linuxfb -evdev
    
4

There are 4 answers

2
donjuedo On

Qt's support of tslib is iffy. I found that part of Qt tries to implement gestures, but part of Qt tries to map touches to mouse clicks. In my own experience, the result was unfinished/dropped gestures.

0
oneshepherdssheep On

I hope you find a solution. If not, try this :

  1. Specify the TSLIB DEVICE

    export TSLIB_TSDEVICE=/dev/input/event0

  2. On some device you have to enable the TSLIB support (on my board it's not required)

    export QT_QPA_FB_TSLIB=1

  3. Launch your application

    ./myCuteQt5App -platform linuxfb -plugin tslib

Everything should work properly (in my case works like a charm ;) ).

Hope it helps.

0
Toby Speight On

Since you have evdev available, you might have more success using that for input. I've used the following with success:

export QT_QPA_PLATFORM=linuxfb
export QT_QPA_GENERIC_PLUGINS=evdevtouch,evdevmouse,evdevkeyboard
export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1
0
merge On

as of tslib version 1.3, you could use the included ts_uinput daemon to create an evdev input device. Point your evdev environment to it and you'd have tslib filtered and calibrated touch input without using QT's tslib plugin.