3

I have finally got the adafruit 7" screen working with the X11 interface (startx) and it now seems to move the mouse accurately. However, I have a qt 5.5 app I wrote which works fine with a mouse but does not move the pointer correctly with the touchscreen (AR1100) supplied with the adafruit screen.

qt 5.5 was compiled natively on the PI 2 and the touchscreen is clearly working in that I can move the pointer using my finger.

On startup of the app I get "Unable to query physical screen size, defaulting to 100 dpi" followed by "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_PHYSICAL_HEIGHT". I have tried setting these up in the environment but it does not seem to make any difference and I still get the same error message.

If I start with my finger or stylus on the left hand side of the screen and move straight across the screen from left to right, the pointer does not move for about the first inch of movement of the stylus but then moves much faster than the stylus and quickly overtakes it and ends up on the right hand side of the screen when the stylus has only moved two inches or so across. This is completely repeatable.

It is almost as if the touchscreen is working on a different screen size to the actual screen. evtest gives the following on startup

Input device ID: bus 0x3 vendor 0x4d8 product 0xc02 version 0x111
Input device name: "Microchip Technology Inc. AR1100 HID-MOUSE"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event code 272 (BTN_LEFT)
  Event code 273 (BTN_RIGHT)
  Event code 274 (BTN_MIDDLE)
  Event type 3 (EV_ABS)
  Event code 0 (ABS_X)
  Value      0
  Min        0
  Max     4095
  Event code 1 (ABS_Y)
  Value    148
  Min        0
  Max     4095
  Event type 4 (EV_MSC)
  Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)

and then

Event: time 1441177838.274840, type 3 (EV_ABS), code 1 (ABS_Y), value 145
Event: time 1441177838.274840, -------------- SYN_REPORT ------------
Event: time 1441177838.290826, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1441177838.290826, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1441177838.290826, -------------- SYN_REPORT ------------
Event: time 1441177838.322824, type 3 (EV_ABS), code 1 (ABS_Y), value 135
Event: time 1441177838.322824, -------------- SYN_REPORT ------------
Event: time 1441177838.354828, type 3 (EV_ABS), code 1 (ABS_Y), value 127
Event: time 1441177838.354828, -------------- SYN_REPORT ------------      
Event: time 1441177838.418842, type 3 (EV_ABS), code 1 (ABS_Y), value 119
Event: time 1441177838.418842, -------------- SYN_REPORT ------------
Event: time 1441177838.450841, type 3 (EV_ABS), code 1 (ABS_Y), value 114
Event: time 1441177838.450841, -------------- SYN_REPORT ------------
Event: time 1441177838.898903, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1441177838.898903, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1441177838.898903, -------------- SYN_REPORT ------------

when I touch the top left of the screen.

I have very little experience on QT, so any help would be gratefully received as I have been going round in circles for weeks.

2

Your natively compiled app is running on EGL instead of X (QT_QPA_EGLFS_PHYSICAL_WIDTH is used by EGLFS, a qt plugin for EGL). When you run a QT app in X, X passes input events to your app. On EGL qt works a little differently and interfaces directly with evdev. Its possible you need to configure it before it works properly.

Personally I've been trying to get a QT app running without X (http://doc.qt.io/qt-5/embedded-linux.html). I'm hitting the same error you are hitting and I was hoping to find a quick config/environment variable fix.

If you are fine running your app on top of X, I would suggest you keep doing that.

1

I had exactly the same happening, but I managed to fix it. I now have a Qt 5.5 app running straight from command line with correct touch screen. Hope this helps you guys.

I have the same Adafruit screen with the AR1100 board in between. Problem is that the AR1100 sends mouse events instead of touch events.

Following solution worked for me and turned out as a fairly easy solution, after a lot of trial and error... ;)

In my .bashrc I've added the following exports

# hides mouse cursor and disables EGL input
# we can not use the built-in input handler because touch is not mouse, lol
export QT_QPA_EGLFS_HIDECURSOR=1
export QT_QPA_EGLFS_DISABLE_INPUT=1

# export a generic plugin with the mouse, not evdevtouch!
# and tell it to use 'abs' (absolute values instead of relatives)
export QT_QPA_GENERIC_PLUGINS=evdevmouse:abs

# set physical display dimensions for proper font sizes etc.
# Qt should print a warning if this is necessary
export QT_QPA_EGLFS_PHYSICAL_WIDTH=154
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=86
export QT_QPA_EGLFS_WIDTH=800
export QT_QPA_EGLFS_HEIGHT=480

And voila, it works perfect now!

0

I also tried to use the AR1100 with QT, and did not get an out-of-the-box experience:)

I got it working simply using some commands on the commandline:

./qtapplication -plugin evdevmouse:/dev/input/event0:abs

This is basically the same as Jinxvar said, but for some reason I had to explicitly also set the device for the evdevmouse plugin.

(I still use the environment variables QT_QPA_EGLFS_PHYSICAL_WIDTH etc to avoid the warning, like Jinxvar)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.