Search by Tags

Touch Screen Calibration (Linux)

 
Compare with Revision

Subscribe for this article updates

Introduction

Touch screen under Embedded Linux requires a kernel module that receives the hardware signals and exports it as an input device to be read in user space by a library.


As an example, if you are using Boot to Qt image with Capacitive Touch Display 7" Parallel, your setup will look like the following fluxogram


On the other hand, if you are using Ångström X11 image with Resistive Touch Display 7" Parallel, your setup will look like the following fluxogram


In this article, touch screen calibration will be discussed applied to different libraries and its methods to correctly calibrate your touchscreen display.

Input Libraries

Touch screen calibration concerning the input libraries is provided in this section.

libinput

As mentioned in libinput's wiki:

libinput is a library to handle input devices in Wayland compositors and to provide a generic X.Org input driver. It provides device detection, device handling, input device event processing and abstraction so minimize the amount of custom input code compositors need to provide the common set of functionality that users expect.

Concerning Toradex offerings, Libinput is used by:

Calibration

For static configuration via udev, one can set the LIBINPUT_CALIBRATION_MATRIX udev property as a environment variable with the following command line.

echo 'ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0"' > /etc/udev/rules.d/libinput.rules  # default matrix

Note: A common error is having Y axis inverted. To reverse it, use the LIBINPUT_CALIBRATION_MATRIX "1 0 0 0 -1 1".

Further information on the LIBINPUT_CALIBRATION_MATRIX, please access the documentation.

Display Servers and Frameworks

Touch screen calibration concerning display servers (such as Xorg and Wayland) or standalone frameworks (such as Qt) is provided in this section.

Qt

The Qt framework supports different input methods. Regardless of this article's information, please also consult the official Qt documentation.

Boot to Qt

The Qt for Device Creation demo image uses libinput, therefore please refer to the previous libinput section for touchscreen calibration information.