Torizon OS: Qt6 + touchscreen event

Hello,

I working with a Carrier board Mallow + imx8mp verdin module. I have a Riverdi touchscreen of 12’’ connected to it. I want to interact with a QT application with the touch of the touchscreen.

I have problem to get the touch working with qt6 application. I cannot interact with the application with the touch, but with the mouse is working.

But I can see the touches event in the container with evtest. If I put the application in “Windowed” mode, I can move the application with the touch but I cannot interact with it
I did a test with torizon/chromium:3 and the touch works well.

Do you have any idea what I am missing to interact with my Qt application with the touch ?

I use Torizon 6.7.0 with the Linux toradex_5.15-2.2.x-imx as a baseline for the device tree.

For qt6, I created a container from the visual studio template c++/Qt 6. I have juste added some button using the “onClicked” events on Qt .

I have attached, the tcbuild, dockerfile, docker-compose and device tree that I use.

Dockerfile (4.8 KB)
Riverdi_12_inch_touch2.dtbo (2.6 KB)
docker-compose.yml (1.5 KB)
tcbuild.yaml (1.5 KB)

Best regards,
David

Software summary
------------------------------------------------------------
Bootloader: U-Boot
Kernel version: 5.15.148-6.7.0+git.bfdbfb2c85fb #1-TorizonCore SMP PREEMPT Thu Jun 20 15:59:41 UTC 2024
Kernel command line: root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/a7d627eeb9c81a3b5c1b67800af2d176d70d20b5a3fd39d65304992d9ce19eef/0
Distro name: NAME=“TorizonCore”
Distro version: VERSION_ID=6.7.0-build.18
Distro variant: VARIANT=“Docker”
Hostname: verdin-imx8mp-15336641
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model: Toradex Verdin iMX8M Plus WB on Mallow Board
Toradex version: 0064 V1.1A
Serial number: 15336641
Processor arch: aarch64
------------------------------------------------------------

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

It sounds like you’re encountering an issue where touch events are detected by the system but not by your Qt6 application. Let’s go through some steps to address this:

  1. Verify Touch Calibration: Use the weston-touch-calibrator to ensure your touch input is correctly calibrated. For the Verdin iMX8M Plus, you can run the following command:

    docker run -ti --rm --privileged -v /dev:/dev -v /run/udev/:/run/udev/ -v /etc/udev/rules.d:/etc/udev/rules.d torizon/weston-touch-calibrator:$CT_TAG_WESTON_TOUCH_CALIBRATOR
    

    This will help align the touch input with the display.

  2. Check Calibration Matrix: After calibration, confirm that the calibration matrix is applied by running:

    udevadm info /dev/input/event1
    
  3. Ensure Proper Permissions: Since your Qt6 application works with mouse input but not touch, ensure your Qt container has the necessary device permissions and mounts. The Weston container requires these permissions:

    --cap-add CAP_SYS_TTY_CONFIG \
    -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
    --device-cgroup-rule="c 4:* rmw" --device-cgroup-rule="c 253:* rmw"
    

    Make sure these permissions are also applied to your Qt6 container. You may need to modify your docker-compose.yml to include these settings.

Since touch events work in Chromium, it indicates that the system captures them correctly, but there might be a configuration issue specific to your Qt6 container.

I hope this helps resolve the issue!

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

https://developer.toradex.com/torizon/application-development/use-cases/multimedia/touch-screen-calibration-torizon/#advanced-background

https://developer.toradex.com/torizon/application-development/use-cases/multimedia/setting-up-displays-with-torizon/#configure-toradex-displays.

Hello @davidcosta,

Can you send me the list of events that you get with the evtest container?

I think you may be missing some important events.

Another point which may be relevant is the event handling on Qt.
I am not sure if onClicked applies for touch events, so I recommend checking the Qt documentation on that.

Best Regards,
Bruno

Hello,

thanks for your answer, after a lot of testing. I could get it working.

I migrated from torizon OS 6.7.0. to 7.1.0. I have also changed the weston version from weston-vivante:3.4.0 to weston-imx8:4.4

I know it works. I don’t know where was the issue exactly, torizon OS or weston version.

Otherwise, the logs from the evtest I had:

Event: time 1651168772.855201, -------------- SYN_REPORT ------------

Event: time 1651168772.908712, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 2368

Event: time 1651168772.908712, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 1156

Event: time 1651168772.908712, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 305

Event: time 1651168772.908712, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1

Event: time 1651168772.908712, type 3 (EV_ABS), code 0 (ABS_X), value 1156

Event: time 1651168772.908712, type 3 (EV_ABS), code 1 (ABS_Y), value 305

Event: time 1651168772.908712, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 10

Hello @davidcosta,

Thanks for the update.
It is good to know that you were able to get this resolved.

Best Regards,
Bruno