imrehg
Posts: 6
Joined: Tue Nov 29, 2016 1:51 pm
Location: London, UK
Contact: Website

Rotate to 90 or 270 degrees

Tue Nov 29, 2016 1:58 pm

Hi, I'm using the 7" display, using the default Raspbian image, and trying to rotate both the screen and the touch events to 90 degrees. I've seen that I need to use the "lcd_rotate" setting in config.txt. Been trying the range of settings (found e.g. in this blogpost), but looks like the 90 and 270 degree settings don't work.

Code: Select all

lcd_rotate=0 # normal WORKS
lcd_rotate=1 # rotate 90 degrees DOESN'T WORK
lcd_rotate=2 # rotate 180 degrees WORKS
lcd_rotate=3 # rotate 270 degrees DOESN'T WORK
lcd_rotate=0x10000 # flip screen horizontally WORKS
lcd_rotate=0x20000 # flip screen vertically WORKS
Any other setting it might need, or am I missing anything? Been trying to increase "gpu_mem" as well, but makes no difference in the outcome. Feedback is really appreciated.

User avatar
DougieLawson
Posts: 35542
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Rotate to 90 or 270 degrees

Tue Nov 29, 2016 4:49 pm

What OS? What version of the firmware/kernel?

Backup /boot and /lib/modules then try sudo rpi-update and retest your rotate settings.
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

aBUGSworstnightmare
Posts: 1448
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rotate to 90 or 270 degrees

Tue Nov 29, 2016 5:21 pm

Hi,
do you have a frame buffer defined? Maybe try doing it like this (with the right resolution of 800x480pixels of course):

# uncomment to force a console size. By default it will be display's size minus
# overscan.
# Portrait or Landscape Setting - only uncomment one block at a time
# Portrait-1 ( normal )
display_rotate=0
framebuffer_width=960
framebuffer_height=160

# Landscape-2 ( upside down )
#display_rotate=2
#framebuffer_width=960
#framebuffer_height=160

#Portrait-1 ( right side up )
#display_rotate=1
#framebuffer_width=160
#framebuffer_height=960

# Portrait-2 ( left side up )
#display_rotate=3
#framebuffer_width=160
#framebuffer_height=960

Sorry, don't have an official display but this works for me when using DPI

imrehg
Posts: 6
Joined: Tue Nov 29, 2016 1:51 pm
Location: London, UK
Contact: Website

Re: Rotate to 90 or 270 degrees

Tue Nov 29, 2016 5:57 pm

What OS? What version of the firmware/kernel?
Raspbian (as mentioned in the original post), updated to the latest firmware and kernel (4.4.32-v7+), after updating everything. Still 90 and 270 degree rotation does not work with the display.
# Portrait-1 ( normal )
display_rotate=0
Yes, display_rotate works for what it does, but the point of lcd_rotate is to rotate both the display and the touchscreen settings. The display_rotate setting only translates the display, and thus the touches show on the wrong place.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Rotate to 90 or 270 degrees

Tue Nov 29, 2016 6:51 pm

imrehg wrote: Yes, display_rotate works for what it does, but the point of lcd_rotate is to rotate both the display and the touchscreen settings.
Only lcd_rotate=0, and lcd_rotate=2 rotate the touch inputs along with the screen (0 and 180deg). As noted in the blog link you posted, when rotating 90 and 270 lcd_rotate doesn't rotate the touch correctly.

Maybe you should clarify what "doesn't work" means. The display doesn't rotate to either 90 or 270, or the screen rotates but the touch inputs don't? Those are two different issues, but unfortunately both are covered by "doesn't work".

imrehg
Posts: 6
Joined: Tue Nov 29, 2016 1:51 pm
Location: London, UK
Contact: Website

Re: Rotate to 90 or 270 degrees

Wed Nov 30, 2016 9:34 pm

Hi, excuse me that I'm confused by this:
Only lcd_rotate=0, and lcd_rotate=2 rotate the touch inputs along with the screen (0 and 180deg). As noted in the blog link you posted, when rotating 90 and 270 lcd_rotate doesn't rotate the touch correctly.
The blogpost did note say anything like that, the copy of the settings above in the thread is the report of the settings results with my annotations. The blogpost says: "...Therefore, if you have an LCD screen with touch capability, it is usually better to use the following commands [lcd_rotate instead of display_rotate as above, as these will rotate the display and touch sensors:..." According to them all values should be correctly rotate both display and touch.

"Not working" means, that neither the screen nor touch rotates: setting "lcd_rotate=1" or "lcd_rotate=3" just shows the original screen orientation (0 deg rotation, same as lcd_rotate=0)

User avatar
newsordice
Posts: 3
Joined: Thu Dec 01, 2016 6:22 pm
Location: South West, UK
Contact: Website

Re: Rotate to 90 or 270 degrees

Thu Dec 01, 2016 7:47 pm

Hello, author of the blog post mentioned by the OP. :)

I've been looking over my post and testing out the different options for lcd_rotate, it looks like only lcd_rotate=0 and lcd_rotate=2 are working. The other options I'd listed lcd_rotate=1 and lcd_rotate=3 do not work, in that the screen does not rotate 90 or 270 degrees and nor do the touch events.

I've updated my post to remove the incorrect lines and added an edit note to explain. My apologies if I'd caused any issues here.

