Ok, I've only ever flipped it 180, lcd_rotate=2, on my Pi 2B. Just be sure you used lcd_rotate and not display_rotate. display_rotate only rotates the image, it doesn't rotate the touch to match.lincolnberryiii wrote:Thanks, but I need my display rotated at 270° and lcd_rotate=3 doesn't work for me. I'm running Raspbian Jessie on the Pi 2 B.alphanumeric wrote:Did you try the lcd_rotate=1 config.txt edit? It's a lot easier. It works for me.
-
- Posts: 3155
- Joined: Tue Jan 19, 2016 2:17 pm
- Location: Sydney, Nova Scotia, Canada
Re: Rotate display 90º?
Re: Rotate display 90º?
This will do it: open /boot/config.txt in your favourite editor and add the line:
Don't use the documented display_rotate, it performs a performance expensive rotation of the screen and does not rotate the touch input.
Code: Select all
lcd_rotate=2
Re: Rotate display 90º?
When can we get this bug fixed (that lcd_rotate=1 doesnt work). Im trying to run a embedded QT app so I cant use xinput since Im not using Xorg 

-
- Posts: 7
- Joined: Mon Mar 14, 2016 1:28 pm
Re: Rotate display 90º?
Hello, i have followed this istructions but the script when execute xinput row send in output the following error:mikearnoldsmith wrote:I edited /home/pi/.config/lxsession/LXDE-pi/autostartTheo1966 wrote:As usual, after long try and error post the problem in a forum and find the solution rather quickly after doing so![]()
I was thinking it must be something about the difference between commandline and gui.
-> so maybe run the bash after the gui is started
-> So I put the command to run the script in " /home/pi/.config/lxsession/LXDE-pi/autostart "
........ and it worked !!!!![]()
Now the input of the touchscreen is rotated 270 degrees @ startup
and added @/etc/xdg/lxsession/LXDE-pi/screenflip.sh
And my touchscreen works in 270 rotation on Raspbian Jessie.
Thanks for the post.
Unable to connect to X server
If i launch the same script from a new console, it works!
How can i solve it?
Thanks!
Rotated display but now touchscreen?
Hello,
I'd lost without theses forms i'm so glad for all of you guys, and man what a learning curve already. I'm so excited about my Pi 3 its has the "official" 7in screen and I finally was able to change the screen but now i need to have the touch capabilities the same way. although it works fine with the mouse it would be nice to have that as access if need be.
I'd lost without theses forms i'm so glad for all of you guys, and man what a learning curve already. I'm so excited about my Pi 3 its has the "official" 7in screen and I finally was able to change the screen but now i need to have the touch capabilities the same way. although it works fine with the mouse it would be nice to have that as access if need be.
Re: Rotated display but now touchscreen?
Cindella wrote:Hello,
I'd lost without theses forms i'm so glad for all of you guys, and man what a learning curve already. I'm so excited about my Pi 3 its has the "official" 7in screen and I finally was able to change the screen but now i need to have the touch capabilities the same way. although it works fine with the mouse it would be nice to have that as access if need be.
I figured it out yay!!!
-
- Posts: 3155
- Joined: Tue Jan 19, 2016 2:17 pm
- Location: Sydney, Nova Scotia, Canada
Re: Rotate display 90º?
Did you guys try the lcd_rotate ? For me it flips the screen and the touch orientation to match.
Re: Rotate display 90º?
It works using "lcd_rotate=2" (180deg rotation). However, when using "lcd_rotate=1" or "lcd_rotate=3" (90 or 270deg rotation) the touch orientation is not rotated correctly, thus the need to manually invert some of the input axes.alphanumeric wrote:Did you guys try the lcd_rotate ? For me it flips the screen and the touch orientation to match.
-
- Posts: 3155
- Joined: Tue Jan 19, 2016 2:17 pm
- Location: Sydney, Nova Scotia, Canada
Re: Rotate display 90º?
OK, bummer, the other way looks like a lot of work.
Re: Rotate display 90º?
Hi,
Like many of you, I am also having trouble rotating the touchscreen when the RPi3 powers up. I can run the screenflip.sh script manually and the touchscreen works fine. I have tried running this script from the following locations:
/etc/xdg/lxsession/LXDE-pi/autostart
/home/pi/.config/lxsession/LXDE-pi/autostart
Neither of these options work so I tried the idea by Theo1966 to write a message to a text file. This is not working so it appears neither of these autostart files are running (or maybe they stop running before the screenflip script is run). Are there any other locations to run this script?
Thanks,
Kevin
Like many of you, I am also having trouble rotating the touchscreen when the RPi3 powers up. I can run the screenflip.sh script manually and the touchscreen works fine. I have tried running this script from the following locations:
/etc/xdg/lxsession/LXDE-pi/autostart
/home/pi/.config/lxsession/LXDE-pi/autostart
Neither of these options work so I tried the idea by Theo1966 to write a message to a text file. This is not working so it appears neither of these autostart files are running (or maybe they stop running before the screenflip script is run). Are there any other locations to run this script?
Thanks,
Kevin
Re: Rotate display 90º?
Hello to all,
like many on the thread I seriously struggled with this seemingly simple issue, an issue one would hope is addressed by the foundation in an upcoming update.
I eventually got it all working perfectly using this post:-
by twuelfing » Sat Oct 10, 2015 7:26 pm
that post is on the first page of the thread.
First may I thank twuelfing for this information, without which I would not have got very far with the project I am working on.
initially this method failed for me, and it was not until I realized one simple point that was missed in his post, and that was simply about PERMISSIONS of the screenflip.sh script.
once I changed the permission to 'Only Owner' it worked exactly as I had hoped.
I hope others get the same results.
as a footnote, I am not using raspbian, but rather a very lightweight version called DietPi that is based upon raspbian but does not have all the unnecessary bloat that I did not need in my particular project.
that meant I very slightly changed the 'autostart' entry to use LXDE directory as opposed to LXDE-pi.
like many on the thread I seriously struggled with this seemingly simple issue, an issue one would hope is addressed by the foundation in an upcoming update.
I eventually got it all working perfectly using this post:-
by twuelfing » Sat Oct 10, 2015 7:26 pm
that post is on the first page of the thread.
First may I thank twuelfing for this information, without which I would not have got very far with the project I am working on.
initially this method failed for me, and it was not until I realized one simple point that was missed in his post, and that was simply about PERMISSIONS of the screenflip.sh script.
once I changed the permission to 'Only Owner' it worked exactly as I had hoped.
I hope others get the same results.
as a footnote, I am not using raspbian, but rather a very lightweight version called DietPi that is based upon raspbian but does not have all the unnecessary bloat that I did not need in my particular project.
that meant I very slightly changed the 'autostart' entry to use LXDE directory as opposed to LXDE-pi.
-
- Posts: 1
- Joined: Sun Dec 11, 2016 6:36 pm
Re: Rotate display 90º?
Is there a solution now? Can it be that I am the only one in the world who would like to operate the Raspberry Touch Display in portrait mode?
Re: Rotate display 90º?
i do like this
0.
install xinput
1.
to rotate the screen, edit this file
add this line at the end
for the other direction, you can use
exit and save
2.
create a script for flipping touchscreen
add these lines
exit and save
if you use
add theses lines
3.
chmod this script
4.
to launch the script with the session, edit this file
add this line at the end
exit and save
5.
reboot
work like a charm for me
(i wrote english like a spanish cow, hope it helps)
0.
install xinput
Code: Select all
sudo apt-get install xinput
to rotate the screen, edit this file
Code: Select all
sudo nano /boot/config.txt
Code: Select all
display_rotate=1
Code: Select all
display_rotate=3
exit and save
2.
create a script for flipping touchscreen
Code: Select all
sudo nano /home/pi/Desktop/fliptouch.sh
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
if you use
Code: Select all
display_rotate=3
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
chmod this script
Code: Select all
sudo chmod 777 /home/pi/Desktop/fliptouch.sh
to launch the script with the session, edit this file
Code: Select all
sudo nano ~/.config/lxsession/LXDE-pi/autostart
Code: Select all
@/home/pi/Desktop/fliptouch.sh
5.
reboot
Code: Select all
sudo reboot
work like a charm for me

