Touch Screen Functionality not working in QT Application in Debian Container

Hi,

I am using Torizon OS with Debian Container. Touch Screen Functionality working in debian-kiosk-mode-browser but same is not working in debian-qt5-wayland.

How to enable the touch screen functionality? Kindly Help.

Regards,

Pradeep Pol

Greetings,

Could you tell me more about your use-case with the Debian-Qt5-Wayland container?
What were you doing in this container in order to test touch screen functionality?
What touchscreen are you using as well?

Best Regards,
Jeremias

Hi @jeremias.tx ,

Thanks for the reply.

I am running QT Application in Debian Qt5 Container with Touch Screen Hardware.
I have implemented Virtual Keyboard in this Application and I use it for Alphaneumeric entries.

We are using 5.3 inch touch screen and I have tried it with torizon/arm32v7-debian-weston-touch-calibrator container to check the touch screen functionality and I am able to do the touch calibration without any issue. But same touch screen is not working with Debian Qt5 Container.

Debian container detects touchscreen.

Regards,
Pradeep Pol

Alright since the Debian container detects your touchscreen fine and you were able to calibrate it, I can assume what the possible problem might be. My first guess is that perhaps when you initialize the Qt container perhaps you’re not binding in the touch events properly. Could you share the full command you’re using to start the Qt container.

As for suggestions perhaps you need to make sure you’re bind-mounting /dev into the Qt container. Another idea is perhaps there is some kind of permissions issue. Maybe try running the container with full privileges to test this.

Finally as a test I got a docker-compose.yml file that launches a bunch of test Qt apps last time I checked these worked with a touch screen I had:

version: "3"
services:
  weston:
    image: 'torizon/arm32v7-debian-weston:buster'
    container_name: 'weston'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
      - '/run/udev:/run/udev'

  calc:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-calc'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/calculator/calculator'

  clock:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-clock'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/shapedclock/shapedclock'

  hello:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-hello'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/opengl/hellowindow/hellowindow'

  bookmark:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-bookmark'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/xml/saxbookmarks/saxbookmarks'

  aster:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-aster'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/qpa/qrasterwindow/qrasterwindow'

  textures:
    image: 'torizon/arm32v7-debian-qt5-wayland:buster'
    container_name: 'qt-textures'
    privileged: true
    tty: true
    volumes:
      - '/tmp:/tmp'
      - '/dev:/dev'
    depends_on:
      - weston
    command: '/usr/lib/arm-linux-gnueabihf/qt5/examples/opengl/textures/textures'

Best Regards,
Jeremias

Hi @jeremias.tx,

I am using following docker run command

docker run -e DBUS_SESSION_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
–rm -it --privileged --name=qt5 -v /var/run/dbus:/var/run/dbus -v /tmp:/tmp -v /dev:/dev
torizon/arm32v7-debian-qt5-wayland-examples:buster

Please suggest if any changes are required.

Regards,
Pradeep Pol

Did you try the docker-compose I sent you? Were you able to move the Qt-based graphical elements around created from those containers?

Nothing looks out of place with your docker run command and with my touchscreen, touch seems to work okay. What interface does your display use to transmit touch event? (I2C, USB, etc.)

Best Regards,
Jeremias

Hi @jeremias.tx,

Indian toradex support told me to use touch event translator by stefan-eichenberger in qt application and now touch screen working fine.

He told me that same problem they are able to simulate on their side and solution will be implemented in next version of Torizon. For now we have this solution.

This is just for information if anyone is facing this issue.
Thanks for the support.

Note: We are using imx6dl 512MB 1.1A and viola plus v1.2B.

Regards,
Pradeep Pol

Glad you were able to resolve this!

I am facing the same issue, what is this “touch event translator” that fixes the problem? Where can I find it?

Hi @Daniele

I uploaded the example to this repository:

Please note that it’s only a proof of concept so maybe you have to change some parts:

Regards,
Stefan

Hi @stefan_e.tx,
thanks for sharing the code, now I managed to make it work. Do you know why this problem happens? Is it a qt/wayland or torizon issue? Can we expect this to be fixed eventually by updating to a new version (torizon 5.0.0)?

Hi @Daniele

We know what the issue is. The problem is that wayland has a protocol for touch events. Unfortunately, it is not possible for weston to translate the touch into mouse events yet and this is why Qt then only receives touch events. Qt Quick copes well with this by translating the touch to mouse events on its own but not QtWidgets.

We are thinking about patching weston to add the translation there but currently it is not on our top priorities and therefore not scheduled yet.

Regards,
Stefan

Hi @Daniele @stefan_e.tx @jeremias.tx,

Update:
Touch screen functionality within Qt Application is working in TorizonCore 5.1.0 (5.1.0-devel-202011) image with Debian Bullseye container (torizon/qt5-wayland-examples:2).

Touch was not working with Torizon 4.0.0 and 5.0.0 within Qt Application.

Thanks & Regards,
Pradeep Pol

Thank you for the update, glad it works for you now in the latest version.