익명 06:51

Touchscreen y axis inversion using wayland and libinput in KDE

Touchscreen y axis inversion using wayland and libinput in KDE

I'm using Plasma 6 (KDE) on Linux (arch) in a Ghia OnlyDue 2 in 1 laptop/tablet. It uses a silead touch screen (identified as MSSL1680). I've added the driver in /lib/firmware/silead and when I load it using modprobe silead, the touchscreen is detected as rotated 90 degrees counter-clockwise i.e. if I drag my finger horizontally, the cursor moves vertically and if I drag my finger vertically, the cursor moves horizontally. This means that the touchscreen is in portrait mode while the screen is in landscape mode.

Any recomendations to invert the vertical axis in the touchscreen?

I added a udev-rules file with the following contents

DRIVERS=="silead_ts" ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0"

And after reloading the module and reloading the rules via udevadm control --reload-rules, the touch remains in its original position (rotated 90 degrees counter-clockwise). After modifying the udev rules file and using this configuration

DRIVERS=="silead_ts" ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 1 0 0"

The touchscreen is now in landscape mode (correct rotation) but "scaled" down.

Finally, after modyfing again the file and using this configuration:

DRIVERS=="silead_ts" ENV{LIBINPUT_CALIBRATION_MATRIX}="0 2.15 0 3.2 0 0"

The touch is the right size... but the vertical axis is inverted i.e. dragging my finger left and right works well but up and down are inverted. I've tried negating the 3.2 and the 2.15 and also using different configuratios with no success.



Top Answer/Comment:

Edit: Compatible with wayland but not using libinput: In linux kernel 6.10 or later there's the option to give values to the i2c_touchscreen_props kernel parameter at the time of booting. Here you can give the x value limits, y value limits, swap x and y and invert an axis. To achieve this when using grub as a bootloader I had to edit /etc/default/grub and add the i2c_touchscreen_props parameter and its value to the GRUB_CMDLINE_LINUX_DEFAULT line. For more information on how to assign values to i2c_touchscreen_props you can check this github repo's readme file.

Only compatible with X11 but uses libinput: I had the same issue but with the x axis. After applying the rotation matrix "0 2.5 0 5 0 0" I still had the x axis mirrored. The only way I could get it to work was to change from Wayland to X11 in the login screen (I was using KDE Debian). After switching to X11, the negative numbers in the rotation matrix started working, though the same matrix I had been using for Wayland did not rotate the input the saume way in X11. Keep in mind an offset of 1 needs to be added to the third column whenever you use negative numbers in a row of the matrix. For more info on offsets for the rotation matrix check here libinput documentation

상단 광고의 [X] 버튼을 누르면 내용이 보입니다