I am struggling to understand what is going on with my (knock-off) Waveshare 3.5" TFT calibration.

For my application, I need to have the display and the touch screen rotated 180 degrees. Flipping the display is no problem. However, getting the touchscreen calibrated correctly has been a challenge.

I started by modifying /usr/share/X11/xorg.conf.d/99-calibration.conf, which contains:

Section "InputClass"
    Identifier      "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option  "Calibration"   "300 3932 3801 294"
    Option  "SwapAxes"      "1"
    Option "EmulateThirdButton" "1"
    Option "EmulateThirdButtonTimeout" "1000"
    Option "EmulateThirdButtonMoveThreshold" "300"

But no matter how I changed the Calibration and SwapAxes options, I couldn't get the touch screen to change it's orientation at all.

Finally, after poring over the install script for the Waveshare TFT (which is really ugly stuff btw), I noticed it reordered the scripts in the xorg.conf.d folder, specifically by moving "10-evdev.conf" to "45-evdev.conf" (after "40-libinput.conf"). Making this change did indeed let the calibration options take effect.


I had previously done something similar, and when I applied the latest Raspbian update, the update was not very happy with the reordered scripts.

My questions are: 1. Why is it bad to move 10-evdev to 45-evdev, 2. It looks like 10-evdev and 40-libinput are both trying to grab the same device; which wins?, 3. What is it I am doing anyway and why why the Raspbian update so unhappy when I do it, and 4. Is there a better way to address this problem.

Thanks in advance.


Shuffling config files around (e.g. renaming /usr/share/X11/xorg.conf.d/10-evdev.conf to /usr/share/X11/xorg.conf.d/45-evdev.conf) will only matter if these files have conflicting duplicate options, because the order may define which options take precedence. Typically, Xorg takes the last conflicting definition into account, which means that 45-evdev.conf will prevail over 40-libinput.conf, and 40-libinput.conf takes over 10-evdev.conf. However, in some cases (duplicate options inside the same section?) the first definition is retained instead.

You should check /var/log/Xorg.0.log to be sure which options were retained. This is expressed by messages like

Warning: Duplicate option name "blabla"

Using last definition


Warning: Multiple options name "blabla"

Using first definition

As for the second question, Raspbian is using file names to decide which files belong to which package, so if you renamed a file, you cannot update it by running apt-get. The best solution would be to identify the config options which are effective, remove the duplicate options from other config files, then rename the files back. It may be one heck of a work though.

Your Answer

