Screen Calibration

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 (NOTE: old, later replaced by MDSS driver).

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
See also touchscreen troubleshooting.

libinput
This library is used by almost everything accessing your touch screen (e.g. Weston, X11, kwin). Just follow these instructions to set your  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.

If your device package does not generate the udev rule, please adjust the  and   functions as described here. For debugging use the libinput Helper tools, e.g. ; Static device configuration via udev lists the configuration possibilities via udev.

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
 * (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  to the output from   (example).

Adjust the generated values
Let the 6 calibration values be. Then the x and y coordinate of the touch input are translated into  and   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  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  multiple times. If the value is sometimes positive, sometimes negative, it should be 0.

Further information about the calibration matrix can be found in the libinput documentation.

tslib
If  does not work for you, consider using   and converting the resulting calibration data afterwards (see  and this mail).

libinput: old method
Here is how to do it without  (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, the name is  , but it may be different for your device.
 * Copy 90-android-touch-dev.rules from  to your device's aport. Replace   with your touch device name. Adjust the , so it gets installed properly (Example)

SUBSYSTEM==&quot;input&quot;, ATTRS{name}==&quot;touch_dev&quot;, \ ENV{ID_INPUT}=&quot;1&quot;, ENV{ID_INPUT_TOUCHSCREEN}=&quot;1&quot; Reload udev rules: