CJ1
Posts: 47
Joined: Wed Jun 29, 2016 7:32 pm

Auto rotate like a tablet

Mon Feb 11, 2019 5:58 pm

I have the official pi 7in lcd touch screen. I know how to rotate the display in the config.txt.

Has anyone come up with a way to make it rotate automatically like a smart phone or tablet?

I assume you would need some kind of sensor and programming.

Andyroo
Posts: 3280
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Auto rotate like a tablet

Mon Feb 11, 2019 8:15 pm

Try either

Code: Select all

display_hdmi_rotate=1
Or
lcd_rotate=1
To flip the screen or Pi display respectively 90deg. The number can by 0->3 inclusive.

You may have to remove any hdmi_force_hotplug=1 settings

Problem with this being in config.txt is a reboot is needed.

Details are https://www.raspberrypi.org/documentati ... t/video.md

No idea how to do it live though :oops:
Need Pi spray - these things are breeding in my house...

CJ1
Posts: 47
Joined: Wed Jun 29, 2016 7:32 pm

Re: Auto rotate like a tablet

Tue Feb 12, 2019 2:45 pm

Thanks. I know about the lcd_rotate. I'd just like to do it like a smart phone or tablet. I assume they use some type of motion sensor. I'd like to try and code that if I could find out what type of sensor (hardware) I'd need to buy.

User avatar
procount
Posts: 1651
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Auto rotate like a tablet

Tue Feb 12, 2019 4:04 pm

Great idea.
Unfortunately, AFAIK, the screen is only configured by the GPU at boot up. There is no facility to reprogram it afterwards from the ARM, so you can only do it at bootup through config.txt :( I suspect it would require the RPF to update the firmware to do this, if it were at all possible.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6874
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Auto rotate like a tablet

Tue Feb 12, 2019 4:12 pm

Certainly when running Android, it is the UI thread that wakes up and tells the rendering engine to run an animation as it rotates everything(*). That means you really want to try and find the relevant hooks in X11, which I suspect don't exist. Either that or you write your own UI that supports such a request.

Do be aware that transpose is a fairly processing and memory bandwidth intensive operation to perform. Horizontal and vertical flips are trivial in comparison.

(*) It actually snapshots the screen, switches from hardware rendering of multimedia to GL, and then runs a GL sequence with that as a texture, before resuming hardware rendering. It's a real swine to get right!
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Andyroo
Posts: 3280
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Auto rotate like a tablet

Tue Feb 12, 2019 4:24 pm

A search has found the X11 “xrandr” command present on the Rasbian box I’ve got handy.

Problem is I’ve no spare cable that fits (it’s a Zero) at the mo so cannot try it!

A quick read on the man page shows:
-o, --orientation rotation
This specifies the orientation of the screen, and can be one of normal, inverted, left or right.
Anyone got a screen handy? No idea if the works, releases the Pi magic smoke or melts the monitor :lol: :roll: :lol:

Thanks to 6by9 for prompting the X11 search!
Need Pi spray - these things are breeding in my house...

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6874
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Auto rotate like a tablet

Tue Feb 12, 2019 5:30 pm

xrandr should work with the Full KMS driver. I have my doubts over it working with the legacy frame buffer drivers though.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Official Foundation Display”