(i wrote english like a spanish cow, hope it helps)
Re: Rotate display 90º?
Hey all,
Complete rookie with Linux here. I've been able to install xinput and view the list, however, when I run "xinput set-prop 'FT5406 Memory based driver' 'evdev axes swap' 1" I get "Property 'evdev axes swap' doesn't exist, you need to specify its type and format".
I do have the FT5406 btw.
So, looking through the forum I saw that I may need to install the evdev files, so i ran "sudo pip install evdev". This leads to a small paragraph of red text. The main line being " command 'arm-linux-gnueabihf-gcc' failed with exit status 1"
Thoughts? Where should I go from here?
Thanks
Complete rookie with Linux here. I've been able to install xinput and view the list, however, when I run "xinput set-prop 'FT5406 Memory based driver' 'evdev axes swap' 1" I get "Property 'evdev axes swap' doesn't exist, you need to specify its type and format".
I do have the FT5406 btw.
So, looking through the forum I saw that I may need to install the evdev files, so i ran "sudo pip install evdev". This leads to a small paragraph of red text. The main line being " command 'arm-linux-gnueabihf-gcc' failed with exit status 1"
Thoughts? Where should I go from here?
Thanks
Re: Rotate display 90º?
I have the same problem like tigerhawk
I gues it's because the Raspberry use (not more) the evdev driver
if i type:
I can't found anything with evdev, but instead libinput.
some research say it's also some kind of touch and mouse event driver.
but how to deal with this now?
I use the newest image and can't switch to an older one.
all what I want is to rotate the touch functionality by 90º
Any ideas what I can try?
I gues it's because the Raspberry use (not more) the evdev driver
if i type:
Code: Select all
xinput list-props 9
some research say it's also some kind of touch and mouse event driver.
but how to deal with this now?
I use the newest image and can't switch to an older one.
all what I want is to rotate the touch functionality by 90º
Any ideas what I can try?
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6351
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Rotate display 90º?
Info on touchscreen flips/rotations with latest Pixel here:
viewtopic.php?f=28&t=172025
viewtopic.php?f=28&t=172025
- LetHopeItsSnowing
- Posts: 357
- Joined: Sat May 26, 2012 6:40 am
- Location: UK
Re: Rotate display 90º?
After a change to Pixel the instructions in this post no longer work so I have pulled together an end 2 end set of instructions to rotate the touchscreen 90 degrees:
http://www.stuffaboutcode.com/2017/05/r ... trait.html
http://www.stuffaboutcode.com/2017/05/r ... trait.html
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"
Re: Rotate display 90º?
Would like to thank those who have contributed with the xinput information.
Besides correcting the touch digitizer in a script, the correct values can be automatically chosen within the script as well. I leave a sample for rotation to 90º. Using RPi3 and official touch. This code is for example in rotatetouch.sh and, as many have mentioned, would be called within /home/pi/.config/lxsession/LXDE-pi/autostart
Besides correcting the touch digitizer in a script, the correct values can be automatically chosen within the script as well. I leave a sample for rotation to 90º. Using RPi3 and official touch. This code is for example in rotatetouch.sh and, as many have mentioned, would be called within /home/pi/.config/lxsession/LXDE-pi/autostart
Code: Select all
#!/bin/bash
KRED='\033[0;31;7m'
KGRN='\033[0;32;7m'
KNRM='\033[0m' # No Color
# this is for a 90 degree rotation in /boot/config.txt
#internal field separator
configfile=/boot/config.txt
while IFS= read -r line
do
commandname=$(echo $line | cut -f1 --delimiter='=' -s)
commandvalue=$(echo $line | cut -f2 --delimiter='=' -s)
if [ "$commandname" == "display_rotate" ] && [ $commandvalue -eq 1 ]
then
echo -e "${KGRN}----------------------"
echo "Swap and rotate $commandvalue"
echo -e "----------------------${KNRM}"
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
fi
done < "$configfile"
- DougieLawson
- Posts: 42327
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Rotate display 90º?
It's not a bug. It's a design choice in the bootcode for the RPF official display. They only support rotate=0 and rotate=2.tsaG wrote:When can we get this bug fixed (that lcd_rotate=1 doesnt work). Im trying to run a embedded QT app so I cant use xinput since Im not using Xorg
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Rotate display 90º?
Experimental OpenGL driver allows rotation, right?
It's still kind of unstable atm.
It's still kind of unstable atm.
- DougieLawson
- Posts: 42327
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Rotate display 90º?
We'll find out when it's no longer experimental. I'm not prepared to do anything with that as it still isn't out of early alpha testing.
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Rotate display 90º?
Here's a solution for Raspbian 9 (Stretch) that works with some generic Chinese touch screen I have. I chose to rotate my display and touch by 270 degrees. First rotate the display by editing the boot config file
adding at the end (using CTRL+X, y, enter to save):
Now to rotate the touch control. Run the following to figure out your device name:
In my case I had a bunch of Chinese characters for device name, but figured that was my touch screen because all other devices were pointers/mice/keyboard. Now replacing devicename below for your touch screen device name, run:
Then you should see a result:
which is the 3x3 identity matrix in row-major order.
Now we can change the rotation matrix of the device (to rotate by 270 degrees) after boot by editing (or creating) the following file:
and adding the line below (using CTRL+X, y, enter to save) with your device name:
Note that this new matrix will transform a touch coordinate [x y 0] to [-y x 0], i.e. 270 degrees. Not sure why the matrices aren't 2x2 since they are acting on 2D coordinates, but in any case rotation matrices for other degrees are available here: https://wiki.ubuntu.com/X/InputCoordinateTransformation.
Also make sure to disable overscan in /boot/config.txt otherwise it may mess up your calibration and touch accuracy:
Reboot your device with:
and the display and touch screen should be rotated by 270 on startup! Hope this helps for people who do not have the Raspi LCD / 'FT5406 memory based driver'.
Code: Select all
sudo nano /boot/config.txt
Code: Select all
display_rotate=3
Code: Select all
xinput --list
Code: Select all
xinput list-props 'devicename'
Code: Select all
Coordinate Transformation Matrix (ID#): 1 0 0 0 1 0 0 0 1
Now we can change the rotation matrix of the device (to rotate by 270 degrees) after boot by editing (or creating) the following file:
Code: Select all
sudo nano ~/.xsessionrc
Code: Select all
xinput set-prop 'devicename' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
Also make sure to disable overscan in /boot/config.txt otherwise it may mess up your calibration and touch accuracy:
Code: Select all
disable_overscan=1
Code: Select all
sudo reboot
Re: Rotate display 90º?
Hi everyone!
Thanks @koopaduo for your contribution, this work for me(I'm using a Waveshare 5" touchscreen). I just have a problem: I can't get the transformation on startup.
I did this but it doesn't work :/
Thanks @koopaduo for your contribution, this work for me(I'm using a Waveshare 5" touchscreen). I just have a problem: I can't get the transformation on startup.
I did this but it doesn't work :/
Notice 2 things: I'm on Volumio AND I'm a newbie on Linux commands. Maybe I just forget some basic thing which is not precised on these lines because it is hollowing?... So could someone help me to finish this manipulation to get it on startup? Thanks in advance!Now we can change the rotation matrix of the device (to rotate by 270 degrees) after boot by editing (or creating) the following file:and adding the line below (using CTRL+X, y, enter to save) with your device name:Code: Select all
sudo nano ~/.xsessionrc
Code: Select all
xinput set-pros 'WaveShare WS170120' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
Re: Rotate display 90º?
No? ... No one?
...

Re: Rotate display 90º?
Code: Select all
xinput set-pros 'WaveShare WS170120' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1