1

Following my previous question, I now have a working LCD display, but with a different issue.

The problem is the same as in this question, yet I am unable to find a solution.

I don't have a xorg.conf file, but in xorg.conf.d/99-calibration.conf I put the result of xinput_calibration, which is:

Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option  "MinX"  "61348"
    Option  "MaxX"  "3095"
    Option  "MinY"  "3738"
    Option  "MaxY"  "62309"
    Option  "SwapXY"    "1" # unless it was already set to 1
    Option  "InvertX"   "1"  # unless it was already set
    Option  "InvertY"   "1"  # unless it was already set
EndSection

xinput list gives

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ADS7846 Touchscreen                       id=6    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]

xinput list-props 6 gives

Device 'ADS7846 Touchscreen':
    Device Enabled (116):   1
    Coordinate Transformation Matrix (117): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Calibration Matrix (246):  1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Calibration Matrix Default (247):  1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Send Events Modes Available (248): 1, 0
    libinput Send Events Mode Enabled (249):    0, 0
    libinput Send Events Mode Enabled Default (250):    0, 0
    Device Node (251):  "/dev/input/event0"
    Device Product ID (252):    0, 0
    libinput Horizontal Scroll Enabled (253):   0

and, as you can see, none of the options specified in 99-calibration.conf is used.

If I try running, as suggested in the answers on the other question

xinput set-prop 6 "Evdev Axis Calibration" <Min-X> <Max-X> <Min-Y> <Max-Y>
xinput set-prop 6 "Evdev Axes Swap" 1

I get

property 'Evdev Axis Calibration' doesn't exist, you need to specify its type and format
property 'Evdev Axes Swap' doesn't exist, you need to specify its type and format

Any idea?

Cynical
  • 145
  • 1
  • 1
  • 9

6 Answers6

5

Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1" worked for me too! after 2 afternoons of work it finally worked out Im using the 3.5 TFT GPIO verison - ADS7846 Touchscreen here is my file

pi@octopi:~ $ sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "MinX"  "4551"
        Option  "MaxX"  "62076"
        Option  "MinY"  "62002"
        Option  "MaxY"  "3430"
        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
        Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection

this was meant to run octoprint per following instructions

https://github.com/goodtft/LCD-show and https://github.com/BillyBlaze/OctoPrint-TouchUI/wiki/Setup:-Boot-to-Browser-(OctoPi-or-Jessie-Light)

goldilocks
  • 58,859
  • 17
  • 112
  • 227
3

If your issue is the same as mine, the new Jessie kernel / img uses libinput as it's mouse drivers instead of the old evdev, which either ignores 99-calibration.conf or uses a different config file altogether (in my experience. I don't know that for sure).

The solution is to open 40-libinput.conf and change Driver "libinput" to Driver "evdev" for the touchscreen section.

Then you have to run sudo apt-get install xserver-xorg-input-evdev

This is where I found the answer


Edit

I just figured out that if you have the resistive and capacitive modules loaded at the same time, the resistive module will override the configuration for the capacitive module and the same screen issues will occur.

So if you intend to use one pi image for different screen types, edit the /etc/modules file and make sure stmpe-ts is listed before f6xo6-ts. Then go to the /etc/udev/rules.d/ folder and rename 95-stmpe.rules file to 94-stmpe.rules

There's probably a script you can write to check which screen is on the pi, then dynamically switch the modules.

Lightfire228
  • 146
  • 2
2

After searching and testing for a while, I found that you need to set the Transformation Matrix in the Calibration section of xorg.conf.d/99-calibration.conf:

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

fixed the problem. I'm still not sure it's the right way to do that, so if anyone has a better option, I'd gladly listen to it.

Cynical
  • 145
  • 1
  • 1
  • 9
0

I had to swap both axis, and invert both of them as well, and then widen the input field (reduce minx, increase max, reduce miny, increase maxy)

Section "InputClass"
Identifier        "calibration"
MatchProduct      "ADS7846 Touchscreen"
Option "MinX"     "1834"
Option "MaxX"     "62280"
Option "MinY"     "61309"
Option "MaxY"     "3738"
Option "SwapXY"   "1" # unless it was already set to 1
Option "InvertX"  "0"
Option "InvertY"  "0"

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

EndSection
0

I had to use the Transformation matrix as such:

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

But otherwise, this was the way to make it work for me.

https://github.com/notro/fbtft/issues/445

Cymon
  • 1
0

Thank you!

Literally spent 4 hours trying to fix it and in the end, this was the code:

Section "InputClass"
    Identifier      "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option  "MinX"  "1934"
    Option  "MaxX"  "61280"
    Option  "MinY"  "62309"
    Option  "MaxY"  "3738"
    Option  "SwapXY"        "1" # unless it was already set to 1
    Option "InvertX"        "0"
    Option "InvertY"        "0"
    Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection

The only thing i needed to add was as said above: Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"