Touch rotation on Ubuntu 18.04 and 20.04

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 20 22:46:36 UTC 2020


On Tue, Oct 20, 2020 at 05:00:42PM +0900, Hugh Chang wrote:
> I have a question about setting the transformation matrix value to rotate
> touch coordinates on Ubuntu 18.04 and 20.04.
> 
> I used 2 portrait monitors.
> 
> +-----------+ +-----------+
> | 1080x1920 | | 1080x1920 |
> |  (touch)  | |           |
> |           | |           |
> +-----------+ +-----------+
> 
> I used "TransformationMatrix" option in a configuration file.
> 
>   root at touch-desktop:/usr/share/X11/xorg.conf.d# more 77-touch-matrix.conf
>   Section "InputClass"
>     Identifier "Touch rotation"
>     MatchUSBID "2965:*"
>     MatchDevicePath "/dev/input/event*"
>     Driver "evdev" for Ubuntu 16.04, "libinput" for Ubuntu 18.04/20.04

just skip this line and let the default snippets take care of it. Given that
this is a server option anyway, you don't need to assign a driver.

>     Option "TransformationMatrix" "0 -0.5 0.5 1 0 0 0 0 1"
>   EndSection
> 
> It works well on Ubuntu 16.04 and Ubuntu 20.04, but does not work on Ubuntu
> 18.04.
> 
> As a workaround, I'm executing "xinput set-prop" as a startup script.
> 
>   touch at touchDT:~$ more .profile
>   /home/touch/set-matrix.sh &
> 
>   touch at touchDT:~$ more set-matrix.sh
>   #!/bin/bash
>   sleep 30
>   /usr/bin/xinput set-prop 10 "Coordinate Transformation Matrix" 0 -0.5 0.5
> 1 0 0 0 0 1
> 
> I don't like it because
> 1) I'm using 30 seconds delay because the matrix is initialized during the
> startup phase and I want to confirm that my code is executed later.
> 2) The matrix value is sometimes changed while the system is turned on and
> under use.
> 
> Would you help me please?

run xinput watch-props "whatever device name" to check if it is being reset.
could be that something in your desktop environment is interfering, but
given it works on 20.04 whatever it is is likely fixed since.

> Another related question is about eGalaxTouch.
> If I change my monitor to a monitor with eGalaxTouch device,
> the matrix value is automatically updated if I change the geometry of the
> monitors, only on Ubuntu 20.04.
> 
>   touch at touchDT:~/Desktop$ xinput list-props 13
>   Device 'eGalax Inc. eGalaxTouch P80H84 0765 v00T3_M02 k4.08.165':
>     Device Enabled (161):   1
>     Coordinate Transformation Matrix (163): 0.000000, -0.500000, 1.000000,
> 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000
> 
> I did not install the driver of it and did not run the daemon program (
> /bin/eGTouchD).
> I wonder how the matrix value is set correctly and touch works well even if
> I did not specify it on Ubuntu 20.04. For other touch monitors, I need to
> specify it manually in a configuration file.
> 
> Would you let me know where to start my investigation please?

GNOME's mutter has an automatic touch screen mapping using heuristics. This
may be the reason it fails on 18.04 if the heuristics get confused. Two
identical screens, neither of them is a built-in one so there's no clear
choice what to map it to. That'd be my first guess anyway.

Cheers,
   Peter




More information about the xorg mailing list