I'm looking into a way to get the screen and touch events to rotate 90 or 270 degrees, not having much luck so far, but will let you know if I get any success.

Thanks,
newsordice

imrehg
Posts: 6
Joined: Tue Nov 29, 2016 1:51 pm
Location: London, UK
Contact: Website

Re: Rotate to 90 or 270 degrees

Mon Dec 05, 2016 3:31 pm

Hey, thanks for the feedback, that's sounds all good :) Let's see what we can figure out (and maybe fix, *knock-on-wood*)

User avatar
newsordice
Posts: 3
Joined: Thu Dec 01, 2016 6:22 pm
Location: South West, UK
Contact: Website

Re: Rotate to 90 or 270 degrees

Sat Dec 17, 2016 7:24 pm

I've been trying lots of different things to get an LCD rotation to work 90 or 270 degrees. I came across this forum post: viewtopic.php?f=108&t=120793 which suggests installing xinput.

Following the instructions by lanewinfield on Tue Sep 22, 2015 7:18 pm (first page about a quarter of the way down), I was able to get the screen to rotate 90 degrees using the /boot/config.txt file and display_rotate=1.

I was then able to follow lanewinfield's other instructions to swap the axes, but this was when the Pi was already booted up. The moment I rebooted, the display was still rotated to portrait but the touch events had reverted, so that when I touched the right of the screen the cursor arrow was at the bottom of the screen, for example.

I tried following suggestions throughout the rest of the post, including creating a file screenflip.sh in /etc/xdg/lxsession/LXDE-pi/ and making it run at autostart, as suggested by twuelfing on Sat Oct 10, 2015 7:26 pm (near the bottom of the first page with the blue text), but that didn't seem to work, and nor did the others.

I'm a little frustrated that what seems like a simple thing to do actually seems to be almost impossible!

rkanton
Posts: 9
Joined: Tue Apr 30, 2013 4:05 pm

Re: Rotate to 90 or 270 degrees

Tue Dec 20, 2016 10:54 pm

I'm running Jessie logging in as "pi" user.

Edit "/home/pi/.config/lxsession/LXDE/autostart" and add the following line:
@/home/pi/ts_input.sh

Edit "/home/pi/ts_input.sh" and add the "xinput" lines corresponding to your "display_rotate" value

For display_rotate=1 add in ts_input.sh:
#!/bin/bash
/usr/bin/xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
/usr/bin/xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1

For display_rotate=3 add in ts_input.sh:
#!/bin/bash
/usr/bin/xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
/usr/bin/xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0

Make sure you chmod 755 /home/pi/ts_input.sh

That worked for me.

sfriedlander
Posts: 1
Joined: Wed Feb 13, 2019 6:28 pm

Re: Rotate to 90 or 270 degrees

Wed Feb 13, 2019 6:38 pm

Is there a confirmed solution to the touchscreen not having touches in the right spot on 90 or 270 degrees with the official 7" Raspberry Pi touchscreen?

As with many others, I got the display to rotate, but not the touches.

aBUGSworstnightmare
Posts: 1448
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rotate to 90 or 270 degrees

Thu Feb 14, 2019 2:09 pm

sfriedlander wrote:
Wed Feb 13, 2019 6:38 pm
Is there a confirmed solution to the touchscreen not having touches in the right spot on 90 or 270 degrees with the official 7" Raspberry Pi touchscreen?

As with many others, I got the display to rotate, but not the touches.
see here https://www.raspberrypi.org/forums/view ... 6#p1348198

some other threads cover the topic as well.

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

Re: Rotate to 90 or 270 degrees

Thu Feb 14, 2019 2:21 pm

I've never had any problems rotating my display 90 degrees.
Have you tried

Code: Select all

display_lcd_rotate=
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: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Rotate to 90 or 270 degrees

Thu Feb 14, 2019 3:29 pm

lcd_rotate activates horizontal and vertical flips in the panel itself. Transpose is not supported in the panel, therefore 90 and 270 degrees will never work through that config option. It is specific to the lcd display, so can munge the touchscreen input.

display_rotate tells the composition engine to apply flips and/or transpose. This is generic, so can't munge touchscreen input - use the x-input mappings that have already been linked to.

display_lcd_rotate is the newer option as the early phase of the multiple frame buffer stuff, and allows you to specify different rotate options for lcd and HDMI displays.
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.

bedtime
Posts: 67
Joined: Thu Dec 13, 2018 6:02 pm

Re: Rotate to 90 or 270 degrees

Thu Mar 14, 2019 8:32 pm

rkanton wrote:
Tue Dec 20, 2016 10:54 pm
I'm running Jessie logging in as "pi" user.

Edit "/home/pi/.config/lxsession/LXDE/autostart" and add the following line:
@/home/pi/ts_input.sh

Edit "/home/pi/ts_input.sh" and add the "xinput" lines corresponding to your "display_rotate" value

For display_rotate=1 add in ts_input.sh:
#!/bin/bash
/usr/bin/xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
/usr/bin/xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1

For display_rotate=3 add in ts_input.sh:
#!/bin/bash
/usr/bin/xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
/usr/bin/xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0

Make sure you chmod 755 /home/pi/ts_input.sh

That worked for me.
I'm running Stretch, and this worked perfectly for me. Thanks!

Return to “Official Foundation Display”