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
video=DSI-1:800x480@60,rotate=90
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
#dtoverlay=vc4-kms-v3d
[all]
display_lcd_rotate=3
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"
EndSection
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.
Cheers
Matt