Pi Touch Screen: Here is how to invert



  • For those running this very popular touch screen on the D3 + Pi, you may need to mount it inverted to get the cables to route better. If so, these two changes will make both the display and the touch mouse work correctly:

    • To flip the display 180 degrees:

    edit (sudo vi or sudo nano) /boot/config.txt and add a line at the bottom display_rotate=2

    • To reverse the mouse (both right left and up down as correct for the 180 flipped display):

    cd /usr/share/X11/xorg.conf.d/
    create a new file (sudo vi or sudo nano) 99-libinput.conf that contains:

    Section "InputClass"
      Identifier "libinput touchscreen catchall"
      MatchDevicePath "/dev/input/event0"
      Driver "libinput"
      Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
    EndSection
    

    Reboot and test. That's it.

    P.S. There are a bunch of ways to convince X11 to reverse the mouse. The above is one of the most reliable.


Log in to reply