Klipperscreen portrait mode on PiTFT50 with Pi4B how to

I hope this helps someone and isn’t a repost of anything anywhere else. I searched and searched and searched and couldn’t find all the answers I needed in one place so am posting this as a full reference on how to get this running.

I wanted to run my screen in portrait mode with the display cable area at the top and the USB ports at the bottom. Most of the guides I found were for earlier Pi’s or referenced using the gui to make changes.

I found bits and pieces of info across the forums on how to do this but ended up having to make 3 changes to get this to work on my setup.

To rotate the console output I made the following change :-

nano /boot/cmdline.txt


This still left Klipperscreen in the landscape layout. To rotate that I had to disable the new graphics driver and rotate the screen :-

nano /boot/config.txt


This now had Klipperscreen coming up in portrait mode but the touch overlay was wrong so I had to create a transformation matrix :-

nano /usr/share/X11/xorg.conf.d/40-libinput.conf

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"

The combination of these three things has mine working perfectly. Hope this helps someone trying to get this sorted as the info was scattered all over a bunch of different forums.



Nice. Thanks for sharing. I took the liberty to apply some formatting.

Thanks! Still new to posting here.

Here is how to rotate the screen without disabling the vc4-kms-v3d (or vc4-fkms-v3d) driver.
My experience is that doing that, will give you problems if you are using a RPI camera.
Add video=DSI-1:800x480me,rotate=90 to cmdline.txt.
Add Option “TransformationMatrix” “0 -1 1 1 0 0 0 0 1” to 40-libinput.conf as you did.

Then insted of modifying config.txt, create a file named 90-monitor.conf with this cmd.

sudo nano /usr/share/X11/xorg.conf.d/90-monitor.conf

And add this text to the file:

Section "Monitor"
    Identifier "DSI-1"
    # This identifier would be the same as the name of the connector printed by xrandr.
    # it can be "HDMI-0" "DisplayPort-0", "DSI-0", "DVI-0", "DPI-0" etc

    Option "Rotate" "left"
    # Valid rotation options are normal,inverted,left,right

    Option "PreferredMode" "480x800"
    # May be necesary if you are not getting your prefered resolution.

Thanks for posting additional information. I couldn’t get the monitor.conf file to work - I was using DSI-0, xrandr didn’t identify any displays. Hopefully this works for others.