Search by Tags

Touch Screen Calibration (Linux)


Article updated at 29 Jun 2020
Compare with Revision

Subscribe for this article updates


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.


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:


For static configuration via udev, one can set the LIBINPUT_CALIBRATION_MATRIX udev property as a environment variable with the following udev rule:


You can use the following command line examples to create a file with the udev rule.

Default matrix:

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

Invert Y axis only:

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

Invert X axis only:

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

Invert X and Y axis:

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

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.


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.


Torizon uses Weston and Libinput. Toradex provides a container for touch screen calibration. For more details read Touch Screen Calibration (Torizon).