Jump to content

Display: Difference between revisions

From postmarketOS Wiki
mNo edit summary
Knuxify (talk | contribs)
No edit summary
 
(14 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{stub|All of this is Xorg-related; needs to be made more universal.}}
== Landscape mode ==
== Landscape mode ==
All these fixes need device reboot.


=== Rotate the screen ===
=== Rotate the screen ===
Line 12: Line 15:
</pre>
</pre>


Reboot ,Then open the display app and set the correct resolution.
Valid values for "Rotate" are "CW" (clockwise, 90 degrees), "UD" (upside down, 180 degrees) and "CCW" (counter clockwise, 270 degrees), see fbdev(4) man page.
 
Reboot, then open the display app and set the correct resolution.


=== Rotate the touchscreen ===
=== Rotate the touchscreen ===


In order to also rotate the touchscreen you need to change the udev rule: <code>/etc/udev/rules.d/90-device-samsung-i9070.rules</code>
In order to also rotate the touchscreen you need to add an udev rule.
And add one of the following line:
 
First, list your device with
<pre>
libinput list-devices
</pre>
 
look for your touchscreen, it should look something like this:
<pre>
Device:          Elan Touchscreen
Kernel:          /dev/input/event0
Group:            1
Seat:            seat0, default
Capabilities:    touch
Tap-to-click:    n/a
Tap-and-drag:    n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      0.00 1.00 0.00 -1.00 0.00 1.00
Scroll methods:  none
Click methods:    none
Disable-w-typing: n/a
Accel profiles:  n/a
Rotation:        n/a
</pre>
 
now, get the device name from udevadm (change event0 according to the Kernel output before):
 
<pre>
udevadm info -a -p /sys/class/input/event0
</pre>
 
in the output find your touchscreen, copy the exact ATTRS{name} line:
 
<pre>
looking at parent device '/devices/soc0/7000c400.i2c/i2c-1/1-0010/input/input0':
    KERNELS=="input0"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{uniq}==""
    ATTRS{properties}=="2"
    ATTRS{phys}==""
    ATTRS{name}=="Elan Touchscreen"
</pre>
 
create a new udev file under:
<pre>
/etc/udev/rules.d/98-touchscreen-cal.rules
</pre>
Add the ATTRS{name} line you copied with a comma:
<pre>
ATTRS{name}=="Elan Touchscreen",
</pre>
 
And add one of the following lines after the comma:
<pre>
<pre>
# Left - 90 degree clockwise
# Left - 90 degree clockwise
Line 28: Line 88:
ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0"
ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0"
</pre>
</pre>
and reboot udev or the device.


NT: If you use the rotate screen code as it is use the # Right option to rotate the touch on the direction of rotated screen.
So you end up with something like this:
 
<pre>
ATTRS{name}=="Elan Touchscreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
</pre>
 
