mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 20:50:07 +01:00
Fix invalid absinfo range values reported by certain mtk soc
This change will only affect certain touch screens, for which the driver integration code does not provide meaningful values for the allowed range of ABS_MT_TRACKING_IDs. The reported range [0, 0] will be overwritten with [-1, 0xFFFF] Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com> [Changed from INT_MAX to 0xFFFF to match the kernel, add device name to log message] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
fa3c5622de
commit
0028174c0b
1 changed files with 23 additions and 0 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -126,6 +127,26 @@ libevdev_dflt_log_func(enum libevdev_log_priority priority,
|
|||
vfprintf(stderr, format, args);
|
||||
}
|
||||
|
||||
static void
|
||||
fix_invalid_absinfo(const struct libevdev *dev,
|
||||
int axis,
|
||||
struct input_absinfo* abs_info)
|
||||
{
|
||||
/*
|
||||
* The reported absinfo for ABS_MT_TRACKING_ID is sometimes
|
||||
* uninitialized for certain mtk-soc, due to init code mangling
|
||||
* in the vendor kernel.
|
||||
*/
|
||||
if (axis == ABS_MT_TRACKING_ID &&
|
||||
abs_info->maximum == abs_info->minimum) {
|
||||
abs_info->minimum = -1;
|
||||
abs_info->maximum = 0xFFFF;
|
||||
log_bug(dev,
|
||||
"Device \"%s\" has invalid ABS_MT_TRACKING_ID range",
|
||||
dev->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Global logging settings.
|
||||
*/
|
||||
|
|
@ -431,6 +452,8 @@ libevdev_set_fd(struct libevdev* dev, int fd)
|
|||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
fix_invalid_absinfo(dev, i, &abs_info);
|
||||
|
||||
dev->abs_info[i] = abs_info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue