Could this be the end of all touch screen calibration issues?

Hi again,

after browsing some discussion forums, I think I have found a solution for the non-persistent calibration values.

As I understand it, there are two interface layers for touch screen devices, evdev (older) and libinput (newer, but also uses evdev). The calibration procedure (calib, xinput_calibrator) relies on evdev and thus there can be cases where the calibration is in conflict with libinput.

Here is what I did to make it work, i.e. to make changes persistent. It survives reboot and software update.

ssh -X root@yourraspberry

apt-get install xserver-xorg-input-evdev
apt-get install xinput-calibrator

export DISPLAY=:0.0
xinput set-prop “ADS7846 Touchscreen” ‘Coordinate Transformation Matrix’ -1 0 1 0 -1 1 0 0 1

Do the actual calibration:

xinput_calibrator

Rename 10-evdev.conf in /usr/share/X11/xorg.conf.d/ such that it is executed after 40-libinput.conf

mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

Open 45-evdev.conf and add the two lines from the output of the xinput_calibrator at the section which has “evdev touchscreen catchall” in it.
These are values that work fine for my touchscreen:

Section "InputClass"
    Identifier "evdev touchscreen catchall"
    MatchIsTouchscreen "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
	#Custom Options below
	Option	"Calibration"	"135 3804 207 3867"
	Option	"SwapAxes"	"0"
EndSection

Additionally, rename any (calibration.)conf file in \etc\X11\xorg.conf.d\ to *.conf~.
Also, deactivate 98-screen-calibration.conf in \usr\share\X11\xorg.conf.d\ by renaming conf to conf~ (or whatever you prefer).

I have tested it on my zynthian (image from 2020-05-25) where I already tried some other attempts described in this thread. Could someone confirm if it works with a fresh image?
Good luck :wink: