-
- Posts: 22
- Joined: Tue Apr 07, 2015 2:12 am
Rotate display 90º?
Hey there,
I had a previous project working with an Adafruit piTFT that I had with the display rotated (so that it's viewed like a smartphone vs. like a laptop screen_.
Any ideas on how to rotate 90º (not 180, like the config.txt commands do)?
Thanks!
I had a previous project working with an Adafruit piTFT that I had with the display rotated (so that it's viewed like a smartphone vs. like a laptop screen_.
Any ideas on how to rotate 90º (not 180, like the config.txt commands do)?
Thanks!
-
- Posts: 22
- Joined: Tue Apr 07, 2015 2:12 am
Re: Rotate display 90º?
Nevermind. Figured it out.
Add one of these to the bottom:
display_rotate=0 Normal
display_rotate=1 90 degrees
display_rotate=2 180 degrees
NOTE: You can rotate both the image and touch interface 180º by entering lcd_rotate=2 instead
display_rotate=3 270 degrees
display_rotate=0x10000 horizontal flip
display_rotate=0x20000 vertical flip
Code: Select all
sudo nano /boot/config.txt
display_rotate=0 Normal
display_rotate=1 90 degrees
display_rotate=2 180 degrees
NOTE: You can rotate both the image and touch interface 180º by entering lcd_rotate=2 instead
display_rotate=3 270 degrees
display_rotate=0x10000 horizontal flip
display_rotate=0x20000 vertical flip
Last edited by lanewinfield on Thu Jan 21, 2016 8:15 pm, edited 1 time in total.
-
- Posts: 22
- Joined: Tue Apr 07, 2015 2:12 am
Re: Rotate display 90º?
I spoke too soon. Now all the touch events are opposite where they should be. Anybody have any thoughts?
-
- Posts: 22
- Joined: Tue Apr 07, 2015 2:12 am
Re: Rotate display 90º?
Don't mind me, just talking to myself.
Figured out how to make it work. First you have to install xinput.
Then list your displays:
(if you're on the Pi)
(if you're on the Rasp Pi via SSH)
I'd guess that every display is the same name, which is "FT5406 memory based driver."
Using the name of the device, use this command (add DISPLAY=:0 if you're SSHing!)
That'll swap the two axes, but now you have to screw with each individual axis. Depending on your rotation, it's either going to be
or
I'm gonna go ahead and add these to rc.local and hope for the best!
Figured out how to make it work. First you have to install xinput.
Code: Select all
$ sudo apt-get install xinput
(if you're on the Pi)
Code: Select all
xinput --list
Code: Select all
DISPLAY=:0 xinput --list
Using the name of the device, use this command (add DISPLAY=:0 if you're SSHing!)
Code: Select all
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
Code: Select all
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
Code: Select all
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
Re: Rotate display 90º?
I was referred to this thread while attempting to get my raspberry pi with the 7 inch official touch screen to rotate the display AND touch screen 90 or 270 degrees.
I am very inexperienced with raspberry pi, Linux, etc. and could use some help.
I followed the directions until I ran the command in the image below and the results confused me.
I would greatly appreciate any expertise or ideas anyone may have.
Thanks,
I am very inexperienced with raspberry pi, Linux, etc. and could use some help.
I followed the directions until I ran the command in the image below and the results confused me.
I would greatly appreciate any expertise or ideas anyone may have.
Thanks,
-
- Posts: 22
- Joined: Tue Apr 07, 2015 2:12 am
Re: Rotate display 90º?
Cool! You're doing a great job. I started playing around with Rasp Pi knowing nothing and now—well, I know a little bit.twuelfing wrote:I was referred to this thread while attempting to get my raspberry pi with the 7 inch official touch screen to rotate the display AND touch screen 90 or 270 degrees.
I am very inexperienced with raspberry pi, Linux, etc. and could use some help.
I followed the directions until I ran the command in the image below and the results confused me.
I would greatly appreciate any expertise or ideas anyone may have.
Thanks,
The first step is actually rotating the screen—I can't tell if you've done that already. To do that, run this command:
Code: Select all
sudo nano /boot/config.txt
Code: Select all
display_rotate=1
Code: Select all
display_rotate=3
Code: Select all
sudo reboot
Now we're at where you're at in that picture.
If I'm not mistaken, what you're seeing there is a list of the pointers (like mice or touchscreens) and keyboard inputs. What we're looking for there is the name of the touchscreen input. In this case, it's
Code: Select all
FT5406 memory based driver
Code: Select all
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
Code: Select all
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
Code: Select all
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
NOW the next step is getting this working automatically when the rasp pi boots up.
Code: Select all
sudo nano /etc/rc.local
Add the first line and then whichever second line worked in the last step. Either:
Code: Select all
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
Code: Select all
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
That should work!
Re: Rotate display 90º?
i got everything to work, except the part where adding the lines to rc.local would cause the changes to be present at boot.
When i typed them in manually it worked, when i added the lines and saved the file out and reboot the touch screen is still backward as if nothing was done.
I added the lines directly above the last line and modified nothing else.
Do i need to enable this script somewhere for it to work?
the comments in the file say that by default it does nothing and to change some setting to enable or disable it, but it didnt make sense to me. If you need i can get the exact text from the file.
thanks,
When i typed them in manually it worked, when i added the lines and saved the file out and reboot the touch screen is still backward as if nothing was done.
I added the lines directly above the last line and modified nothing else.
Do i need to enable this script somewhere for it to work?
the comments in the file say that by default it does nothing and to change some setting to enable or disable it, but it didnt make sense to me. If you need i can get the exact text from the file.
thanks,
-
- Posts: 11
- Joined: Fri Sep 25, 2015 4:07 am
Re: Rotate display 90º?
I've gotten as far as twuelfing, but when I add the command to rc.local (after the comments) I reboot and get:
[....] startpar: service(s) returned failure: rc.local
[FAI failed!
any thoughts?
[....] startpar: service(s) returned failure: rc.local
[FAI failed!
any thoughts?
-
- Posts: 1
- Joined: Fri Sep 25, 2015 9:22 am
Re: Rotate display 90º?
The issue is that rc.local runs to early (my basic understanding). instead:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
add the lines
@DISPLAY=:0 xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
and
@DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
or
@DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
Depending which one worked for you above. This adds them to the autostart file for the GUI.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
add the lines
@DISPLAY=:0 xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
and
@DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
or
@DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
Depending which one worked for you above. This adds them to the autostart file for the GUI.
Re: Rotate display 90º?
I have added these lines to the specified file. It still does not work as intended.
thanks again for all the help!
thanks again for all the help!
-
- Posts: 11
- Joined: Tue Sep 29, 2015 4:34 pm
Re: Rotate display 90º?
Hello.
I got it working by using script and running it from "/etc/xdg/lxsession/LXDE-pi/autostart".
Add
to /etc/xdg/lxsession/LXDE-pi/autostart
Script that I use:
This is kind of a workaround. I hope some one makes proper fix for this issue. Would be nice to simply use lcd_rotate in config.txt for 90 and 270 degrees also.
Hope this helps in the mean time.
I got it working by using script and running it from "/etc/xdg/lxsession/LXDE-pi/autostart".
Add
Code: Select all
@/your/script.sh
Script that I use:
Code: Select all
#!/bin/bash
#script to set correct touchscreen orientation after x start
#this won't rotate the displayed image, only the touchscreen input
#to rotate the displayed image add the following to /boot/config.txt
#"display_rotate=1" to rotate display 90 degrees
#"display_rotate=3" to rotate display 270 degrees
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
#Uncomment this for 90 rotation
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
#Uncomment this for 270 rotation
#xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
Hope this helps in the mean time.
Re: Rotate display 90º?
I have tried all of this, when i type the commands in manually the touch screen does what I want. when i add it to the various scripts and files it does not adjust the touch input.
the monitor is rotated as i want it at 270 degrees.
here are the specific inputs. When i type these into the command window it works.
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
thanks again for the patience and help sorting this out.
its kind of hard to believe that after so much time was spent preparing this display for resale that it doesn't seem to have been considered that users may not want the default orientation.
the monitor is rotated as i want it at 270 degrees.
here are the specific inputs. When i type these into the command window it works.
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
thanks again for the patience and help sorting this out.
its kind of hard to believe that after so much time was spent preparing this display for resale that it doesn't seem to have been considered that users may not want the default orientation.
Re: Rotate display 90º?
Really helpful post thanks!lanewinfield wrote:Code: Select all
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
In my hands I ended up doing
Code: Select all
added "display_rotate=2" to /boot/config.txt
(run via ssh so)
DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 0
DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 1
-
- Posts: 11
- Joined: Tue Sep 29, 2015 4:34 pm
Re: Rotate display 90º?
I am sorry I forgot to mention that I am using Raspberry Pi 2 B and the official 7" touch screen. Also the OS (rasbian) and FW where up to date at the time of writing the post.
I don't really know how to debug the desktop environment or the autostart script. There is probably some log file somewhere.
As I said before, in my mind this should really be set up in the config.txt file and I don't even have a clue why the xinput commands won't work straight from the autostart script and why is the user script required in between, but it works for me and I thought to share it here if it is any use to anybody.
Sorry that I can not be any more of assistance.
I don't really know how to debug the desktop environment or the autostart script. There is probably some log file somewhere.
As I said before, in my mind this should really be set up in the config.txt file and I don't even have a clue why the xinput commands won't work straight from the autostart script and why is the user script required in between, but it works for me and I thought to share it here if it is any use to anybody.
Sorry that I can not be any more of assistance.

Re: Rotate display 90º?
Forgive my ignorance here,
I have just been following the directions provided here and dont really understand what all of it is doing or why it does it, so I am going to ask.
What do the two hyphens or minus signs before the set-prop part of the command?
I have just been following the directions provided here and dont really understand what all of it is doing or why it does it, so I am going to ask.
What do the two hyphens or minus signs before the set-prop part of the command?
DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 0
-
- Posts: 11
- Joined: Tue Sep 29, 2015 4:34 pm
Re: Rotate display 90º?
They are for the xinput program to identify the ASCII characters are meant as a command, many of command line programs use the minus sign (or two) to identify user argument or command. Try several commands with --help and see what you get. e.g.twuelfing wrote:Forgive my ignorance here,
I have just been following the directions provided here and dont really understand what all of it is doing or why it does it, so I am going to ask.
What do the two hyphens or minus signs before the set-prop part of the command?DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 0
Code: Select all
ls --help
Re: Rotate display 90º?
thanks for the info.
I noticed that if i include the two dashes when i do the command manually it does not work. The commands only seem to work if i omit those.
any reason that would be the case?
I noticed that if i include the two dashes when i do the command manually it does not work. The commands only seem to work if i omit those.
any reason that would be the case?
-
- Posts: 11
- Joined: Tue Sep 29, 2015 4:34 pm
Re: Rotate display 90º?
This is weird. I am not a Linux guru so take my writings with grain of salt.twuelfing wrote:thanks for the info.
I noticed that if i include the two dashes when i do the command manually it does not work. The commands only seem to work if i omit those.
any reason that would be the case?
What I understand is if you have the same hardware and software you should get the same results. I have absolutely no clue why you are having the behaviour you are describing with the "--" and commands, as I don't have my setup that I made the script for, nor do I have a Linux machine at hand to test there either, so I am very sorry, but I am unable to help you further. Some one with better Linux knowledge can maybe explain this behaviour. To my knowledge what you describe should not be possible, but I can be mistaken as I said I am no guru nor can I test these commands at the moment.
Sorry for not being able to help you further.
Re: Rotate display 90º?
Is it possible your rotating your display 180 degrees?
That seems to be relatively easy to accomplish compared to the 270 degree rotation i need.
Perhaps this explains the differences we are seeing as we are not trying to do the same thing.
That seems to be relatively easy to accomplish compared to the 270 degree rotation i need.
Perhaps this explains the differences we are seeing as we are not trying to do the same thing.
mjlush wrote:lanewinfield wrote:
In my hands I ended up doingQuite why our Pi's would differ like that I really don't know (am running up to date rasbian and rpi-update)Code: Select all
added "display_rotate=2" to /boot/config.txt (run via ssh so) DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 0 DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 1
Re: Rotate display 90º?
If you're going to rotate it 180deg then you should use lcd_rotate=2 in config.txt rather than display_rotate. That will rotate the touchscreen along with the display and you don't need any xinput commands. The problem being discussed is rotating the screen 90deg (1) or 270deg (3) which requires the xinput commands to orient the touchscreen correctly.mjlush wrote:
Really helpful post thanks!
In my hands I ended up doingQuite why our Pi's would differ like that I really don't know (am running up to date rasbian and rpi-update)Code: Select all
added "display_rotate=2" to /boot/config.txt (run via ssh so) DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 0 DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 1
Re: Rotate display 90º?
I understand how to rotate the display and touch 180 degrees.
I have checked everything 3 times and here is where i am at.
the screen is rotated 270 degrees by using display_rotate=3 in the config.txt file located in \boot
I have added to /etc/xdg/lxsession/LXDE-pi/autostart the following line as the first line in the file
@/etc/xdg/lxsession/LXDE-pi/screenflip.sh
I created a file screenflip.sh here: /etc/xdg/lxsession/LXDE-pi/
in this file i have the following lines of code
#!/bin/bash
#script to set correct touchscreen orientation after x start
#this won't rotate the displayed image, only the touchscreen input
#to rotate the displayed image add the following to /boot/config.txt
#"display_rotate=1" to rotate display 90 degrees
#"display_rotate=3" to rotate display 270 degrees
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
#Uncomment this for 90 rotation
#xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
#Uncomment this for 270 rotation
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
i really appreciate everyones help with this, its greatly appreciated.
if your curious what i am working toward, you can check out my blog at http://troywuelfing.blogspot.com/
I have checked everything 3 times and here is where i am at.
the screen is rotated 270 degrees by using display_rotate=3 in the config.txt file located in \boot
I have added to /etc/xdg/lxsession/LXDE-pi/autostart the following line as the first line in the file
@/etc/xdg/lxsession/LXDE-pi/screenflip.sh
I created a file screenflip.sh here: /etc/xdg/lxsession/LXDE-pi/
in this file i have the following lines of code
#!/bin/bash
#script to set correct touchscreen orientation after x start
#this won't rotate the displayed image, only the touchscreen input
#to rotate the displayed image add the following to /boot/config.txt
#"display_rotate=1" to rotate display 90 degrees
#"display_rotate=3" to rotate display 270 degrees
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
#Uncomment this for 90 rotation
#xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
#Uncomment this for 270 rotation
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
i really appreciate everyones help with this, its greatly appreciated.
if your curious what i am working toward, you can check out my blog at http://troywuelfing.blogspot.com/
Re: Rotate display 90º?
I noticed some issues appearing that seem as though they may be relevant to my problems.
below is a picture of the errors I see while the machine is booting.
below is a picture of the errors I see while the machine is booting.
-
- Posts: 4
- Joined: Fri Nov 13, 2015 12:17 pm
Re: Rotate display 90º?
The script worked for me only after I made the script executable.
Code: Select all
sudo chmod 755 /etc/xdg/lxsession/LXDE-pi/screenflip.sh
Re: Rotate display 90º?
did this work to rotate 270 degrees or just 180?
thanks,
thanks,
-
- Posts: 4
- Joined: Fri Nov 13, 2015 12:17 pm
Re: Rotate display 90º?
My display and Touchscreen is working in 270 rotation.