[PATCH libevdev] fix invalid absinfo range values reported by certain mtk soc
Andreas Pokorny
andreas.pokorny at canonical.com
Sun Aug 23 09:27:28 PDT 2015
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, INT_MAX]
Signed-off-by: Andreas Pokorny <andreas.pokorny at canonical.com>
---
libevdev/libevdev.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 3a82fc7..2c87c3b 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -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,24 @@ 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 = 0x7FFFFFFF;
+ log_bug(dev, "Invalid input_absinfo structure for ABS_MT_TRACKING_ID provided\n");
+ }
+}
+
/*
* Global logging settings.
*/
@@ -431,6 +450,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;
}
}
--
2.1.4
More information about the Input-tools
mailing list