[Solved] Proper configuration of capacitive touchscreen with Qt5 and EGLFS

  • Hello,

    I am running Qt5.3 and deploying my app to the remote imx6 device (Wandboard). The app is invoked using -platform EGLFS.

    Based on this page:
    "When no windowing system is present, the mouse, keyboard and touch input are read directly via evdev or using helper libraries like tslib..."
    "For some resistive, single-touch touch screens it may be necessary to fall back to using tslib instead of relying on the Linux multitouch protocol and the event devices. For modern touch screens this should not be necessary..."

    My question is:
    What is the proper way of setting up capacitive touchscreen with Qt5? The above page seems to suggest tslib is not the right way to go and should only be used in some isolated cases for resistive touchscreens.

    When I run my app without tslib plugin, the touchscreen works, but the touchscreen calibration (done via ts_calibrate) is not picked up and screen touches are shifted.
    Ts_test works correctly, no shift."

    evdev prints wrong coordinates on the console (shifted), but I think this is normal since it returns raw data.

    I read that xinput is the utility used to calibrate evdev but this utility seems to be part of X11 windowing system which is not built when building Qt5 with EGLFS.

    Any ideas on how to calibrate touchscreen in this mode? Or is tslib the only way?

  • Hi. If you're running your app without tslib, ts_calibrate will have no effect, obviously. tslib might not be the recommended way, but sometimes it's the only way to go, even for capacitive screens. In your case, you should check your driver first. Maybe there's some .conf file or parameter you're not aware of, with which you can fix this shifting.

  • Driver was the the right way to go, thanks for pointing this out.

    It turns out that the driver had a calibration method built in, but the transform matrix was not set to change the coordinates. I calculated the new matrix values based on the max coordinates displayed by evtest and the actual coordinates of the framebuffer, plugged them in to the driver code, compiled and ... it works!. Evtest displays correct coordinates and Qt works correctly with no tslib.
    I don't like the fact that calibration matrix is hardcoded into the driver, but I consider fixing this an extracredit activity to be done sometime in the future.