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>
This commit is contained in:
Peter Hutterer 2016-11-04 12:50:35 +10:00
parent d308022fb3
commit dbeb2f7916
2 changed files with 15 additions and 0 deletions

View file

@ -1712,6 +1712,7 @@ tablet_reject_device(struct evdev_device *device)
{ {
struct libevdev *evdev = device->evdev; struct libevdev *evdev = device->evdev;
int rc = -1; int rc = -1;
double w, h;
if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) || if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
!libevdev_has_event_code(evdev, EV_ABS, ABS_Y)) !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)) if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN))
goto out; goto out;
if (evdev_device_get_size(device, &w, &h) != 0)
goto out;
rc = 0; rc = 0;
out: out:

View file

@ -227,6 +227,16 @@ static int events[] = {
-1, -1, -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 = { struct litest_test_device litest_waltop_tablet_device = {
.type = LITEST_WALTOP, .type = LITEST_WALTOP,
.features = LITEST_TABLET | LITEST_WHEEL | LITEST_TILT, .features = LITEST_TABLET | LITEST_WHEEL | LITEST_TILT,
@ -238,4 +248,5 @@ struct litest_test_device litest_waltop_tablet_device = {
.id = &input_id, .id = &input_id,
.events = events, .events = events,
.absinfo = absinfo, .absinfo = absinfo,
.udev_rule = udev_rule,
}; };