mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-22 17:20:39 +01:00
evdev: load the LIBINPUT_CALIBRATION_MATRIX as default matrix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
ea00ff9114
commit
d5136c6cb9
3 changed files with 17 additions and 8 deletions
19
src/evdev.c
19
src/evdev.c
|
|
@ -612,15 +612,11 @@ static int
|
|||
evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
|
||||
float matrix[6])
|
||||
{
|
||||
struct matrix m;
|
||||
struct evdev_device *device = (struct evdev_device*)libinput_device;
|
||||
|
||||
/* Always return the identity matrix for now. In the future, this
|
||||
should return the WL_CALIBRATION matrix defined as default
|
||||
matrix for this device */
|
||||
matrix_init_identity(&m);
|
||||
matrix_to_farray6(&m, matrix);
|
||||
matrix_to_farray6(&device->abs.default_calibration, matrix);
|
||||
|
||||
return !matrix_is_identity(&m);
|
||||
return !matrix_is_identity(&device->abs.default_calibration);
|
||||
}
|
||||
|
||||
struct evdev_dispatch_interface fallback_interface = {
|
||||
|
|
@ -956,6 +952,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
|
||||
matrix_init_identity(&device->abs.calibration);
|
||||
matrix_init_identity(&device->abs.usermatrix);
|
||||
matrix_init_identity(&device->abs.default_calibration);
|
||||
|
||||
if (evdev_configure_device(device) == -1)
|
||||
goto err;
|
||||
|
|
@ -1026,6 +1023,14 @@ evdev_device_get_id_vendor(struct evdev_device *device)
|
|||
return libevdev_get_id_vendor(device->evdev);
|
||||
}
|
||||
|
||||
void
|
||||
evdev_device_set_default_calibration(struct evdev_device *device,
|
||||
const float calibration[6])
|
||||
{
|
||||
matrix_from_farray6(&device->abs.default_calibration, calibration);
|
||||
evdev_device_calibrate(device, calibration);
|
||||
}
|
||||
|
||||
void
|
||||
evdev_device_calibrate(struct evdev_device *device,
|
||||
const float calibration[6])
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ struct evdev_device {
|
|||
|
||||
int apply_calibration;
|
||||
struct matrix calibration;
|
||||
struct matrix default_calibration; /* from LIBINPUT_CALIBRATION_MATRIX */
|
||||
struct matrix usermatrix; /* as supplied by the caller */
|
||||
} abs;
|
||||
|
||||
|
|
@ -160,6 +161,9 @@ evdev_device_get_id_product(struct evdev_device *device);
|
|||
unsigned int
|
||||
evdev_device_get_id_vendor(struct evdev_device *device);
|
||||
|
||||
void
|
||||
evdev_device_set_default_calibration(struct evdev_device *device,
|
||||
const float calibration[6]);
|
||||
void
|
||||
evdev_device_calibrate(struct evdev_device *device,
|
||||
const float calibration[6]);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
|
|||
&calibration[3],
|
||||
&calibration[4],
|
||||
&calibration[5]) == 6) {
|
||||
evdev_device_calibrate(device, calibration);
|
||||
evdev_device_set_default_calibration(device, calibration);
|
||||
log_info(&input->base,
|
||||
"Applying calibration: %f %f %f %f %f %f\n",
|
||||
calibration[0],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue