kreijack / xlibinput_calibrator

Touch calibrator for libinput
MIT License
21 stars 12 forks source link

Fix "Unable to find Device" for touchscreen as a mouse device #3

Closed vizv closed 2 years ago

vizv commented 2 years ago

I got a eGalax USB Touchscreen identified as mouse but has libinput Calibration Matrix property, it works with --device-id mentioned in #2 but not --device-name which gives "Unable to find Device" error.

This PR fixed such issue, however it's nice to do a proper check for the existence of libinput Calibration Matrix property.

kreijack commented 2 years ago

NACK, if you have both a mouse and a touch, there is the possibility that your patch picks the mouse as input device instead of the touch.

And even if there is only a mouse, it is possible to "calibrate" the mouse with very funny results :O

You are right when you say that the logic behind the selection of the device by id or by name should not be constrained by the devices[].type field.

So I think that we should consider the following cases:

1) no --device-id or --device-name If there is only one eligible device (a xi_touchscreen one), pick this one Otherwise throw an error, and let the user to explicitly select a device

2) --device-id passed Pick the device that matches the passed device-id ignoring if it is a xi_touchscreen or not

2) --device-name passed Pick the device that matches the passed device-name ignoring if it is a xi_touchscreen or not

I have to point out that with the v0.9, if the "libinput Calibration Matrix" doesn't exist, the "Coordinate Transformation Matrix" is used.

kreijack commented 2 years ago

Please try my devel branch. Now it is (should be) possible to select any device using --device-id and/or --device-name.

If this solve please let me know, so I will update the master branch

vizv commented 2 years ago

That works, thanks