When using a DISPLAX touch controller on Linux, the touch orientation may need to be adjusted to match the display orientation. This can be achieved by creating a udev rule that applies a libinput calibration matrix automatically whenever the controller is connected.
This method is particularly useful for:
Rotated displays (Portrait mode)
Inverted touch coordinates
Locate the DISPLAX touch controller in the output and note its kernel path:
/dev/input/eventX
Replace X with the event number corresponding to your controller.
Next, retrieve the Vendor ID and Model ID:
udevadm info -q property -n /dev/input/eventX | grep -E "ID_VENDOR_ID|ID_MODEL_ID"
Example output:
ID_VENDOR_ID=14e1
ID_MODEL_ID=6000
Record both values, as they will be required when creating the rule.
libinput uses a calibration matrix to transform touch coordinates.
Select the matrix that matches your installation:
| Orientation | Matrix |
|---|---|
| Standard (Default) | 1 0 0 0 1 0 |
| Invert X-axis | -1 0 1 0 1 0 |
| Invert Y-axis | 1 0 0 0 -1 1 |
| Rotate 180° | -1 0 1 0 -1 1 |
| Rotate 90° Clockwise | 0 -1 1 1 0 0 |
| Rotate 90° Counter-Clockwise | 0 1 0 -1 0 1 |
Tip: If the touch orientation is incorrect after applying a matrix, simply modify the rule and test another orientation.
Create a new rule file:
sudo nano /etc/udev/rules.d/99-touchscreen-calibration.rules
Add the following line:
ENV{ID_VENDOR_ID}=="XXXX", ENV{ID_MODEL_ID}=="YYYY", ENV{LIBINPUT_CALIBRATION_MATRIX}="<insert_matrix_here>"
Replace:
XXXX with the Vendor ID
YYYY with the Model ID
<insert_matrix_here> with the desired calibration matrix
For a touchscreen that requires Y-axis inversion:
ENV{ID_VENDOR_ID}=="14e1", ENV{ID_MODEL_ID}=="6000", ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 -1 1"
Save the file and exit the editor.
Reload the udev rules:
sudo udevadm control --reload-rules
sudo udevadm trigger
Verify that the calibration matrix is attached to the device:
udevadm info -q property -n /dev/input/eventX | grep LIBINPUT_CALIBRATION_MATRIX
The output should display the configured matrix.
To ensure the new settings take effect:
Disconnect and reconnect the controller's USB cable, or
Log out and back into the Linux session
On Wayland-based systems, logging out and back in is often required for the compositor to reload the input device configuration.
Verify that the correct /dev/input/eventX device was used.
Confirm the Vendor ID and Model ID match the connected controller.
Check the rule syntax for typing errors.
Reload the udev rules after every modification.
Run:
udevadm info -q property -n /dev/input/eventX
and verify that the LIBINPUT_CALIBRATION_MATRIX property appears in the output.