diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2019-06-17 13:25:59 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2019-06-17 14:39:58 +1000 |
commit | 9cb089f2b68ba21877ea0973c08837cf073679c8 (patch) | |
tree | 3204433c9fa0312f5e81ebe37dfa90b40661b408 /test | |
parent | d13e11c24fbfe4859d3c054e59902226c16c9fe5 (diff) | |
download | libinput-9cb089f2b68ba21877ea0973c08837cf073679c8.tar.gz |
tablet: disable the forced proximity out for the Dell Canvas pen
This pen has random timeouts, often when a button is pressed. This causes a
forced proximity out (and the button release) and makes the whole device a
tad unusable.
Nothing we can detect by heuristics since it looks like other devices that
don't send proximity out events. And the timeout can be quite high, the
recording in #304 has over 800ms for one sequence.
Fixes #304
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/litest-device-wacom-isdv4-4200-pen.c | 110 | ||||
-rw-r--r-- | test/litest.h | 1 | ||||
-rw-r--r-- | test/test-tablet.c | 29 |
3 files changed, 140 insertions, 0 deletions
diff --git a/test/litest-device-wacom-isdv4-4200-pen.c b/test/litest-device-wacom-isdv4-4200-pen.c new file mode 100644 index 00000000..2627138f --- /dev/null +++ b/test/litest-device-wacom-isdv4-4200-pen.c @@ -0,0 +1,110 @@ +/* + * Copyright © 2019 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#include "litest.h" +#include "litest-int.h" + +static struct input_event proximity_in[] = { + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event proximity_out[] = { + { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event motion[] = { + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static int +get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) +{ + switch (evcode) { + case ABS_PRESSURE: + *value = 4000; + return 0; + case ABS_TILT_X: + case ABS_TILT_Y: + abort(); + } + return 1; +} + +static struct litest_device_interface interface = { + .tablet_proximity_in_events = proximity_in, + .tablet_proximity_out_events = proximity_out, + .tablet_motion_events = motion, + + .get_axis_default = get_axis_default, +}; + +static struct input_absinfo absinfo[] = { + { ABS_X, 0, 59674, 0, 0, 100 }, + { ABS_Y, 0, 33566, 0, 0, 100 }, + /* This pen has tilt, but doesn't send events */ + { ABS_TILT_X, -9000, 9000, 0, 0, 5730 }, + { ABS_TILT_Y, -9000, 9000, 0, 0, 5730 }, + { ABS_PRESSURE, 0, 4096, 0, 0, 0 }, + { .value = -1 }, +}; + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x56a, + .product = 0x4200, +}; + +static int events[] = { + EV_KEY, BTN_TOOL_PEN, + EV_KEY, BTN_TOOL_RUBBER, + EV_KEY, BTN_TOUCH, + EV_KEY, BTN_STYLUS, + EV_KEY, BTN_STYLUS2, + EV_KEY, BTN_STYLUS3, + INPUT_PROP_MAX, INPUT_PROP_DIRECT, + -1, -1, +}; + +TEST_DEVICE("wacom-isdv4-4200-tablet", + .type = LITEST_WACOM_ISDV4_4200_PEN, + .features = LITEST_TABLET|LITEST_HOVER, + .interface = &interface, + + .name = "Wacom ISD-V4 Pen", + .id = &input_id, + .events = events, + .absinfo = absinfo, +) diff --git a/test/litest.h b/test/litest.h index c02943bf..af63877c 100644 --- a/test/litest.h +++ b/test/litest.h @@ -299,6 +299,7 @@ enum litest_device_type { LITEST_TOUCHSCREEN_MT_TOOL_TYPE, LITEST_DELL_CANVAS_TOTEM, LITEST_DELL_CANVAS_TOTEM_TOUCH, + LITEST_WACOM_ISDV4_4200_PEN, }; enum litest_device_feature { diff --git a/test/test-tablet.c b/test/test-tablet.c index 12beba9f..5f652613 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -1532,6 +1532,34 @@ START_TEST(proximity_out_slow_event) } END_TEST +START_TEST(proximity_out_no_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_PRESSURE, 0 }, + { -1, -1 } + }; + + litest_drain_events(li); + + litest_tablet_proximity_in(dev, 10, 10, axes); + litest_assert_tablet_proximity_event(li, + LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); + litest_tablet_motion(dev, 12, 12, axes); + litest_drain_events(li); + + litest_timeout_tablet_proxout(); + litest_assert_empty_queue(li); + + litest_tablet_proximity_out(dev); + /* The forced prox out */ + litest_assert_tablet_proximity_event(li, + LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); + litest_assert_empty_queue(li); +} +END_TEST + START_TEST(proximity_out_on_delete) { struct libinput *li = litest_create_context(); @@ -5678,6 +5706,7 @@ TEST_COLLECTION(tablet) litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY); litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY); litest_add("tablet:proximity", proximity_out_slow_event, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); + litest_add_for_device("tablet:proximity", proximity_out_no_timeout, LITEST_WACOM_ISDV4_4200_PEN); litest_add_no_device("tablet:proximity", proximity_out_on_delete); litest_add("tablet:button", button_down_up, LITEST_TABLET, LITEST_ANY); |