TS-4900 display rotation: Difference between revisions

From embeddedTS Manuals
(Created page with "Under Yocto xrandr can be used to rotate the screen at any time: <source lang=bash> export DISPLAY=:0 xrandr --rotate left xrandr --rotate right xrandr --rotate normal xrandr...")
 
No edit summary
Line 1: Line 1:
Under Yocto xrandr can be used to rotate the screen at any time:
Under Yocto you can use xrandr to rotate the screen:
<source lang=bash>
<source lang=bash>
export DISPLAY=:0  
export DISPLAY=:0  
Line 8: Line 8:
</source>
</source>


Under Debian or Ubuntu the rotation is configured via Xorg.conf.  Edit the file /etc/X11/xorg.conf and append this to the end:
Under Debian or Ubuntu you can rotate the screen in the Xorg.conf.  Edit the file /etc/X11/xorg.conf and append this to the end:
<source lang=bash>
<source lang=bash>
Section "Device"
Section "Device"
Line 17: Line 17:
</source>
</source>


If the display is rotated, the touchscreen needs to be as wellThe following example matches the CCW rotation, but swapaxes or the invertx/y options will need to be adjusted for other rotations.
After the display is rotated you will also need to rotate a touchscreen if this is being usedThis example matches the CCW rotation, but swapaxes or the invertx/y options will need to be adjusted for other rotations.


<source lang=bash>
<source lang=bash>
Line 29: Line 29:
       Option "InvertY" "off"
       Option "InvertY" "off"
EndSection
EndSection
</source>
On newer X11 releases libinput is used instead of the evdev driver.  To rotate with Debian 10 and above this will require changing the [https://wiki.ubuntu.com/X/InputCoordinateTransformation coordinate transormation matrix].  Edit /etc/X11/Xsession.d/10x11-ts-calibration and add the transformation matrix for your rotation to the end of the script.  Eg, for counter clockwise rotations add:
<source lang=bash>
xinput set-prop "ADS7846 Touchscreen" 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
</source>
</source>

Revision as of 10:19, 8 February 2021

Under Yocto you can use xrandr to rotate the screen:

export DISPLAY=:0 
xrandr --rotate left
xrandr --rotate right
xrandr --rotate normal
xrandr --rotate inverted

Under Debian or Ubuntu you can rotate the screen in the Xorg.conf. Edit the file /etc/X11/xorg.conf and append this to the end:

Section "Device"
    Identifier      "fbdev display"
    Driver          "fbdev"
    Option "Rotate" "CCW"
EndSection

After the display is rotated you will also need to rotate a touchscreen if this is being used. This example matches the CCW rotation, but swapaxes or the invertx/y options will need to be adjusted for other rotations.

Section "InputClass"
       Identifier "axis inversion"
       MatchIsTouchscreen "true"
       # swap x/y axes on the device. i.e. rotate by 90 degrees
       Option "SwapAxes" "on"
       # Invert the respective axis.
       Option "InvertX" "on"
       Option "InvertY" "off"
EndSection

On newer X11 releases libinput is used instead of the evdev driver. To rotate with Debian 10 and above this will require changing the coordinate transormation matrix. Edit /etc/X11/Xsession.d/10x11-ts-calibration and add the transformation matrix for your rotation to the end of the script. Eg, for counter clockwise rotations add:

xinput set-prop "ADS7846 Touchscreen" 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1