summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-11-04 12:50:35 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-11-29 11:25:24 +1000
commitdbeb2f791635a1a01582eaafda36e85e178168cc (patch)
treed6063b80246512d83542527e0e6ea00a2063aad8
parentd308022fb391d39fab7d6b8c64e31376981090e6 (diff)
tablet: reject tablets without resolution
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@who-t.net>
-rw-r--r--src/evdev-tablet.c4
-rw-r--r--test/litest-device-waltop-tablet.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 14023b60..b840e724 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 880ddf3e..34003428 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,
};