From 3927b63207e0d4eb43af06fbd60b93bff3ce4afe Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 2 Mar 2015 16:48:51 +1000 Subject: [PATCH 1/9] cosmetic: more duplicate empty line removal This should be it now, finally... Signed-off-by: Peter Hutterer --- include/linux/input.h | 3 --- src/filter-private.h | 1 - src/filter.h | 1 - test/litest-alps-semi-mt.c | 1 - test/path.c | 1 - test/touch.c | 1 - 6 files changed, 8 deletions(-) diff --git a/include/linux/input.h b/include/linux/input.h index 39b550b5..2ac46630 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -8,13 +8,11 @@ #ifndef _INPUT_H #define _INPUT_H - #include #include #include #include - /* * The event structure itself */ @@ -835,7 +833,6 @@ struct input_keymap_entry { #define ABS_MT_TOOL_X 0x3c /* Center X tool position */ #define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ - #define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1) diff --git a/src/filter-private.h b/src/filter-private.h index dcce1259..f0d35b40 100644 --- a/src/filter-private.h +++ b/src/filter-private.h @@ -41,5 +41,4 @@ struct motion_filter { struct motion_filter_interface *interface; }; - #endif diff --git a/src/filter.h b/src/filter.h index bffeb5f9..9f6223d2 100644 --- a/src/filter.h +++ b/src/filter.h @@ -58,7 +58,6 @@ typedef double (*accel_profile_func_t)(struct motion_filter *filter, struct motion_filter * create_pointer_accelerator_filter(accel_profile_func_t filter); - /* * Pointer acceleration profiles. */ diff --git a/test/litest-alps-semi-mt.c b/test/litest-alps-semi-mt.c index 4d95ac90..7c8eedc2 100644 --- a/test/litest-alps-semi-mt.c +++ b/test/litest-alps-semi-mt.c @@ -31,7 +31,6 @@ #include "litest.h" #include "litest-int.h" - static void alps_create(struct litest_device *d); static void diff --git a/test/path.c b/test/path.c index 243edd79..64c5d7f4 100644 --- a/test/path.c +++ b/test/path.c @@ -1,4 +1,3 @@ - /* * Copyright © 2013 Red Hat, Inc. * diff --git a/test/touch.c b/test/touch.c index 2d918b2d..ac97c52b 100644 --- a/test/touch.c +++ b/test/touch.c @@ -343,7 +343,6 @@ START_TEST(touch_calibration_rotation) } #undef almost_equal - libinput_event_destroy(ev); litest_drain_events(li); } From 13afa8e5c71fd5acafb0f994e4dadd69eaac4a86 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 Mar 2015 12:17:14 +1000 Subject: [PATCH 2/9] test: disable tapping for palm detection tests The event sequences we use for plam detection trigger tap events if enabled by default. Always disable tapping, a set of tests for tapping in the palm exclusion zones. Arguably, tapping in the zones should be handled in a separate set of tests though. Signed-off-by: Peter Hutterer --- test/touchpad.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/touchpad.c b/test/touchpad.c index b70d3732..ddbccebd 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2157,6 +2157,9 @@ START_TEST(touchpad_palm_detect_at_edge) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(li); litest_touch_down(dev, 0, 99, 50); @@ -2179,6 +2182,9 @@ START_TEST(touchpad_palm_detect_at_bottom_corners) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + /* Run for non-clickpads only: make sure the bottom corners trigger palm detection too */ litest_drain_events(li); @@ -2203,6 +2209,9 @@ START_TEST(touchpad_palm_detect_at_top_corners) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + /* Run for non-clickpads only: make sure the bottom corners trigger palm detection too */ litest_drain_events(li); @@ -2227,6 +2236,9 @@ START_TEST(touchpad_palm_detect_palm_stays_palm) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(li); litest_touch_down(dev, 0, 99, 20); @@ -2244,6 +2256,9 @@ START_TEST(touchpad_palm_detect_palm_becomes_pointer) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(li); litest_touch_down(dev, 0, 99, 50); @@ -2266,6 +2281,9 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_edges) if (!touchpad_has_palm_detect_size(dev)) return; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + /* moving non-palm into the edge does not label it as palm */ litest_drain_events(li); From 19120ef96c9ca59a8ab9fb3ba180c37c90fd6c7a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 12:21:52 +1000 Subject: [PATCH 3/9] test: disable tapping for pure motion tests No effect, all devices currently have tapping disabled. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/touchpad.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/touchpad.c b/test/touchpad.c index ddbccebd..773d085d 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -38,6 +38,9 @@ START_TEST(touchpad_1fg_motion) struct libinput_event *event; struct libinput_event_pointer *ptrev; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(li); litest_touch_down(dev, 0, 50, 50); @@ -68,6 +71,9 @@ START_TEST(touchpad_2fg_no_motion) struct libinput *li = dev->libinput; struct libinput_event *event; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(li); litest_touch_down(dev, 0, 20, 20); From 5b9b662b2eadbccbd7beaff54290983901e16f61 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 12:24:09 +1000 Subject: [PATCH 4/9] test: split 3-finger tap-and-drag test Split out into a btntool test and a true three-finger test. For consistency, check the number of slots on all those tests rather than having litest-device-specific exclusions. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/touchpad.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/test/touchpad.c b/test/touchpad.c index 773d085d..34ac8996 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -231,6 +231,10 @@ START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + libinput_device_config_tap_set_enabled(dev->libinput_device, LIBINPUT_CONFIG_TAP_ENABLED); @@ -268,6 +272,49 @@ START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool) } END_TEST +START_TEST(touchpad_2fg_tap_n_drag_3fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 2) + return; + + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_ENABLED); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 30, 70); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 30, 70); + litest_touch_down(dev, 1, 80, 90); + litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* Putting down a third finger should end the drag */ + litest_touch_down(dev, 2, 50, 50); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* Releasing the fingers should not cause any events */ + litest_touch_up(dev, 2); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + START_TEST(touchpad_2fg_tap) { struct litest_device *dev = litest_current_device(); @@ -618,6 +665,10 @@ START_TEST(touchpad_3fg_tap) struct libinput_event *event; int i; + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 2) + return; + libinput_device_config_tap_set_enabled(dev->libinput_device, LIBINPUT_CONFIG_TAP_ENABLED); @@ -653,6 +704,10 @@ START_TEST(touchpad_3fg_tap_btntool) struct libinput *li = dev->libinput; struct libinput_event *event; + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + libinput_device_config_tap_set_enabled(dev->libinput_device, 1); litest_drain_events(li); @@ -688,6 +743,10 @@ START_TEST(touchpad_3fg_tap_btntool_inverted) struct libinput *li = dev->libinput; struct libinput_event *event; + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + libinput_device_config_tap_set_enabled(dev->libinput_device, 1); litest_drain_events(li); @@ -3278,6 +3337,7 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:tap", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); + litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD, LITEST_CLICKPAD); @@ -3288,10 +3348,9 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - /* apple is the only one with real 3-finger support */ - litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); - litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); - litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_APPLE_CLICKPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); /* Real buttons don't interfere with tapping, so don't run those for pads with buttons */ From 8b633f9de3cb3ad531e726deceeeee35fd6fce1b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 12:25:55 +1000 Subject: [PATCH 5/9] test: add a button requirement to a couple of touchpad tests If we send BTN_LEFT or similar, we need the LITEST_BUTTON capability on the device. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/touchpad.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/touchpad.c b/test/touchpad.c index 34ac8996..d4dc2d12 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -3340,8 +3340,8 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); + litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); + litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY); litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); @@ -3378,7 +3378,7 @@ int main(int argc, char **argv) { litest_add("touchpad:click", touchpad_click_defaults_btnarea, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); litest_add("touchpad:click", touchpad_click_defaults_none, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:click", touchpad_btn_left, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:click", touchpad_btn_left, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); litest_add("touchpad:click", clickpad_btn_left, LITEST_CLICKPAD, LITEST_ANY); litest_add("touchpad:click", clickpad_click_n_drag, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); @@ -3418,12 +3418,12 @@ int main(int argc, char **argv) { litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); litest_add("touchpad:left-handed", touchpad_left_handed_clickpad, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); litest_add("touchpad:left-handed", touchpad_left_handed_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); litest_add("touchpad:left-handed", touchpad_left_handed_tapping, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:left-handed", touchpad_left_handed_tapping_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:left-handed", touchpad_left_handed_delayed, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:left-handed", touchpad_left_handed_delayed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); litest_add("touchpad:left-handed", touchpad_left_handed_clickpad_delayed, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); /* Hover tests aren't generic, they only work on this device and From f8fae70d0c93d9831c41400b1f2e2b8307426018 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 11:20:34 +1000 Subject: [PATCH 6/9] test: enable tapping before verifying correct tap events These tests make sure we don't get tapping events in certain situations (finger movement, timeouts, ...). Tapping must be enabled for that to be a valid test. The tests can't work on semi-mt devices because we can't end slots independently. Disable the tests there. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/touchpad.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/touchpad.c b/test/touchpad.c index d4dc2d12..57027ab6 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -508,6 +508,8 @@ START_TEST(touchpad_no_2fg_tap_after_move) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_ENABLED); litest_drain_events(dev->libinput); /* one finger down, move past threshold, @@ -530,6 +532,8 @@ START_TEST(touchpad_no_2fg_tap_after_timeout) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_ENABLED); litest_drain_events(dev->libinput); /* one finger down, wait past tap timeout, @@ -555,6 +559,9 @@ START_TEST(touchpad_no_first_fg_tap_after_move) struct libinput *li = dev->libinput; struct libinput_event *event; + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_ENABLED); + litest_drain_events(dev->libinput); /* one finger down, second finger down, @@ -3344,8 +3351,8 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY); - litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); From aa3d09932fc886390ad71318b955a2f42aeb6e0d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 10:27:22 +1000 Subject: [PATCH 7/9] test: add a Wacom Intuos 5 Finger test device Works as a touchpad but has no buttons. Minor change to one of the touchpad tests: because the touch area is so big the slow-scrolling trigger needs to be adjusted. And because the device is an external device, the "disable on external mouse" test needs to be adjusted. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/Makefile.am | 1 + test/device.c | 17 +++-- test/litest-wacom-intuos-finger.c | 103 ++++++++++++++++++++++++++++++ test/litest.c | 2 + test/litest.h | 1 + test/touchpad.c | 4 +- 6 files changed, 122 insertions(+), 6 deletions(-) create mode 100644 test/litest-wacom-intuos-finger.c diff --git a/test/Makefile.am b/test/Makefile.am index 4bafe980..38d632de 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -28,6 +28,7 @@ liblitest_la_SOURCES = \ litest-synaptics-x1-carbon-3rd.c \ litest-trackpoint.c \ litest-wacom-touch.c \ + litest-wacom-intuos-finger.c \ litest-xen-virtual-pointer.c \ litest-vmware-virtual-usb-mouse.c \ litest.c diff --git a/test/device.c b/test/device.c index 0839bfae..04205330 100644 --- a/test/device.c +++ b/test/device.c @@ -64,14 +64,19 @@ START_TEST(device_sendevents_config_touchpad) { struct litest_device *dev = litest_current_device(); struct libinput_device *device; - uint32_t modes; + uint32_t modes, expected; + + expected = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; + + /* The wacom devices in the test suite are external */ + if (libevdev_get_id_vendor(dev->evdev) != 0x56a) /* wacom */ + expected |= + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; device = dev->libinput_device; modes = libinput_device_config_send_events_get_modes(device); - ck_assert_int_eq(modes, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE| - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(modes, expected); } END_TEST @@ -82,6 +87,10 @@ START_TEST(device_sendevents_config_touchpad_superset) enum libinput_config_status status; uint32_t modes; + /* The wacom devices in the test suite are external */ + if (libevdev_get_id_vendor(dev->evdev) == 0x56a) /* wacom */ + return; + device = dev->libinput_device; modes = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | diff --git a/test/litest-wacom-intuos-finger.c b/test/litest-wacom-intuos-finger.c new file mode 100644 index 00000000..7310cbd7 --- /dev/null +++ b/test/litest-wacom-intuos-finger.c @@ -0,0 +1,103 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +static void +litest_wacom_finger_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_WACOM_FINGER); + litest_set_current_device(d); +} + +static struct input_event down[] = { + { .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_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event move[] = { + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .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_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct litest_device_interface interface = { + .touch_down_events = down, + .touch_move_events = move, +}; + +static struct input_absinfo absinfo[] = { + { ABS_X, 0, 4096, 0, 0, 18 }, + { ABS_Y, 0, 4096, 0, 0, 29 }, + { ABS_MT_SLOT, 0, 15, 0, 0, 0 }, + { ABS_MT_TOUCH_MAJOR, 0, 4096, 0, 0, 0 }, + { ABS_MT_TOUCH_MINOR, 0, 4096, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 4096, 0, 0, 18 }, + { ABS_MT_POSITION_Y, 0, 4096, 0, 0, 29 }, + { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, + { .value = -1 }, +}; + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x56a, + .product = 0x27, +}; + +static int events[] = { + EV_KEY, BTN_TOOL_FINGER, + EV_KEY, BTN_TOOL_QUINTTAP, + EV_KEY, BTN_TOUCH, + EV_KEY, BTN_TOOL_DOUBLETAP, + EV_KEY, BTN_TOOL_TRIPLETAP, + EV_KEY, BTN_TOOL_QUADTAP, + INPUT_PROP_MAX, INPUT_PROP_POINTER, + -1, -1, +}; + +struct litest_test_device litest_wacom_finger_device = { + .type = LITEST_WACOM_FINGER, + .features = LITEST_TOUCHPAD, + .shortname = "wacom-finger", + .setup = litest_wacom_finger_setup, + .interface = &interface, + + .name = "Wacom Intuos5 touch M Finger", + .id = &input_id, + .events = events, + .absinfo = absinfo, +}; diff --git a/test/litest.c b/test/litest.c index 7585859f..4d04b52c 100644 --- a/test/litest.c +++ b/test/litest.c @@ -97,6 +97,7 @@ extern struct litest_test_device litest_vmware_virtmouse_device; extern struct litest_test_device litest_synaptics_hover_device; extern struct litest_test_device litest_synaptics_carbon3rd_device; extern struct litest_test_device litest_protocol_a_screen; +extern struct litest_test_device litest_wacom_finger_device; struct litest_test_device* devices[] = { &litest_synaptics_clickpad_device, @@ -115,6 +116,7 @@ struct litest_test_device* devices[] = { &litest_synaptics_hover_device, &litest_synaptics_carbon3rd_device, &litest_protocol_a_screen, + &litest_wacom_finger_device, NULL, }; diff --git a/test/litest.h b/test/litest.h index df5dd756..8f16851e 100644 --- a/test/litest.h +++ b/test/litest.h @@ -52,6 +52,7 @@ enum litest_device_type { LITEST_SYNAPTICS_HOVER_SEMI_MT = -16, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS = -17, LITEST_PROTOCOL_A_SCREEN = -18, + LITEST_WACOM_FINGER = -19, }; enum litest_device_feature { diff --git a/test/touchpad.c b/test/touchpad.c index 57027ab6..c4585fb5 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -1869,8 +1869,8 @@ START_TEST(touchpad_2fg_scroll_slow_distance) litest_touch_down(dev, 0, 20, 30); litest_touch_down(dev, 1, 40, 30); - litest_touch_move_to(dev, 0, 20, 30, 20, 50, 60, 10); - litest_touch_move_to(dev, 1, 40, 30, 40, 50, 60, 10); + litest_touch_move_to(dev, 0, 20, 30, 20, 40, 70, 10); + litest_touch_move_to(dev, 1, 40, 30, 40, 40, 70, 10); litest_touch_up(dev, 1); litest_touch_up(dev, 0); libinput_dispatch(li); From 5a4ada08fdb1fef469d80a4af8812414e026a6a8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 09:51:54 +1000 Subject: [PATCH 8/9] touchpad: don't warn about clickpads without left buttons Clickpads have BTN_LEFT but no BTN_RIGHT, non-clickpads must have both. Tablet touch devices don't have any buttons, so skip the warning for those. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-buttons.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 12f80234..fc79b0fc 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -667,8 +667,8 @@ tp_init_buttons(struct tp_dispatch *tp, log_bug_kernel(libinput, "%s: clickpad advertising right button\n", device->devname); - } else { - if (!tp->buttons.is_clickpad) + } else if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT) && + !tp->buttons.is_clickpad) { log_bug_kernel(libinput, "%s: non clickpad without right button?\n", device->devname); From 9b865ba212ab15e626b3037c030e4d71588c1c4f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 10:00:52 +1000 Subject: [PATCH 9/9] touchpad: enable tapping by default on buttonless touchpads This affects the touch device on graphics tablets. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-tap.c | 18 +++++++++++++++++- test/touchpad.c | 20 ++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 33c6da64..228eb842 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -688,8 +688,15 @@ tp_tap_config_is_enabled(struct libinput_device *device) } static enum libinput_config_tap_state -tp_tap_config_get_default(struct libinput_device *device) +tp_tap_default(struct evdev_device *evdev) { + /** + * If we don't have a left button we must have tapping enabled by + * default. + */ + if (!libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_LEFT)) + return LIBINPUT_CONFIG_TAP_ENABLED; + /** * Tapping is disabled by default for two reasons: * * if you don't know that tapping is a thing (or enabled by @@ -702,6 +709,14 @@ tp_tap_config_get_default(struct libinput_device *device) return LIBINPUT_CONFIG_TAP_DISABLED; } +static enum libinput_config_tap_state +tp_tap_config_get_default(struct libinput_device *device) +{ + struct evdev_device *evdev = (struct evdev_device *)device; + + return tp_tap_default(evdev); +} + int tp_init_tap(struct tp_dispatch *tp) { @@ -712,6 +727,7 @@ tp_init_tap(struct tp_dispatch *tp) tp->device->base.config.tap = &tp->tap.config; tp->tap.state = TAP_STATE_IDLE; + tp->tap.enabled = tp_tap_default(tp->device); libinput_timer_init(&tp->tap.timer, tp->device->base.seat->libinput, diff --git a/test/touchpad.c b/test/touchpad.c index c4585fb5..8077f8e3 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2169,8 +2169,6 @@ START_TEST(touchpad_tap_is_available) struct litest_device *dev = litest_current_device(); ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1); - ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_DISABLED); } END_TEST @@ -2187,15 +2185,28 @@ START_TEST(touchpad_tap_is_not_available) } END_TEST -START_TEST(touchpad_tap_default) +START_TEST(touchpad_tap_default_disabled) { struct litest_device *dev = litest_current_device(); + /* this test is only run on specific devices */ + ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), LIBINPUT_CONFIG_TAP_DISABLED); } END_TEST +START_TEST(touchpad_tap_default_enabled) +{ + struct litest_device *dev = litest_current_device(); + + /* this test is only run on specific devices */ + + ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), + LIBINPUT_CONFIG_TAP_ENABLED); +} +END_TEST + START_TEST(touchpad_tap_invalid) { struct litest_device *dev = litest_current_device(); @@ -3364,7 +3375,8 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY); litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:tap", touchpad_tap_default, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY); + litest_add("touchpad:tap", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON); litest_add("touchpad:tap", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:tap", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:tap", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD);