Touchscreen calibration matrix changes

Pekka Paalanen ppaalanen at gmail.com
Tue Apr 5 14:21:21 UTC 2022


On Tue, 29 Mar 2022 15:31:59 +0300
Teemu K <maillinglists18 at gmail.com> wrote:

> Hi,
> 
> I'm trying to get touch calibration working on Wayland/Weston for
> resistive touch. I can get the calibration points and calculate
> calibration matrix values, but when I call
> libinput_device_config_calibration_set_matrix and then read it back it
> would seem that the matrix is changed, but the actual touchscreen does
> not indicate so. Ie. if I calibrate the touch clearly wrong it still
> behaves like it would have been calibrated perfectly.

Hi,

what exactly do you mean by "when I call
libinput_device_config_calibration_set_matrix", what is "I" there?

> If I set the same values to udev rule like this:
> ATTRS{name}=="tsc2007", ENV{LIBINPUT_CALIBRATION_MATRIX}="1.29342,
> -0.0223598, -0.135092, -0.0272545, -1.11435, 1.04368"
> 
> They get taken in use and I can read those values as default values
> with libinput_device_config_calibration_get_default_matrix - function.

That's right.

> Is there something else that needs to be done to get the updated
> matrix taken in use or is there known issue with Wayland/Weston given
> that it is quite old version Wayland 1.17.0/Weston 6.0.1.
> Unfortunately I'm stuck with those versions for now.

I'm not sure what problem you have. The udev rule works, right?

Or do you mean updating the calibration matrix while Weston is already
running?

Did you write a new program that simply calls
libinput_device_config_calibration_set_matrix() and then expect Weston
to pick that up when you run it?

If so, then libinput just does not work that way. There is no persistent
configuration in libinput, and any setting you make is local in the
in-memory libinput data structure. The udev rules are the persistent
configuration. That's why e.g. calibration_helper option exists in
weston.ini, so that you could have your own way of storing the
calibration in udev rules.

It looks like clients/touch-calibrator.c existed already in Weston
6.0.0. It's a ready-made calibration tool that computes
LIBINPUT_CALIBRATION_MATRIX values, and uploads those to Weston. You
need weston.ini option touchscreen_calibrator=true to make it work, and
the calibration_helper option to save the calibration persistent. These
are described in the weston.ini man page, and there is an example
script at
https://gitlab.freedesktop.org/wayland/weston/-/blob/main/doc/scripts/calibration-helper.bash

The option touchscreen_calibrator=true exposes a Wayland extension that
allows both getting raw touch coordinates and uploading a new
calibration matrix to Weston. This is the only way to update the matrix
without restarting Weston.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20220405/9eabc7a8/attachment.sig>


More information about the wayland-devel mailing list