Rotate screen without a desktop
To set the screen orientation on a device that lacks a desktop environment, edit the /boot/firmware/cmdline.txt configuration file to pass an orientation to the system. Add the following line to cmdline.txt:
video=DSI-1:800x480@60,rotate=<rotation-value>Replace the <rotation-value> placeholder with one of the following values, which correspond to the degree of rotation relative to the default on your display:
090180270
For example, a rotation value of 90 rotates the display 90 degrees to the right. 180 rotates the display 180 degrees, or upside-down.
Note | It is not possible to rotate the DSI display separately from the HDMI display with cmdline.txt. When you use DSI and HDMI simultaneously, they share the same rotation value. |
Rotate touch input
Warning | Rotating touch input via device tree can cause conflicts with your input library. Whenever possible, configure touch event rotation in your input library or desktop. |
Rotation of touch input is independent of the orientation of the display itself. To change this you need to manually add a dtoverlay instruction in /boot/firmware/config.txt. Add the following line at the end of config.txt:
dtoverlay=vc4-kms-dsi-7inch,invx,invyThen, disable automatic display detection by removing the following line from config.txt, if it exists:
display_auto_detect=1Touch Display device tree option reference
The vc4-kms-dsi-7inch overlay supports the following options:
| DT parameter | Action |
|---|---|
| Sets X resolution (default 800) |
| Sets Y resolution (default 480) |
| Invert X coordinates |
| Invert Y coordinates |
| Swap X and Y coordinates |
| Disables the touch overlay totally |
To specify these options, add them, separated by commas, to your dtoverlay line in /boot/firmware/config.txt. Boolean values default to true when present, but you can set them to false using the suffix "=0". Integer values require a value, e.g. sizey=240. For instance, to set the X resolution to 400 pixels and invert both X and Y coordinates, use the following line:
dtoverlay=vc4-kms-dsi-7inch,sizex=400,invx,invy
No comments:
Post a Comment