Touch screen with X multi monitor setup

From: Milan Obuch <freebsd-x11_at_dino.sk>
Date: Thu, 09 Nov 2023 08:10:10 UTC
Hi,

after some years using Acer T231H1 monitor for its monitor role, I
decided now to try its touch screen interface. It uses USB interface,
plugging it into my workstation shows just

kernel: ugen0.6: <AcerA Bell T231HlTouchScreen> at usbus0

in dmesg/console output. One hint I've got was use multimedia/webcamd,
and, indeed, running

# webcamd -d ugen0.6
webcamd 4480 - - Attached to ugen0.6[0]
webcamd 4480 - - Creating /dev/input/event6

makes me partially happy - X now automagically knows about my
touchscreen and touches are 'converted' into clicks at some absolute
location.

In Xorg.0.log, I found following lines relevant to this:

[3835573.898] (II) config/udev: Adding input device AcerA Bell T231HlTouchScreen (/dev/input/event6)
[3835573.899] (**) AcerA Bell T231HlTouchScreen: Applying InputClass "libinput touchscreen catchall"
[3835573.899] (II) Using input driver 'libinput' for 'AcerA Bell T231HlTouchScreen'
[3835573.899] (**) AcerA Bell T231HlTouchScreen: always reports core events
[3835573.900] (**) Option "Device" "/dev/input/event6"
[3835574.032] (II) event6  - AcerA Bell T231HlTouchScreen: is tagged by udev as: Touchscreen
[3835574.035] (II) event6  - AcerA Bell T231HlTouchScreen: device is a touch device
[3835574.047] (II) event6  - AcerA Bell T231HlTouchScreen: device removed
[3835574.060] (**) Option "config_info" "udev:/dev/input/event6"
[3835574.060] (II) XINPUT: Adding extended input device "AcerA Bell T231HlTouchScreen" (type: TOUCHSCREEN, id 12)
[3835574.086] (**) Option "AccelerationScheme" "none"
[3835574.117] (**) AcerA Bell T231HlTouchScreen: (accel) selected scheme none/0
[3835574.117] (**) AcerA Bell T231HlTouchScreen: (accel) acceleration factor: 2.000
[3835574.117] (**) AcerA Bell T231HlTouchScreen: (accel) acceleration threshold: 4
[3835574.253] (II) event6  - AcerA Bell T231HlTouchScreen: is tagged by udev as: Touchscreen
[3835574.257] (II) event6  - AcerA Bell T231HlTouchScreen: device is a touch device

So far so good, if I were using single monitor setup for this box,
probably everything would be just right. That's not the case, however,
and this is where things are starting to be somewhat cmplicated.
Reduced output from 'xrandr' is

Screen 0: minimum 320 x 200, current 2944 x 1080, maximum 8192 x 8192
DVI-D-1 connected primary 1920x1080+1024+0 (normal left inverted right x axis y axis) 510mm x 287mm
   1920x1080     60.00*+  59.96    59.93
[ deleted inactive resolutions ]
VGA-1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.04    60.00*
[ deleted inactive resolutions ]

Acer monitor with touch screen is connected via DVI-D-1 connector in
this case. Problem is absolute location of touch being not correct,
coordinate Y (up/down) is OK, but coordinate X (left/right) is not.
When touching near right edge of screen, it is almost correct, as seen
where cursor is being placed after touch, but when touching elsewhere,
cursor is located left of the place being touched, proportionally, so
when touching near left edge of screen, cursor is being located onto
left, non touch screen, monitor. This is probably caused by stretching
touch area (1920x1080) over whole virtual screen (2944x1080).

Could I describe it better? Probably yes, hopefully it is accurate.
Could someone give me a hint what I can try to fix this issue? Probably
some config file for this device could remedy it, but I have no idea
where to start. In past, I used some monolitic static configuration
file. As it was not necessary for some time, I am using just what's
autoconfigured and changing setup with xrandr in multi monitor case.

I found graphics/tslib could be used for various touch screen
processing, I just have no understanding now where it would fit into
the whole thing...

And, one more idea, how could I use multiple touch screen monitors? At
present, I have no such setup, but there are various small computers
with multiple video connectors, often dual HDMI, so I can imagine it
could be usefull. And how about rotated screen? For tablets and touch
screen notebooks, it could be often the case (my GPD small notebook, not
touch screen, has 1280x720 resolution, but it is actually rotated
720x1280 screen).

Regards,
Milan