Reboot your device and you are good to go. (a force reload of udevadm isn't enough!)
 
Note: If you use the rotate screen code as it is, use the # Right option to rotate the touch on the direction of rotated screen.
 
== Scaling ==


== Calibrate the touchscreen ==
Xfce4 and Mate Desktop supports gtk apps scaling out of the box.
If you rotate the screen, change/add a value in this file:
As for Qt apps, you need to set up environment variables by
<pre>
<pre>
sudo nano /etc/udev/rules.d/90-android-touch-dev.rules
sudo nano /etc/environment
</pre>
</pre>
and pasting these lines after comments
<pre>
<pre>
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1", \
QT_SCALE_FACTOR=2
# default ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0"
QT_AUTO_SCREEN_SCALE_FACTOR=2
# Left - 90 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0"
# 180 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
# Right - 270 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
# reflect along y axis ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0"
</pre>
</pre>


Line 49: Line 115:


To control display from a terminal, first set DISPLAY environment variable:
To control display from a terminal, first set DISPLAY environment variable:
<source lang="shell">
<syntaxhighlight lang="shell">
export DISPLAY=:0.0
export DISPLAY=:0.0
</source>
</syntaxhighlight>


The <B>xset</B> command can be used to turn display on and off, or set a display timeout value.
The <B>xset</B> command can be used to turn display on and off, or set a display timeout value.
<source lang="shell">
<syntaxhighlight lang="shell">
xset dpms force off    # To turn off display
xset dpms force off    # To turn off display
xset dpms force on    # To turn the display back on
xset dpms force on    # To turn the display back on
xset q                # Prints current display status info
xset q                # Prints current display status info
</source>
</syntaxhighlight>


== Troubleshooting ==
== Troubleshooting ==


Check the logs with <code>logread -f | grep x11</code>
Check the logs with <code>logread -f | grep x11</code> or see the dedicated [[Display/Troubleshooting|Troubleshooting page]]




[[Category:Guide]]
[[Category:Guide]]

Latest revision as of 08:38, 28 January 2025

Icon This page could use some expansion. If you'd like to help out, feel free to edit this article!
In particular: All of this is Xorg-related; needs to be made more universal.

Landscape mode

All these fixes need device reboot.

Rotate the screen

You can rotate adding the following configuration file: /etc/X11/xorg.conf.d/00-fbdev-rotate.conf

Section "Device"
  Identifier "LCD"
  Driver "fbdev"
  Option "Rotate" "CW"
EndSection

Valid values for "Rotate" are "CW" (clockwise, 90 degrees), "UD" (upside down, 180 degrees) and "CCW" (counter clockwise, 270 degrees), see fbdev(4) man page.

Reboot, then open the display app and set the correct resolution.

Rotate the touchscreen

In order to also rotate the touchscreen you need to add an udev rule.

First, list your device with

libinput list-devices

look for your touchscreen, it should look something like this:

Device:           Elan Touchscreen
Kernel:           /dev/input/event0
Group:            1
Seat:             seat0, default
Capabilities:     touch 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      0.00 1.00 0.00 -1.00 0.00 1.00
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   n/a
Rotation:         n/a

now, get the device name from udevadm (change event0 according to the Kernel output before):

udevadm info -a -p /sys/class/input/event0

in the output find your touchscreen, copy the exact ATTRS{name} line:

looking at parent device '/devices/soc0/7000c400.i2c/i2c-1/1-0010/input/input0':
    KERNELS=="input0"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{uniq}==""
    ATTRS{properties}=="2"
    ATTRS{phys}==""
    ATTRS{name}=="Elan Touchscreen"

create a new udev file under:

/etc/udev/rules.d/98-touchscreen-cal.rules

Add the ATTRS{name} line you copied with a comma:

ATTRS{name}=="Elan Touchscreen",

And add one of the following lines after the comma:

# Left - 90 degree clockwise
ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0"
# 180 degree clockwise
ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
# Right - 270 degree clockwise
ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
# reflect along y axis
ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0"

So you end up with something like this:

ATTRS{name}=="Elan Touchscreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"

Reboot your device and you are good to go. (a force reload of udevadm isn't enough!)

Note: If you use the rotate screen code as it is, use the # Right option to rotate the touch on the direction of rotated screen.

Scaling

Xfce4 and Mate Desktop supports gtk apps scaling out of the box. As for Qt apps, you need to set up environment variables by

sudo nano /etc/environment

and pasting these lines after comments

QT_SCALE_FACTOR=2
QT_AUTO_SCREEN_SCALE_FACTOR=2

Display Power Management

To control display from a terminal, first set DISPLAY environment variable:

export DISPLAY=:0.0

The xset command can be used to turn display on and off, or set a display timeout value.

xset dpms force off    # To turn off display
xset dpms force on     # To turn the display back on
xset q                 # Prints current display status info

Troubleshooting

Check the logs with logread -f | grep x11 or see the dedicated Troubleshooting page