[PATCH libinput] tablet: reject tablets without resolution
Peter Hutterer
peter.hutterer at who-t.net
Wed Nov 9 01:24:17 UTC 2016
Fix the kernel driver or get a udev override in place. Tablets not having a
physical size is not ok.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
As the test case shows, this will break waltop tablets so we'll have to fix
those in the udev hwdb
src/evdev-tablet.c | 4 ++++
test/litest-device-waltop-tablet.c | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 14023b6..b840e72 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1712,6 +1712,7 @@ tablet_reject_device(struct evdev_device *device)
{
struct libevdev *evdev = device->evdev;
int rc = -1;
+ double w, h;
if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
!libevdev_has_event_code(evdev, EV_ABS, ABS_Y))
@@ -1720,6 +1721,9 @@ tablet_reject_device(struct evdev_device *device)
if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN))
goto out;
+ if (evdev_device_get_size(device, &w, &h) != 0)
+ goto out;
+
rc = 0;
out:
diff --git a/test/litest-device-waltop-tablet.c b/test/litest-device-waltop-tablet.c
index 880ddf3..3400342 100644
--- a/test/litest-device-waltop-tablet.c
+++ b/test/litest-device-waltop-tablet.c
@@ -227,6 +227,16 @@ static int events[] = {
-1, -1,
};
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"waltop_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"waltop_end\"\n"
+"ENV{ID_INPUT_TABLET}==\"\", GOTO=\"waltop_end\"\n"
+"\n"
+"ATTRS{name}==\"litest WALTOP Batteryless Tablet*\",\\\n"
+" ENV{LIBINPUT_ATTR_SIZE_HINT}=\"200x200\",\n"
+"\n"
+"LABEL=\"touchpad_end\"";
+
struct litest_test_device litest_waltop_tablet_device = {
.type = LITEST_WALTOP,
.features = LITEST_TABLET | LITEST_WHEEL | LITEST_TILT,
@@ -238,4 +248,5 @@ struct litest_test_device litest_waltop_tablet_device = {
.id = &input_id,
.events = events,
.absinfo = absinfo,
+ .udev_rule = udev_rule,
};
--
2.9.3
More information about the wayland-devel
mailing list