Noob needs help with Elo Touchscreen



  • Can somebody help me with, maybe, a simple problem? I have an old ELO touchscreen (single touch, type ET1546L) connected to a raspberry pi. I can see the Raspbian desktop and the touchscreen functions normally. Every touch is sensed. But when I develop a simple QML to display on the touchscreen, the touches on the screen aren't processed. I have configured Qt with evdev support.

    Maybe I forget something but I don't know what. Could someone point me in the right direction?

    My code
    import QtQuick 2.2
    import QtQuick.Window 2.1

    Window {

    visible: true
    width: 360
    height: 360
    
    MouseArea {
        anchors.fill: parent
        onClicked: {
            console.log("touch down!!!")
        }
    }
    
    Text {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
    

    }


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How are you starting your application ?



  • I'm developing on my ubuntu machine. I have followed the beginners guide for developing on raspberry pi. I run the program by hitting ctrl + r.


  • Lifetime Qt Champion

    Did you check that your RPi user has access to the device ?

    The Embedded Linux chapter has pointer to help you find out what may be going wrong



  • I changed the permissions of the device to 777 and tested it then but still the touch isn't sensed. I also tried the tslib option by adding the enviroment variables but this doesn't solve my problem too. One thing i noticed is that when I plugin a usb mouse the mouse point is visible in my program. If I switch the usb mouse with the usb part of the touchscreen no mouse pointer is visible.

    Can you help me further?


  • Lifetime Qt Champion

    Did you first check that tslib is working properly ?



  • @SGaist

    Sorry for my noob question but: How can i do that?


  • Lifetime Qt Champion

    You can use ts_calibrate



  • Sorry for my delay but I wasn't able to respond sooner. When I type ts_calibrate i get the following message.

    ts_open: No such file or directory
    

    Could you help me again with this problem?


  • Lifetime Qt Champion

    Did you setup the environment variables for ts_calibrate to run properly ?



  • [edit]

    I've founded that i allready installed tslib via apt-get. I think the git install was conflicting with the already installed tslib. No I removed the tslib via apt-get and install from this git directory. Now ts_calibrate works. I have calibrated the screen. Also ts_test returns values.

    But when I run my program (see below) from QT creator and hit the blue rectangle nothing happens. The program had to close. When i put the rectangle in the left upper corner and run the program and touch the screen the rectangle get hit and the program close. So the touch works only the movement of the mouse cursor doesn't go to the point where the touch is. The mouse arrow stays in the left upper corner. Can you tell me what I'm forgetting?

    My QML code

    import QtQuick 2.3
    import QtQuick.Window 2.2
    
    Window {
        visible: true
    
        Rectangle {
            x:100;y:100;width:100;height:100
            color: "blue"
    
        MouseArea {
            anchors.fill: parent
            onClicked: {
                Qt.quit();
            }
        }
        }
        Text {
            text: qsTr("Hello World")
            anchors.centerIn: parent
        }
    }
    


  • I have added the following to the run arguments -plugin Tslib and gets the following message in de QTCreator application output windows

    ts_open() failed (No such file or directory)
    

    But when I do ts_calibrate of ts_test on my raspberry everything works. Can someone help me with this?


  • Lifetime Qt Champion

    Did you check the environment variables of the Run part in the Project panel ?



  • Thank you for your reply. I have it finally working. With the following environment variables. Especially the LD_PRELOAD was important. After adding that variable the touchscreen starting to work. I think its because I used tslib from github . Thanks for you patience.

    Environment variables

    LD_LIBRARY_PATH=/usr/local/lib
    LD_PRELOAD=/usr/local/lib/libts-0.0.so.0
    QT_DEBUG_PLUGINS=1
    QT_PLUGIN_PATH=/usr/lib/plugins
    QT_QPA_FONTDIR=/usr/lib/fonts
    QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
    QT_QPA_PLATFORM=eglfs
    QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/plugins/platforms
    TSLIB_CALIBFILE=/home/pi/pointercal
    TSLIB_CONFFILE=/usr/local/etc/ts.conf
    TSLIB_CONSOLEDEVICE=none
    TSLIB_FBDEVICE=/dev/fb0
    TSLIB_PLUGINDIR=/usr/local/lib/ts
    TSLIB_TSDEVICE=/dev/input/event0
    TSLIB_TSEVENTTYPE=INPUT
    

  • Lifetime Qt Champion

    So you have it working now properly ?



  • @SGaist

    Well, I tought it works completely but there is one problem. When I push on the MouseArea the cursor is going to that position where I push but most of the time there is not a onclicked event triggered. When I push multiple times on the mousearea sometime the onclick event will be triggered, maybe 1 out of 10 á 15 times.

    I have connected the touchscreen to a Windows machine en every push on the screen is triggered. This is why I thing that there is something wrong with my tslib configuration.

    Can you help me with this problem?


  • Lifetime Qt Champion

    Did you run ts_calibrate ?



  • Yes, and it works fine. I also got a pointercal file. And ts_test works also. Maybe the debug output is usefull.

    
    QML debugging is enabled. Only use this in a safe environment.
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/test2/bin" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/test2/bin/test2"
    "Plugin verification data mismatch in '/opt/test2/bin/test2'" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqeglfs.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "className": "QEglFSIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimal.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "className": "QMinimalEglIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/test2/bin/platforms" ...
    loaded library "/usr/local/qt5pi/plugins/platforms/libqeglfs.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/egldeviceintegrations" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/egldeviceintegrations/libqeglfs-brcm-integration.so"
    Found metadata in lib /usr/local/qt5pi/plugins/egldeviceintegrations/libqeglfs-brcm-integration.so, metadata=
    {
        "IID": "org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5",
        "MetaData": {
            "Keys": [
                "eglfs_brcm"
            ]
        },
        "className": "QEglFSBrcmIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("eglfs_brcm")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/egldeviceintegrations/libqeglfs-kms-integration.so"
    Found metadata in lib /usr/local/qt5pi/plugins/egldeviceintegrations/libqeglfs-kms-integration.so, metadata=
    {
        "IID": "org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5",
        "MetaData": {
            "Keys": [
                "eglfs_kms"
            ]
        },
        "className": "QEglFSKmsIntegrationPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("eglfs_kms")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/test2/bin/egldeviceintegrations" ...
    loaded library "/usr/local/qt5pi/plugins/egldeviceintegrations/libqeglfs-brcm-integration.so"
    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/generic" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqevdevkeyboardplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqevdevkeyboardplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "EvdevKeyboard"
            ]
        },
        "className": "QEvdevKeyboardPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("evdevkeyboard")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqevdevmouseplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqevdevmouseplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "EvdevMouse"
            ]
        },
        "className": "QEvdevMousePlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("evdevmouse")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqevdevtabletplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqevdevtabletplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "EvdevTablet"
            ]
        },
        "className": "QEvdevTabletPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("evdevtablet")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqevdevtouchplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqevdevtouchplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "EvdevTouch"
            ]
        },
        "className": "QEvdevTouchScreenPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("evdevtouch")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqlibinputplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqlibinputplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "libinput"
            ]
        },
        "className": "QLibInputPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("libinput")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqtslibplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqtslibplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "Tslib",
                "TslibRaw"
            ]
        },
        "className": "QTsLibPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("tslib", "tslibraw")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/generic/libqtuiotouchplugin.so"
    Found metadata in lib /usr/local/qt5pi/plugins/generic/libqtuiotouchplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
            "Keys": [
                "TuioTouch"
            ]
        },
        "className": "QTuioTouchPlugin",
        "debug": false,
        "version": 329218
    }
    
    
    Got keys from plugin meta data ("tuiotouch")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/test2/bin/generic" ...
    loaded library "/usr/local/qt5pi/plugins/generic/libqtslibplugin.so"
    Found metadata in lib /usr/local/qt5pi/qml/QtQuick.2/libqtquick2plugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "MetaData": {
        },
        "className": "QtQuick2Plugin",
        "debug": false,
        "uri": [
            "QtQuick.2"
        ],
        "version": 329218
    }
    
    
    loaded library "/usr/local/qt5pi/qml/QtQuick.2/libqtquick2plugin.so"
    Found metadata in lib /usr/local/qt5pi/qml/QtQuick/Window.2/libwindowplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "MetaData": {
        },
        "className": "QtQuick2WindowPlugin",
        "debug": false,
        "uri": [
            "QtQuick.Window.2"
        ],
        "version": 329218
    }
    
    
    loaded library "/usr/local/qt5pi/qml/QtQuick/Window.2/libwindowplugin.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/test2/bin/accessible" ...
    User requested stop. Shutting down...
    Application finished with exit code 1.
    

  • Lifetime Qt Champion

    What parameter are you passing to your application ?



  • @SGaist

    LD_LIBRARY_PATH=/usr/local/lib
    QT_DEBUG_PLUGINS=1
    QT_PLUGIN_PATH=/usr/lib/qt5pi/plugins
    QT_QPA_EGLFS_HIDECURSOR=1
    QT_QPA_FB_DISABLE_INPUT=1
    QT_QPA_FONTDIR=/usr/lib/fonts
    QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
    QT_QPA_PLATFORM=eglfs
    QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt5pi/plugins/platforms
    TSLIB_CALIBFILE=/usr/local/etc/pointercal
    TSLIB_CONFFILE=/usr/local/etc/ts.conf
    TSLIB_CONSOLEDEVICE=none
    TSLIB_FBDEVICE=/dev/fb0
    TSLIB_PLUGINDIR=/usr/local/lib/ts
    TSLIB_TSDEVICE=/dev/input/event0
    TSLIB_TSEVENTTYPE=INPUT
    

    This are all the environment variable. Arguments field is empty.

    When i insert a USB mouse into the raspberry the mouse works directly and every mouseclick is triggered



  • [edit]

    Adding one more variable did the trick.

    QT_QPA_EGLFS_DISABLE_INPUT=1
    

    Thank you for your help. It now works totally fine. Topic can be set as Solved


  • Lifetime Qt Champion

    Great !

    Thanks for sharing your findings !

    You can mark it as solved :) Use the "Topic Tool" button and change the type of the thread to a question, then you'll be able to mark it as solved :)



  • I just started from scratch with my raspberry pi and ubuntu installation. I first installed my raspberry pi with tslib from kergoth. After that I followed the cross compile tutorial RaspberryPi2EGLFS. When I was done I opened my QT project and tried to run the project, but now I get a segmentation fault error. Could some tell me what's wrong?

    Application Output in QT Creator

    Got keys from plugin meta data ("tuiotouch")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Test/bin/generic" ...
    loaded library "/usr/local/qt5pi/plugins/generic/libqtslibplugin.so"
    bash: line 1: 13629 Segmentation fault      DISPLAY=':0.0' LD_LIBRARY_PATH='/usr/local/lib' QT_DEBUG_PLUGINS='1' QT_PLUGIN_PATH='/usr/lib/qt5pi/plugins' QT_QPA_EGLFS_DISABLE_INPUT='1' QT_QPA_EGLFS_HIDECURSOR='0' QT_QPA_FB_TSLIB='1' QT_QPA_FONTDIR='/usr/lib/fonts' QT_QPA_GENERIC_PLUGINS='tslib:/dev/input/event0' QT_QPA_PLATFORM='eglfs' QT_QPA_PLATFORM_PLUGIN_PATH='/usr/lib/qt5pi/plugins/platforms' TSLIB_CALIBFILE='/usr/local/etc/pointercal' TSLIB_CONFFILE='/usr/local/etc/ts.conf' TSLIB_CONSOLEDEVICE='none' TSLIB_FBDEVICE='/dev/fb0' TSLIB_PLUGINDIR='/usr/local/lib/ts' TSLIB_TSDEVICE='/dev/input/event0' TSLIB_TSEVENTTYPE='INPUT' WIRINGPI_GPIOMEM='1' /opt/Test/bin/Test
    

  • Lifetime Qt Champion

    Start it with the debugger then you'll be able to get a stack trace.



  • Sorry for reopening this issue. It seems to be that i forgot a crucial part of my notes for reinstalling my setup. After following the steps on this page I've got it working again. Thanks for replying again.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.