Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Resolved] Touch Screen does not work for Qt5.3.2 app
QtWS25 Last Chance

[Resolved] Touch Screen does not work for Qt5.3.2 app

Scheduled Pinned Locked Moved Mobile and Embedded
14 Posts 2 Posters 7.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stuartx
    wrote on last edited by stuartx
    #1

    Hi, I am implement application on an ARM based board, which has a touch screen LCD. When using Qt4.8.6, the touch screen works fine. Then I ported the application to Qt5.3.2, the touch screen does not work anymore. On the system, ts_calibtate and ts_test work properly. So the touch screen does function in system level.

    For building Qt5.3.2 lib, my configure parameters are as following:
    export QT_QPA_GENERIC_PLUGINS=evdevkeyboard,evdevmouse,evdevtouch
    export PKG_CONFIG_SYSROOT_DIR=${QT_DIR}/qtbase/lib/pkgconfig
    export PKG_CONFIG_LIBDIR=${QT_DIR}/qtbase/lib
    ./configure -opensource -confirm-license -xplatform linux-arm-v5t_le-gnueabi-g++ -device-option CROSS_COMPILE=/opt/arm-mvl/pro/devkit/arm/v5t_le/armv5tl-linux-gnueabi/bin/ -prefix ${QT_INSTALL} -extprefix ${QT_INSTALL} -no-c++11 -no-xcb -no-xcb-xlib -opengl -shared -tslib -no-sse2 -no-glib -no-cups -no-largefile -no-openssl -no-gtkstyle -linuxfb -directfb -verbose

    The environment parameters set set as following:
    TSLIB_CONFFILE=/etc/ts.conf
    TSLIB_DEVICE=/dev/input/event0
    QT_QPA_FONTDIR=/usr/lib/fonts
    QT_QPA_PLATFORM=linuxfb
    QT_PLUGIN_PATH=/usr/plugins
    TSLIB_CALIBFILE=/etc/pointercal
    TSLIB_CONFFILE=/etc/ts.conf
    TSLIB_PLUGINDIR=/usr/lib/ts

    I also tried to use the commandline input "-plugin tslib" and "-plugin tslib:/dev/input/event0", I still can not bring the touch screen work in Qt application.

    When I start the application, I also see the following error message in the console, but I don't think it is related to the TS function:

    QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
    QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed

    Currently I am blocked by this issue. Any help is greatly appreciated.

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should run your application with the QT_DEBUG_PLUGINS environment variable set to 1. That should show you what is failing.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stuartx
        wrote on last edited by
        #3

        Hi SGaist:

        The following lines are debug output. The tslib plugin looks like loaded. Please let me know is I missed anything. Thanks.

        QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
        QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
        QFactoryLoader::QFactoryLoader() checking directory path "/mnt/mmc/platforms" ...
        QFactoryLoader::QFactoryLoader() checking directory path "/usr/plugins/platforms" ...
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/platforms/libqlinuxfb.so"
        Found metadata in lib /usr/plugins/platforms/libqlinuxfb.so, metadata=
        {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
        "MetaData": {
        "Keys": [
        "linuxfb"
        ]
        },
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("linuxfb")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/platforms/libqminimal.so"
        Found metadata in lib /usr/plugins/platforms/libqminimal.so, metadata=
        {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
        "MetaData": {
        "Keys": [
        "minimal"
        ]
        },
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("minimal")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/platforms/libqoffscreen.so"
        Found metadata in lib /usr/plugins/platforms/libqoffscreen.so, metadata=
        {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
        "MetaData": {
        "Keys": [
        "offscreen"
        ]
        },
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("offscreen")
        loaded library "/usr/plugins/platforms/libqlinuxfb.so"
        QFactoryLoader::QFactoryLoader() checking directory path "/mnt/mmc/platforminputcontexts" ...
        QFactoryLoader::QFactoryLoader() checking directory path "/usr/plugins/platforminputcontexts" ...
        QFactoryLoader::QFactoryLoader() checking directory path "/mnt/mmc/generic" ...
        QFactoryLoader::QFactoryLoader() checking directory path "/usr/plugins/generic" ...
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/generic/libqevdevkeyboardplugin.so"
        Found metadata in lib /usr/plugins/generic/libqevdevkeyboardplugin.so, metadata=
        {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
        "Keys": [
        "EvdevKeyboard"
        ]
        },
        "className": "QEvdevKeyboardPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("evdevkeyboard")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/generic/libqevdevmouseplugin.so"
        Found metadata in lib /usr/plugins/generic/libqevdevmouseplugin.so, metadata=
        {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface
        "MetaData": {
        "Keys": [
        "EvdevMouse"
        ]
        },
        "className": "QEvdevMousePlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("evdevmouse")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/generic/libqevdevtabletplugin.so"
        Found metadata in lib /usr/plugins/generic/libqevdevtabletplugin.so, metadata=
        {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
        "Keys": [
        "EvdevTablet"
        ]
        },
        "className": "QEvdevTabletPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("evdevtablet")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/generic/libqevdevtouchplugin.so"
        Found metadata in lib /usr/plugins/generic/libqevdevtouchplugin.so, metadata=
        {
        "IID": "org.qt-project.Qt.QGenericPluginFactor: {
        "Keys": [
        "EvdevTouch"
        ]
        },
        "className": "QEvdevTouchScreenPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("evdevtouch")
        QFactoryLoader::QFactoryLoader() looking at "/usr/plugins/generic/libqtslibplugin.so"
        Found metadata in lib /usr/plugins/generic/libqtslibplugin.so, metadata=
        {
        "IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
        "MetaData": {
        "Keys": [
        "Tslib",
        "TslibRaw"
        ]
        },
        "cl": "QTsLibPlugin",
        "debug": false,
        "version": 328450
        }

        Got keys from plugin meta data ("tslib", "tslibraw")
        QFactoryLoader::QFactoryLoader() checking directory path "/mnt/mmc/styles" ...
        QFactoryLoader::QFactoryLoader() checking directory path "/usr/plugins/styles" ...

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stuartx
          wrote on last edited by
          #4

          Any one can help?

          Based on the debug printout, can I say that I missed the styles plugin? If so, how can I get the plugin? I turned on -gtk-style, I still don't have the style plugin and I can not find style src directory.

          Any help is appreciated.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Is this what you got when calling your application with -plugin tslib ?

            By the way, your paths look a bit strange. How did you install Qt on your board ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stuartx
              wrote on last edited by
              #6

              Yes, I start the test program with "test -plugin tslib". I also set "TSLIB_TSDEVICE=/dev/input/event1".

              I installed Qt library in "/uisr/lib" and Qt plugins in "/usr/plugins". The QT_PLUGIN_PATH is set to "/usr/plugins".

              Thanks.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                That's a bit messy, you should install it in a dedicated subdir e.g. /usr/local/Qt5

                What do you get if you call ldd on the plugin ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  stuartx
                  wrote on last edited by
                  #8

                  Finally get the ldd utility work. Here is the output:

                  ./ldd /usr/plugins/generic/libqtslibplugin.so

                  @libts-0.0.so.0 => /usr/lib/libts-0.0.so.0 (0x4000e000)
                  libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x40018000)
                  libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x4052d000)
                  librt.so.1 => /lib/librt.so.1 (0x40b15000)
                  libdl.so.2 => /lib/libdl.so.2 (0x40b24000)
                  libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40b2f000)
                  libGL.so.1 => /usr/lib/libGL.so.1 (0x40b42000)
                  libOSMesa.so.7 => /usr/lib/libOSMesa.so.7 (0x40de3000)
                  libpthread.so.0 => /lib/libpthread.so.0 (0x40df6000)
                  libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40e16000)
                  libm.so.6 => /lib/libm.so.6 (0x40eea000)
                  libc.so.6 => /lib/libc.so.6 (0x40f95000)
                  libpng.so.3 => /usr/lib/libpng.so.3 (0x410ba000)
                  libz.so.1 => /usr/lib/libz.so.1 (0x410e4000)
                  /lib/ld-linux.so.3 (0x2a000000)
                  libX11.so.6 => /usr/lib/libX11.so.6 (0x410fe000)
                  libXext.so.6 => /usr/lib/libXext.so.6 (0x411c6000)@

                  ./ldd ./test-ts

                     @libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x40026000)
                      libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x40624000)
                      libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x40b39000)
                      librt.so.1 => /lib/librt.so.1 (0x41120000)
                      libdl.so.2 => /lib/libdl.so.2 (0x4112f000)
                      libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4113a000)
                      libGL.so.1 => /usr/lib/libGL.so.1 (0x4114d000)
                      libOSMesa.so.7 => /usr/lib/libOSMesa.so.7 (0x413ee000)
                      libpthread.so.0 => /lib/libpthread.so.0 (0x41401000)
                      libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x41420000)
                      libm.so.6 => /lib/libm.so.6 (0x414f4000)
                      libc.so.6 => /lib/libc.so.6 (0x4159f000)
                      libpng.so.3 => /usr/lib/libpng.so.3 (0x416c4000)
                      libz.so.1 => /usr/lib/libz.so.1 (0x416ee000)
                      /lib/ld-linux.so.3 (0x40000000)
                      libX11.so.6 => /usr/lib/libX11.so.6 (0x41707000)
                      libXext.so.6 => /usr/lib/libXext.so.6 (0x417cf000)@
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Looks good, did you check the rights on the device ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stuartx
                      wrote on last edited by
                      #10

                      ls -l /dev/input/*

                      crwxr-xr-x 1 root root 13, 64 Jul 8 2014 /dev/input/event0
                      lrwxrwxrwx 1 root root 17 Jun 7 15:28 /dev/input/event1 -> /dev/input/event0

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Are you running your software as root ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          stuartx
                          wrote on last edited by
                          #12

                          Yes, I run the test program "test-ts" as root.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            stuartx
                            wrote on last edited by stuartx
                            #13

                            We use the knobs example (located in Qt5.3.2-opensource/Examples/Qt-5.3/touch/knobs) as a test case to debug the touch screen problem. We found the following things:

                            Touchpad events from the tslib plugin are treated as mouse events, not touchpad events. Typically a touch action results in a Mouse Button press, possibly some Mouse Move events, and a Mouse Release event. (Qt events are defined in an enum in qtbase/src/corelib/kernel/coreevent.h)

                            I typically see event types 2, 3, 5 (MouseButtonPress, MouseButtonRelease and MouseMove) and 155, 156 and 157 (GraphicsSceneMouseMove, GraphicsSceneMousePress and GraphicsSceneMouseRelease). The Knobs event handler (knob.cpp: Knob::sceneEvent) is looking for event types 194, 195 and 196 (TouchBegin, TouchUpdate and TouchEnd)and will never respond to mouse events.

                            Knob is a class derived from QGraphicsItem. The knob is added into a QGraphicsScene object and this object provides event handling for the QGraphicsItem in its event() method.

                            I see the Type 155, 156 and 157 events in the event() method but only the 156 event shows up in the Knob::sceneEvent() function.

                            So in summary, I have three problems:

                            1. The tslib implementation is producing simulated mouse events for the touchpad but the Knob::sceneEvent() function is looking for Touchpad events.

                            2. Only one of the three events I see being generated are being reported to
                              Knob::sceneEvent().

                            3. In my original test case, there is no QGraphics / view involved. Why the MouseButtonPress event does not pass to the QPushButton objects?

                            We use linuxfb as QT_QPA_PLATFORM.

                            Any help is great appreciated.

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              stuartx
                              wrote on last edited by stuartx
                              #14

                              It turns out that the Mesa library was not built properly. Fixed.

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved