I want to calibrate a touchscreen named "eGalax Inc. USB TouchController" on my Raspberry Pi. I think X and Y axes of the touchscreen are inverted. I used xinput_calibrator for this purpose. When I followed the xinput_calibrator instructions, it printed the following output:

Calibrating standard Xorg driver "eGalax Inc. USB TouchController"
    current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
    If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
    --> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "eGalax Inc. USB TouchController"
    Option  "MinX"  "20697"
    Option  "MaxX"  "20595"
    Option  "MinY"  "53036"
    Option  "MaxY"  "53090"
    Option  "SwapXY"    "1" # unless it was already set to 1
    Option  "InvertX"   "0"  # unless it was already set
    Option  "InvertY"   "0"  # unless it was already set

And it made no changes in the touchscreen behavior (It is not calibrated yet).

After that, I created the '/etc/X11/xorg.conf.d' directory and copied the snippet above (Section ... EndSection) into the '99-calibration.conf' in that directory as stated above, and finally rebooted the Raspberry Pi. But it didn't make any changes. What's going wrong?


Options defined in "InputClass" sections of Xorg configuration can be seen (and tested!) at runtime using xinput command. If your config file is valid, you should see something like this:

$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ eGalax Inc. USB TouchController           id=4    [slave  pointer  (2)]

$ xinput list-props 4
    MinX (280): 20697
    MaxX (281): 20595
    MinY (282): 53036
    MaxY (283): 53090

$ xinput set-prop 4 'MinX' 0

Once you get the touchscreen working, note which properties you had to set and make sure the config file contains the exact section names, parameter names and values. If the config file still doesn't work, check the Xorg log file for errors. Could be a permission problem or a typo for instance.

| improve this answer | |

You can see whether the changes are being seen by X11 by searching for "eGalax Inc. USB TouchController" (the name of the device, as per your file) in /var/log/Xorg.0.log .

I encountered a similar issue where SwapXY wasn't getting respected, and I couldn't determine why using the log file. Using the TransformationMatrix option instead of SwapXY worked for me. Here's the line to rotate the screen 90 degrees:

Option  "TransformationMatrix" "0 -1 1 1 0 0 0 0 1" 

(This is the option advocated by https://www.instructables.com/id/Rotate-Raspberry-Pi-Display-and-Touchscreen/)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.