MarkWattTech-Tutorials icon indicating copy to clipboard operation
MarkWattTech-Tutorials copied to clipboard

Rotate Screen?

Open Gd1230 opened this issue 11 months ago • 2 comments

All is working great, except using the official 7inch screen, it's upside down. Everything I find says to add lcd_rotate=2 to /boot/firmware/config.txt, but this is not solving the issue.

Gd1230 avatar Mar 03 '24 13:03 Gd1230

I am using the 7" official screen, on a pi4. I agree, the suggestion found online is to edit /boot/firmware/config.txt adding lcd_rotate=2, however it does not work. As its booting you can see the screen started flipped as desired, however it then reverts before it finishing booting.

After some investigation I found the answer here https://www.raspberrypi.com/documentation/accessories/display.html

Also this was helpful https://www.reddit.com/r/raspberry_pi/comments/u0nakb/7_screen_rotation_wo_gui_tried_all_the_tricks/

What I did was (from here https://www.raspberrypi.com/documentation/accessories/display.html)

Rotate screen without a desktop To set the screen orientation on a device that lacks a desktop environment, edit the /boot/firmware/cmdline.txt configuration file to pass an orientation to the system. Add the following line to cmdline.txt: video=DSI-1:800x480@60,rotate=<rotation-value>

Rotate touch input

Rotation of touch input is independent of the orientation of the display itself. To change this you need to manually add a dtoverlay instruction in /boot/firmware/config.txt. Add the following line in config.txt: dtoverlay=vc4-kms-dsi-7inch,invx,invy

Then, disable automatic display detection by removing the following line from config.txt, if it exists: display_auto_detect=1

ostat avatar Mar 16 '24 12:03 ostat

So I'm using a Waveshare 11.9" DSI touch screen and it has a default portrait resolution of 320x1480. Getting the screen to work in portrait was simple, but after a lengthy dive, I finally got it to work in landscape

Editing /boot/firmware/cmdline.txt config file and adding video=DSI-1:320x1480M@60,rotate=90 rotated only my CLI and every time Xorg server started it would default back to the portrait resolution.

Rotating display in Xorg server This helped me in getting the kiosk rotated 90 degrees. Adding the following to /etc/X11/xorg.conf.d/10-blanking.conf created a static rotation.

Section "Device"
        Identifier "RpiFB"
        Driver "fbdev"
        Option "rotate" "CCW"  # As in, counterclockwise
EndSection

Rotating touch input in Xorg server Adding dtoverlay lines in my config.txt didn't seem to work at all, my touch inputs were still off the default portrait resolution, which meant it didn't carry into Xorg. I found this post which allowed me to rotate touch inputs in Xorg. I added below the lines for screen rotation in /etc/X11/xorg.conf.d/10-blanking.conf

Section "InputClass"
            Identifier "Coordinate Transformation Matrix"
            MatchIsTouchscreen "on"
            MatchDevicePath "/dev/input/event*"
            MatchDriver "libinput"
            Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
EndSection

I had to set touch input rotation inputs to 270 to match the CCW display rotation.

LazyEggtart avatar Jul 05 '24 14:07 LazyEggtart