Touchscreen coordinates problem

I am trying out Manjaro Gnome (manjaro-gnome-21.3.7-minimal-220816-linux515) live USB on this Windows tablet: X11 2-in-1 Tablet*
My plan is to install Manjaro to the tablet but I wanted to see if things would work out okay before installing it for real.

The problem is that the touchscreen coordinates are not calculated correctly; the touchscreen in itself is functioning and the panel responds to touches, but both the x and y coordinates seem to be inverted. That is, when I tap the lower right corner of the tablet, the item on the upper left corner is clicked. Would there be any way to correct this? Or the situation could change for the better if I install Manjaro on the tablet, instead of running it on live USB?

I tried a couple of things described in Touchscreen - ArchWiki. What I have found so far is that /dev/input/event12 is handling touch events; if I

cat /dev/input/event12

then every time I touch the screen, I can see some non-readable characters printed to the terminal (i.e. stdout).

This is what event12 looks like in /proc/bus/input/devices:

I: Bus=0018 Vendor=27c6 Product=011a Version=0100
N: Name="GXTP7380:00 27C6:011A"
P: Phys=i2c-GXTP7380:00
S: Sysfs=/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-8/i2c-GXTP7380:00/0018:27C6:011A.0007/input/input28
U: Uniq=
H: Handlers=event12 mouse2 
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=260800000000003

Results of inxi -v7azy:
https://paste.c-net.org/CreditRepay

*Please note that the information on my profile page is about a different Manjaro, the one that I run on a laptop and use as my daily driver.

The content of /dev/ is dynamically created at boot so, whatever eventNumber will no longer be relevant. A reason why xorg,conf.d/*.conf files contain

MatchDevicePath "/dev/input/event*"

Either way, this is important now

I think is a Goodix Touchscreen.
But what you need is to set the correct matrix of the touchscreen via udev rule.
Create the file if does not exist
/etc/udev/rules.d/99-touchscreen.rules and add this to it:

ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"

Save it, reboot and test again.
From what i’m getting even that would not be required, and also if you use the libwacom with xf86-input-wacom even the Stylus should be possible to calibrate correctly without much fuss.

This might help a bit Calibrating Touchscreen - ArchWiki
Also i recommend Tablet PC - ArchWiki
And Multitouch displays - ArchWiki

1 Like

Great, thanks. I think I need to install Manjaro on the tablet as it takes rebooting and applying the rule changes. I’ll go ahead with the installation and see if your matrix works within a couple of days.

I installed Manjaro on the tablet and created the file /etc/udev/rules.d/99-touchscreen.rules and put the rule

ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"

in the file but the same problem is persisting (i.e. both x and y coordinates are inverted). I also changed the transformation matrix to random ones to see if it does anything, e.g. to

ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 -1 0 -1 0 1"

and rebooted the tablet. But it did not have any effect either.

I also tried

sudo udevadm --reload-rules && udevadm trigger

But this too did not have any effect.

Is there a way to check if the udev rules in /etc/udev/rules.d have been loaded and applied?

Those will be ignored anyway, see how to calculate the matrix
Also, you have to use the libinput driver … even tho you might use the wacom driver for the Stylus part … But if you use the wacom driver, then this is the approach

In other cases you have to go with a config in /usr/share/X11/xorg.conf.d/99-touch_calibration.conf for example and have for 90 degrees:

Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"

or for 180 degrees

Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"

You have to see also if you rotate it clockwise or counterclockwise … in some cases that goes with the stylus too.

1 Like

Thanks again

Also, you have to use the libinput driver … even tho you might use the wacom driver for the Stylus part …

You mean using libinput for touchscreen? Is there a way to check whether I am using the libinput driver or wacom driver? On this page, it says

If you installed either Xorg or Wayland, then Libinput should already be installed as a dependency; there are no necessary extra packages.

and indeed, if I run pacman -Ss libinput, I see

extra/libinput 1.21.0-1 [installed]
    Input device management and event handling library
extra/xf86-input-libinput 1.2.1-1 (xorg-drivers) [installed]
    Generic input driver for the X.Org server based on libinput

So the library is installed for sure, but I haven’t been able to find a way to check if I’m using libinput or something else instead.

In other cases you have to go with a config in /usr/share/X11/xorg.conf.d/99-touch_calibration.conf for example and have for 90 degrees:

I tried the Option "TransformationMatrix" in both /usr/share/X11/xorg.conf.d/99-touch_calibration.conf and /etc/X11/xorg.conf.d/99-touch_calibration.conf but haven’t got any luck with either.

In either of the 2 attempts, after creating the config file that would rotate the screen 180 degrees, like so:

Section "InputClass"
  Identifier "libinput touchscreen catchall"
  MatchIsTouchscreen "on"
  MatchDevicePath "/dev/input/event*"
  Driver "libinput"
  Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
EndSection

and rebooting the computer, libinput list-devices still shows

Device: GXTP7380:00 27C6:011A
Kernel: /dev/input/event11
Group: 8
Seat: seat0, default
Size: 219x137mm
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: identity matrix

So it looks as if the configuration is not being applied.

You have to see also if you rotate it clockwise or counterclockwise … in some cases that goes with the stylus too.

Does this apply when rotating the screen by 180 degrees? I’m certain that 180 is how much I need to rotate as the tapping on the bottom right corner is interpreted as tapping on the top left corner of the screen.

When I was working (years ago) with a series of (linux-)devices with touch, there was a program that would do this (calibrate ???)
(You could start it with the help of a mouse :wink: )

  • It prints a crosshair in a corner,
  • and you would have to tap on it
    this was repeated 4 times. (and a 5th one in the middle)

After that, the program was able to recalculate all the parameters for the touchscreen. Then these were installed and used from that point forward (no reboot required, but persistent after reboot).

I find it hard to believe that you have to calculate this by hand these days
(and no this has nothing to do with rotating the screen :wink: )

This has been with gentoo ans was ca. 2005. The following picture seems to be a newer version which looks similar

I think it was called “calibrate”

1 Like

Thanks for the advice @andreas85. If you remember the name of the calibrator application, please let me know.

So far I’ve tried a few ways to set the transformation matrix but none has worked. From what I’ve seen, none of them gives me any explicit errors. It’s just that they do not have any effect.

I also found that the goodix module file is in

/lib/modules/5.15.76-1-MANJARO/kernel/drivers/input/touchscreen/goodix.ko.xz

and I checked if the module is loaded by the system and found it is not. So I manually loaded it with sudo modprobe goodix and tried setting the transformation matrix again but the situation did not change.