Touch screen axes inverted on VF61

I’m using a VF61 module with Iris carrier board and a EDT 5.7 resistive touch screen. The software stack I’m using on the board is boo2qt 5.7 for Colibri-VF. Right now everything is find except the touch screen axes (both X and Y) are inverted, it feels like the touch coordinates are 180 degreen rotated (top-left corner is bottom-right, top-right is bottom-left). I used the ts_calibrate tool to re-calibrate the touchscreen and it doesn’t help.

A wired thing is that when I switched to a VF50 module (only change the module, exactly the same touch screen, carrier board and even same SD card with same system on it), the touch screen coordinates are just fine. The question is how can I fix this?

Thanks in advance!

Can you provide us details about the kernel version used on boot2qt?
Quickly checked on our prebuild Linux image with ts_calibrate and ts_test, it is working as expected.

Hi Chaoyong,

The VF61 and VF50 use different touch controller, and especially I think the VF61 has inverted axes by default. ts_calibrate should solve the problem, however you need to make sure that your Qt application is making use of libts. I ended up with the following lines to /etc/appcontroller.conf:

env=QT_QPA_GENERIC_PLUGINS=tslib
env=QT_QPA_EGLFS_TSLIB=1
env=TSLIB_TSDEVICE=/dev/input/touchscreen0
env=TSLIB_CALIBFILE=/etc/pointercal

Hi, Thanks a lot for your help. I’ve added these lines to appcontroller.conf and did the calibration with ts_calibrate, now the touch behavior is a bit strange. When I touch somewhere (e.g. top-left corner), it seems like both top-left corner and bottom-right corner are touched, or it seems like random, sometimes it shows top-left corner is touched, sometimes shows the bottom-right corner is touched. It gives me a feeling that my application get 2 sets of events, one set of event is calibrated, one set of event is not calibrated. Do you have any idea what could go wrong?

Thanks a lot for the reply. I’m also using the pre-build image came with boot2qt 5.7. Here is the kernel version:

Linux b2qt-colibri-vf 4.1.15-v2.5b3+ge6d111c #1 Tue Mar 15 18:16:05 EET 2016 armv7l GNU/Linux

I finally get it work. With some help from Qt company, I understand that the issue is caused by 2 different events coming from both tslib and Qt’s evdev. So in addition to the settings above one more line need to be added into /etc/appcontroller.conf to disable the input. In this case (VF61) it is:

env=QT_QPA_FB_DISABLE_INPUT=1

After this, the touch screen works perfectly!

Thanks a lot for the help from all of you guys!

Nice! to hear that, thanks! for letting us know the status.

I have similar issue on my colibri imx6 module with boot2qt 5.7. My touch screen x axis is inverted and y axis is not.
My appcontroller.conf was like this:
env=FB_MULTI_BUFFER=2
env=QML2_IMPORT_PATH=/data/user/qt/qmlplugins
env=QT_IM_MODULE=qtvirtualkeyboard
env=QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0
env=QT_GSTREAMER_CAMERABIN_VIDEOSRC=mxc_v4l2=imxv4l2videosrc,v4l2src
env=QT_QUICK_CONTROLS_STYLE=Flat
env=XDG_RUNTIME_DIR=/tmp
base=linux
platform=colibri-imx6

With this configuration, I had to click on x axis opposite position of a button on screen to make the button respond.

I added the following those variables mentioned in the posts to the configuration file :
env=QT_QPA_GENERIC_PLUGINS=tslib
env=QT_QPA_EGLFS_TSLIB=1
env=TSLIB_TSDEVICE=/dev/input/touchscreen0
env=TSLIB_CALIBFILE=/etc/pointercal
env=QT_QPA_FB_DISABLE_INPUT=1

The x axis is still inverted like before. But now if I double click on the button, it will also respond. It seems to me that double clicks make the x coordinates double inverted ( same as no inversion) then the button responds.

Here is my kernel version:
Linux b2qt-colibri-imx6 3.14.52-00011-g9f2723e #1 SMP Tue Aug 2 09:03:31 MDT 2016 armv7l GNU/Linux

How do I fix this issue? .

When using TSLib, there is no explicit way to invert the touch screens X-axis. However, after using ts_calibrate tslib should invert the X axis by using the pointercal values. Did you run ts_calibrate before using the mentioned /etc/appcontroller.conf settings?

Yes, I ran ts_calibrate before and after appcontroller.conf was modified. I also tried to delete /etc/pointcal file before running ts_calibrate. Nothing helps.

I had the same issue running a qt4e image. Based at the build: bitbake qt4e-demo-image.

The funny thing was that when I started the application by myself works fine, and when start automatically after boor using systemd, than I had all touch input inverted.

I solve this issue by changing the file: /lib/systemd/system/qtdemo.service

[Unit]
Description=Start Qt4 Embedded demo application

[Service]
Type=simple
ExecStart=/home/root/init.sh

[Install]
WantedBy=graphical.target

Than I created the start-up script: /home/root/init.sh

#!/bin/sh

export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_TSDEVICE=/dev/input/touchscreen0
export QT_QPA_FB_DISABLE_INPUT=1
export QT_QPA_EGLFS_TSLIB=1
export QT_QPA_GENERIC_PLUGINS=tslib

/usr/bin/ts_calibrate
/usr/bin/qtdemoE -qws

Change it to be executable:

chmod +x /home/root/init.sh

Than just restart every thing:

systemctl stop qtdemo.service
systemctl disable qtdemo.service
systemctl enable qtdemo.service
systemctl start qtdemo.service

Remember, that was for QT4 example. For b2QT I solved in another way.

I also tried the b2qt image.

After build the: bitbake b2qt-embedded-qt5-image

I had the same inverted touchscreen issue.

In my case, I saw that the appcontroller.conf wasn’t that friendly. So I solved this issue removing some environments from there and adding at somewhere else.

In the end my files finished like this:

/etc/appcontroller.conf

base=linux
platform=colibri-vf

/lib/systemd/system/qtlauncher.service

[Unit]
Description=B2Qt Launcher Demo
After=systemd-user-sessions.service
ConditionPathExists=!/usr/bin/b2qt

[Service]
ExecStart=-/usr/bin/appcontroller /usr/bin/qtlauncher --applications-root /data/user/qt
EnvironmentFile=/etc/envqt
[Install]
WantedBy=multi-user.target

/etc/envqt

#APPCONTROLER
QMLSCENE_DEVICE=softwarecontext
QT_QPA_PLATFORM=linuxfb
QSG_RENDER_LOOP=basic
QML2_IMPORT_PATH=/data/user/qt/qmlplugins
QT_IM_MODULE=qtvirtualkeyboard
QT_QUICK_CONTROLS_STYLE=Flat
XDG_RUNTIME_DIR=/tmp

#New one
QT_QPA_EGLFS_DISABLE_INPUT=1
QT_QPA_FB_DISABLE_INPUT=1
QT_QPA_FB_TSLIB=1

#Some other else
QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
TSLIB_CALIBFILE=/etc/pointercal
TSLIB_CONFFILE=/etc/ts.conf
TSLIB_TSEVENTTYPE=INPUT
TSLIB_TSDEVICE=/dev/input/touchscreen0
QT_QPA_FB_DISABLE_INPUT=1
QT_QPA_EGLFS_TSLIB=1
QT_QPA_GENERIC_PLUGINS=tslib

I din’t have time to understand which of the environments made the difference for me, and than I just add all of then.

It works good for me, you can check the b2qt performance at the link below: