GuLinux / ScreenRotator

Automatic screen rotation daemon for X11
GNU General Public License v3.0
57 stars 18 forks source link

Horizontal/vertical rotation miscalibrated on Linx 810 #27

Open CombatTentacles opened 2 years ago

CombatTentacles commented 2 years ago

Not sure if this was me messing something up or not, but currently my tablet's screen rotation is the exact opposite of where it should be: Turning it horizontally orients the screen to vertical and vice versa. Is there a way to correct this?

Tablet is running Kubuntu 20.04 LTS with Plasma Desktop if this makes any difference.

EDIT: Oh, and using the manual screen rotation setting just seems to confuse it even more, and throws touchscreen calibration off to the point of being unusable as well.

DansDesigns commented 2 years ago

I'm having the same problem, everything works perfectly except the screen is 90 degrees out.. Running Lubuntu 21.04 installed via the iso-respin from Linuxium.. Does anyone have any suggestions on how to fix this issue? Thank you

EDIT: I think the problem is due to these Tablets being Portrait by default, whereas most other tablets are Landscape by default..

EDIT 2: I found this script that rotates the touch input with the screen: https://gist.github.com/mildmojo/48e9025070a2ba40795c, all we need to do now is sort the correct orientation..

DansDesigns commented 2 years ago

Adjusting the following lines in displaymanager.cpp, allows the screen to rotate correctly... (lines 65 - 70)

from:

QHash<Orientation, Rotation> orientation2rotation { {TopUp, RR_Rotate_0}, {TopDown, RR_Rotate_180}, {LeftUp, RR_Rotate_90}, {RightUp, RR_Rotate_270}, };

to:

QHash<Orientation, Rotation> orientation2rotation { {TopUp, RR_Rotate_90}, {TopDown, RR_Rotate_270}, {LeftUp, RR_Rotate_0}, {RightUp, RR_Rotate_180}, };

however the touch is not rotating correctly - I will remove the script mentioned in 'EDIT 2' and try to alter the current deployment settings...

EDIT:

Touchscreen now works correctly with the following changes made to rotateinput.cpp (lines 152 - 169)

from:

`#ifdef USE_XINPUT static QHash<Orientation, QStringList> orientation_matrix_map { {TopUp, {"1", "0", "0", "0", "1", "0", "0", "0", "1"}}, {TopDown, {"-1", "0", "1", "0", "-1", "1", "0", "0", "1"}}, {LeftUp, {"0", "-1", "1", "1", "0", "0", "0", "0", "1"}}, {RightUp, {"0", "1", "0", "-1", "0", "1", "0", "0", "1"}}, }; auto orientation_matrix = orientation_matrix_map[orientation]; for(auto device: d->devices) { do_set_prop_xi2(d->display, device.id, None, 0, "Coordinate Transformation Matrix", orientation_matrix); }

else

static QHash<Orientation, vector> orientation_matrix_map { {TopUp, {1, 0, 0, 0, 1, 0, 0, 0, 1}}, {TopDown, {-1, 0, 1, 0, -1, 1, 0, 0, 1}}, {LeftUp, {0, -1, 1, 1, 0, 0, 0, 0, 1}}, {RightUp, {0, 1, 0, -1, 0, 1, 0, 0, 1}}, };`

to:

`#ifdef USE_XINPUT static QHash<Orientation, QStringList> orientation_matrix_map { {TopUp, {"0", "-1", "1", "1", "0", "0", "0", "0", "1"}}, {TopDown, {"0", "1", "0", "-1", "0", "1", "0", "0", "1"}}, {LeftUp, {"1", "0", "0", "0", "1", "0", "0", "0", "1"}}, {RightUp, {"-1", "0", "1", "0", "-1", "1", "0", "0", "1"}}, }; auto orientation_matrix = orientation_matrix_map[orientation]; for(auto device: d->devices) { do_set_prop_xi2(d->display, device.id, None, 0, "Coordinate Transformation Matrix", orientation_matrix); }

else

static QHash<Orientation, vector> orientation_matrix_map { {TopUp, {0, -1, 1, 1, 0, 0, 0, 0, 1}}, {TopDown, {0, 1, 0, -1, 0, 1, 0, 0, 1}}, {LeftUp, {1, 0, 0, 0, 1, 0, 0, 0, 1}}, {RightUp, {-1, 0, 1, 0, -1, 1, 0, 0, 1}}, };`

With both of these adjustments, my Linx8 Lubuntu 21.04 is running perfectly! I have found evdev-rce brilliant for emulating the hold-to-right-click on the Goodix Capacitive Touchscreens..

DansDesigns commented 2 years ago

I can confirm the above changes work with Lubuntu 20.04, Lubuntu 21.04 and Zorin OS 16.1 running on Linx8 and Linx810.

Full changes: run default build/install process, then browse to: ~/ScreenRotator/src/
modify displaymanager.cpp modify rotateinput.cpp

then rebuild.. (in terminal run:) cd ScreenRotator/build cmake .. make all sudo make install

restart the tablet and enjoy!