Rotating touch screen in QT Application using Evdevtouch plugin causes crashes

  • Hello everyone,
    I'm using QT 5.10 on Raspberry Pi.
    If touch screen is rotated the program suddenly crashes when one is pressing the touch.
    I'm using the following script to start the application.


    export LD_LIBRARY_PATH=/usr/local/qt5.10/lib/
    export PATH=/usr/local/qt5.10/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/qt5.10/bin
    export QT_QPA_EGLFS_FORCE888=1
    export QT_QPA_EGLFS_DEPTH=32

    stty -F /dev/ttyAMA0 57600
    stty -F /dev/ttyAMA0 -echo -onlcr
    sudo rm /home/pi/output.txt
    sudo /home/pi/ApplicationX -plugin Evdevtouch:/dev/input/event0:rotate=90:invertx=0:inverty=1 &> /home/pi/output.txt

    The error it gives is:
    ./ line 16: 689 Segmentation fault sudo /home/pi/ApplicationX -plugin Evdevtouch:/dev/input/event1:rotate=90 &> /home/pi/output.txt

  • Lifetime Qt Champion


    You should get the stack trace of your crash. That should give you more information about what is happening.

  • The application and the build was in long term use.
    I just decided to use the touchscreen in vertical mode.

    That is the error in output.txt:
    TouchPointPressed without previous release event QQuickEventPoint(accepted:false state:Pressed scenePos:QPointF(76.4292,1829.05) id:3000001 timeHeld:0)

    I don't know where to check for more information.

  • Lifetime Qt Champion

    Can you trigger that crash easily ?
    If so then run a debug build of your application and use the debugger.

  • I think I fixed the things up.

    I set the variables like:
    export QT_DEBUG_PLUGINS="1"
    export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS="/dev/input/event1:rotate=270"
    export QT_QPA_GENERIC_PLUGINS="evdevtouch:/dev/input/event1"

    I found that they ware not set in the that i'm using to start the application at boot time, so i just modified main.cpp:

    **#include <QGuiApplication>
    #include <QApplication>
    #include <QtQuick>
    #include "core.h"

    int main(int argc, char *argv[])
    qmlRegisterType<core>("core", 1, 0, "Gen");
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("1920"));
    qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("1080"));
    qputenv("QT_QPA_EGLFS_FORCE888", QByteArray("1"));
    qputenv("QT_QPA_EGLFS_DEPTH", QByteArray("32"));

    qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
    qputenv("QT_QPA_EGLFS_DISABLE_INPUT", QByteArray("1"));
    qputenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS", QByteArray("/dev/input/event1:rotate=270"));
    qputenv("QT_QPA_GENERIC_PLUGINS", QByteArray("evdevtouch:/dev/input/event1"));
    qputenv("QT_QPA_EGLFS_HIDECURSOR", QByteArray("1"));
    QApplication app(argc,argv);
    QQuickView view;

    // QApplication::setOverrideCursor(Qt::BlankCursor);

    return app.exec();


    Now the application is starting without -plugin Evdevtouch:/dev/input/event0:rotate=90:invertx=0:inverty=1 argument.

    I think that there ware some thread problems.

Log in to reply