Screen Calibration: Difference between revisions
m →Adjust the generated values: fix typo |
m →libinput: typo |
||
Line 17: | Line 17: | ||
Modern [[Device specific package|device specific packages]] will generate the udev-rule automatically then, and as nice side-effect it will also work in <code>osk-sdl</code>. | Modern [[Device specific package|device specific packages]] will generate the udev-rule automatically then, and as nice side-effect it will also work in <code>osk-sdl</code>. | ||
(If your device package does not generate the udev rule, please adjust the <code>build()</code> and <code>install()</code> | (If your device package does not generate the udev rule, please adjust the <code>build()</code> and <code>install()</code> functions as described [[Device specific package|here]].) | ||
==== Calibration (needed for resistive touch screens and or when the touch screen is rotated) ==== | ==== Calibration (needed for resistive touch screens and or when the touch screen is rotated) ==== |
Revision as of 20:41, 4 April 2018
Framebuffer
On most Android devices, a somewhat working framebuffer is required to get Weston and other Wayland compositors running. The alternative to framebuffer would be DRI.
If your framebuffer does not work out of the box, try the following:
- Boot TWRP/Android and read out the correct framebuffer configurations from the /sys... paths and try to set them in pmOS
- If you made it work, create an initfs hook, that instantly sets the framebuffer right. Example
If the screen looks laggy, it might be a known issue with refresh rate. It can be solved by hardcoding the refresh rate in the video driver, see mdss_fb_refresh_rate.patch.
Touch screen
libinput
This library is used by almost everything accessing your touch screen (e.g. Weston, X11, kwin). Just follow these instructions to set your deviceinfo_dev_touchscreen
variable in the deviceinfo file.
Modern device specific packages will generate the udev-rule automatically then, and as nice side-effect it will also work in osk-sdl
.
(If your device package does not generate the udev rule, please adjust the build()
and install()
functions as described here.)
Calibration (needed for resistive touch screens and or when the touch screen is rotated)
Please test first if your device works without any special calibration - in most cases you don't need it!
- Install postmarketOS with Weston on your phone
- Connect to your phone via SSH
- Run
weston-calibrator
- (Optional) check below how to adjust the values. As it is hard to hit the crosses in weston-calibrator exactly you will get slightly wrong values easily but usually it is also easy to find out what the exact values are.
- Adjust your
deviceinfo_dev_touchscreen_calibration
to the output fromweston-calibrator
(example).
Adjust the generated values
Let the 6 calibration values be A B C D E F
. Then the x and y coordinate of the touch input are translated into x' = Ax + By + C
and y' = Dx + Ey + F
according to #182.
Basically this means the following:
- Unless your touchscreen is slightly rotated (i.e., not 90° but like 1° or 2°), which is very unlikely, either A and E or B and D should be 0. If you get values close to 0 (i.e., smaller than 0.1 or so, larger values if you were not so precise) just set them to 0.
- The non-zero values of A, B, D and E should usually be 1 or -1. If you get values close to that, just set them to 1 or -1. At least for the Samsung n5110
weston-calibrator
returned the aspect ratio of the screen (i.e., width/height or height/width) for these values. While this might be another likely value, it turned out to be wrong and 1/-1 turned out to be correct. - The remaining two values, C and F, are pixel offsets. Therefore, you can easily get -20 or +17 here depending on how accurate you were. If your touchscreen has the same size as the display, these values should be either set to 0 or the display width or height (then probably in combination with a -1 for the same dimension, e.g. "0 1 0 -1 0 800" for a display height of 800px). Note that these last values have a different meaning in X.Org/libinput: here, it seems, the values are multiplied by the device width/height, so instead of the height/width, use 1.
If you have doubts if a certain value should be 0 or not, a good test is also to just run weston-calibrator
multiple times. If the value is sometimes positive, sometimes negative, it should be 0.
Legacy
libinput: old method
logread -f | grep weston
Here is how to do it without devicepkg-dev
(not recommended, for reference only).
- Make sure, that Weston runs on the device
- Look in the logs (via SSH) for the touch device name. For
lg-mako
, the name istouch_dev
, but it may be different for your device. - Copy 90-android-touch-dev.rules from
device-lg-mako
to your device's aport. Replacetouch_dev
with your touch device name. Adjust theAPKBUILD
, so it gets installed properly (Example)
SUBSYSTEM=="input", ATTRS{name}=="touch_dev", \ ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1"
Reload udev rules:
# Reload all rules
udevadm control --reload
# Re-apply those rules on all devices
udevadm trigger