mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-07 18:58:03 +02:00
evdev: use safe_atod to convert the matrix values
Avoids parsing issues when we're in different locales
https://bugs.freedesktop.org/show_bug.cgi?id=98828
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 98793f6b43)
This commit is contained in:
parent
5181be6cbc
commit
8e6d3301b8
1 changed files with 16 additions and 10 deletions
26
src/evdev.c
26
src/evdev.c
|
|
@ -2980,7 +2980,8 @@ evdev_read_calibration_prop(struct evdev_device *device)
|
||||||
{
|
{
|
||||||
const char *calibration_values;
|
const char *calibration_values;
|
||||||
float calibration[6];
|
float calibration[6];
|
||||||
int nread;
|
int idx;
|
||||||
|
char **strv;
|
||||||
|
|
||||||
calibration_values =
|
calibration_values =
|
||||||
udev_device_get_property_value(device->udev_device,
|
udev_device_get_property_value(device->udev_device,
|
||||||
|
|
@ -2992,17 +2993,22 @@ evdev_read_calibration_prop(struct evdev_device *device)
|
||||||
if (!device->abs.absinfo_x || !device->abs.absinfo_y)
|
if (!device->abs.absinfo_x || !device->abs.absinfo_y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nread = sscanf(calibration_values,
|
strv = strv_from_string(calibration_values, " ");
|
||||||
"%f %f %f %f %f %f",
|
if (!strv)
|
||||||
&calibration[0],
|
|
||||||
&calibration[1],
|
|
||||||
&calibration[2],
|
|
||||||
&calibration[3],
|
|
||||||
&calibration[4],
|
|
||||||
&calibration[5]);
|
|
||||||
if (nread != 6)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (idx = 0; idx < 6; idx++) {
|
||||||
|
double v;
|
||||||
|
if (strv[idx] == NULL || !safe_atod(strv[idx], &v)) {
|
||||||
|
strv_free(strv);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
calibration[idx] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
strv_free(strv);
|
||||||
|
|
||||||
evdev_device_set_default_calibration(device, calibration);
|
evdev_device_set_default_calibration(device, calibration);
|
||||||
log_info(evdev_libinput_context(device),
|
log_info(evdev_libinput_context(device),
|
||||||
"Applying calibration: %f %f %f %f %f %f\n",
|
"Applying calibration: %f %f %f %f %f %f\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue