Myself5 / Chuwi_Hi10_Air_Linux

Documentation and files on how to install Linux on the Chuwi Hi10 Air
12 stars 0 forks source link

touchscreen offset after rotation and dots per inch incorrect #2

Open wwortel opened 4 years ago

wwortel commented 4 years ago

Two issues:

  1. My Hi10 Air (201908xxxx) must via xandr be set to 'right' orientation to have proper landscape orientation. But 'xandr -o right' results in wrong resolution. The panel is 224 dpi, regardless orientation. So after any rotation detection and xandr action 'xandr --dpi 224' must be issued.

  2. After touchscreen calibration, in regular landscape mode, that matrix ends up in what is called Coordinate Transformation Matrix (170), as shown by the 'xinput list-props silead_ts' command. It is put there from an InputClass section in xorg.conf.d
    libinput makes yet another transformation using 'libinput Calibration Matrix (325)'. That is the one 2in1screen is writing into. But with incorrect scaling, incorrect offsets, and incorrect rotation. Reference is xserver's 'right' orientation which is our landscape. So 'right' has to correspond to doing nothing, i.e. 1 0 0 0 1 0 0 0 1. Because we correct all the time to get back to 224 dpi all transformations away from the landscape situation need to adapt for the different scalings and offsets. What works fine here: 'normal' 0 1.6 0 -0.625 0 0.3125 0 0 1 'inverted' 0 -1.6 0.5 0.625 0 0 0 0 1 'left' -1 0 0.5 0 -1 0.3125 0 0 1

The numbers stem from the 16:10 aspect ratio, maintaining 224 dpi.

The lines edited: sprintf(command, "xrandr -o %s ; xrandr --dpi 224", ROT[current_state]); and char *TOUCH[] = {"-1 0 0.5 0 -1 0.3125 0 0 1", "1 0 0 0 1 0 0 0 1", "0 1.6 0 -0.625 0 0.3125 0 0 1", "0 -1.6 0.5 0.625 0 0 0 0 1"};