From 7cd6f9780da7e6c01814c83e6dab886075ee5a33 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Jun 2015 09:57:13 +1000 Subject: [PATCH 01/26] Add missing copyright header to the udev callout Signed-off-by: Peter Hutterer --- udev/libinput-device-group.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/udev/libinput-device-group.c b/udev/libinput-device-group.c index adbd6b7f..ab9409bf 100644 --- a/udev/libinput-device-group.c +++ b/udev/libinput-device-group.c @@ -1,3 +1,26 @@ +/* + * Copyright © 2015 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 #include #include From 438ba0fec3dd9182048b3e40097624b6343b011e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Jun 2015 11:40:46 +1000 Subject: [PATCH 02/26] test: group the parser tests together Signed-off-by: Peter Hutterer --- test/misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/misc.c b/test/misc.c index 0241f959..0cffa227 100644 --- a/test/misc.c +++ b/test/misc.c @@ -599,7 +599,7 @@ litest_setup_tests(void) litest_add_no_device("misc:matrix", matrix_helpers); litest_add_no_device("misc:ratelimit", ratelimit_helpers); - litest_add_no_device("misc:dpi parser", dpi_parser); - litest_add_no_device("misc:wheel click parser", wheel_click_parser); - litest_add_no_device("misc:trackpoint accel parser", trackpoint_accel_parser); + litest_add_no_device("misc:parser", dpi_parser); + litest_add_no_device("misc:parser", wheel_click_parser); + litest_add_no_device("misc:parser", trackpoint_accel_parser); } From 44a1f07a57183837e9f272a7f12da1451d16377f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Jun 2015 12:03:28 +1000 Subject: [PATCH 03/26] evdev: evdev_fix_abs_resolution can be static Signed-off-by: Peter Hutterer --- src/evdev.c | 2 +- src/evdev.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 63d2ca8e..905b5cc7 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1548,7 +1548,7 @@ evdev_read_model(struct evdev_device *device) } /* Return 1 if the given resolutions have been set, or 0 otherwise */ -inline int +static inline int evdev_fix_abs_resolution(struct evdev_device *device, unsigned int xcode, unsigned int ycode, diff --git a/src/evdev.h b/src/evdev.h index 0485894d..9c30b402 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -278,13 +278,6 @@ struct evdev_device * evdev_device_create(struct libinput_seat *seat, struct udev_device *device); -int -evdev_fix_abs_resolution(struct evdev_device *device, - unsigned int xcode, - unsigned int ycode, - int yresolution, - int xresolution); - int evdev_device_init_pointer_acceleration(struct evdev_device *device, accel_profile_func_t profile); From c0ef2a172a94c33a1fb93c92c49c9326ef05ab80 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 1 Jul 2015 08:54:32 +1000 Subject: [PATCH 04/26] test: increase the udev init timeout Hitting this limit too often on congested VMs, so let's increase the sleep sleep (so the system can get done what needs to be done) and get the whole timeout from 600ms to 2000ms. Note: if we really hit 2000ms we may still fail on some tests with the check's default 3 second timeout. Signed-off-by: Peter Hutterer --- test/litest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/litest.c b/test/litest.c index 82df550d..003a5bc7 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1088,10 +1088,10 @@ litest_wait_for_udev(int fd) litest_assert_ptr_notnull(device); while (device && !udev_device_get_property_value(device, "ID_INPUT")) { loop_count++; - litest_assert_int_lt(loop_count, 300); + litest_assert_int_lt(loop_count, 200); udev_device_unref(device); - msleep(2); + msleep(10); device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); } From c82ec173bb1294603b4cb81f0f12d24bdf104688 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 24 Jun 2015 11:22:29 +1000 Subject: [PATCH 05/26] touchpad: move trackpoint timer stuff into the palm struct No functional changes, just rearranging where it fits better. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 20 ++++++++++---------- src/evdev-mt-touchpad.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index c70d28e6..a2a3a633 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -762,7 +762,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) filter_motion |= tp_post_button_events(tp, time); if (filter_motion || - tp->sendevents.trackpoint_active || + tp->palm.trackpoint_active || tp->dwt.keyboard_active) { tp_edge_scroll_stop_events(tp, time); tp_gesture_stop(tp, time); @@ -812,12 +812,12 @@ tp_interface_process(struct evdev_dispatch *dispatch, static void tp_remove_sendevents(struct tp_dispatch *tp) { - libinput_timer_cancel(&tp->sendevents.trackpoint_timer); + libinput_timer_cancel(&tp->palm.trackpoint_timer); libinput_timer_cancel(&tp->dwt.keyboard_timer); if (tp->buttons.trackpoint) libinput_device_remove_event_listener( - &tp->sendevents.trackpoint_listener); + &tp->palm.trackpoint_listener); if (tp->dwt.keyboard) libinput_device_remove_event_listener( @@ -928,7 +928,7 @@ tp_trackpoint_timeout(uint64_t now, void *data) struct tp_dispatch *tp = data; tp_tap_resume(tp, now); - tp->sendevents.trackpoint_active = false; + tp->palm.trackpoint_active = false; } static void @@ -941,14 +941,14 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data) if (event->type == LIBINPUT_EVENT_POINTER_BUTTON) return; - if (!tp->sendevents.trackpoint_active) { + if (!tp->palm.trackpoint_active) { tp_edge_scroll_stop_events(tp, time); tp_gesture_stop(tp, time); tp_tap_suspend(tp, time); - tp->sendevents.trackpoint_active = true; + tp->palm.trackpoint_active = true; } - libinput_timer_set(&tp->sendevents.trackpoint_timer, + libinput_timer_set(&tp->palm.trackpoint_timer, time + DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT); } @@ -1080,7 +1080,7 @@ tp_interface_device_added(struct evdev_device *device, tp->buttons.active_is_topbutton = false; tp->buttons.trackpoint = added_device; libinput_device_add_event_listener(&added_device->base, - &tp->sendevents.trackpoint_listener, + &tp->palm.trackpoint_listener, tp_trackpoint_event, tp); } @@ -1121,7 +1121,7 @@ tp_interface_device_removed(struct evdev_device *device, tp->buttons.active_is_topbutton = false; } libinput_device_remove_event_listener( - &tp->sendevents.trackpoint_listener); + &tp->palm.trackpoint_listener); tp->buttons.trackpoint = NULL; } @@ -1432,7 +1432,7 @@ static int tp_init_sendevents(struct tp_dispatch *tp, struct evdev_device *device) { - libinput_timer_init(&tp->sendevents.trackpoint_timer, + libinput_timer_init(&tp->palm.trackpoint_timer, tp_libinput_context(tp), tp_trackpoint_timeout, tp); diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 36260c68..d4a57a84 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -277,15 +277,15 @@ struct tp_dispatch { int32_t right_edge; /* in device coordinates */ int32_t left_edge; /* in device coordinates */ int32_t vert_center; /* in device coordinates */ + + bool trackpoint_active; + struct libinput_event_listener trackpoint_listener; + struct libinput_timer trackpoint_timer; } palm; struct { struct libinput_device_config_send_events config; enum libinput_config_send_events_mode current_mode; - - bool trackpoint_active; - struct libinput_event_listener trackpoint_listener; - struct libinput_timer trackpoint_timer; } sendevents; struct { From 081b6b3dff6fb3ac2f4f0ef9ecdda818792a0b7c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 24 Jun 2015 10:57:07 +1000 Subject: [PATCH 06/26] touchpad: always set touch->palm.time on touch begin We will use this outside of DWT, so set it unconditionally on touch begin. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index a2a3a633..792184c3 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -211,6 +211,7 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) t->state = TOUCH_BEGIN; t->millis = time; tp->nfingers_down++; + t->palm.time = time; assert(tp->nfingers_down >= 1); } @@ -491,7 +492,6 @@ tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) if (tp->dwt.keyboard_active && t->state == TOUCH_BEGIN) { t->palm.state = PALM_TYPING; - t->palm.time = time; t->palm.first = t->point; return 1; } else if (!tp->dwt.keyboard_active && From eb4bd799de2f91120c43c91fb3dd8942f16f3659 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 23 Jun 2015 15:36:05 +1000 Subject: [PATCH 07/26] touchpad: improve trackpoint palm detection responsiveness The touchpad is disabled for 500ms after a trackpoint event to avoid erroneous palm touches. This is currently refreshed on every trackpoint event and thus forces a delay of 500ms when switching between the two. Instead, reduce the timeout to 300ms but ignore any touches started while the trackpoint was active (i.e. before the last trackpoint event). A touch started after the last event is released once the timeout expires. This is the same logic used for disable-while-typing. https://bugzilla.redhat.com/show_bug.cgi?id=1233844 Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 34 ++++++++++++++++++++++++++++++++-- src/evdev-mt-touchpad.h | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 792184c3..538c2d77 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -34,7 +34,7 @@ * TP_MAGIC_SLOWDOWN in filter.c */ #define DEFAULT_ACCEL_NUMERATOR 3000.0 #define DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR 700.0 -#define DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT 500 /* ms */ +#define DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT 300 /* ms */ #define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1 200 /* ms */ #define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2 500 /* ms */ #define FAKE_FINGER_OVERFLOW (1 << 7) @@ -515,6 +515,31 @@ tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) return 0; } +static int +tp_palm_detect_trackpoint(struct tp_dispatch *tp, + struct tp_touch *t, + uint64_t time) +{ + if (t->palm.state == PALM_NONE && + t->state == TOUCH_BEGIN && + tp->palm.trackpoint_active) { + t->palm.state = PALM_TRACKPOINT; + return 1; + } else if (t->palm.state == PALM_TRACKPOINT && + t->state == TOUCH_UPDATE && + !tp->palm.trackpoint_active) { + + if (t->palm.time == 0 || + t->palm.time > tp->palm.trackpoint_last_event_time) { + t->palm.state = PALM_NONE; + log_debug(tp_libinput_context(tp), + "palm: touch released, timeout after trackpoint\n"); + } + } + + return 0; +} + static void tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { @@ -526,6 +551,9 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) if (tp_palm_detect_dwt(tp, t, time)) goto out; + if (tp_palm_detect_trackpoint(tp, t, time)) + goto out; + /* If labelled a touch as palm, we unlabel as palm when we move out of the palm edge zone within the timeout, provided the direction is within 45 degrees of the horizontal. @@ -568,7 +596,8 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) out: log_debug(tp_libinput_context(tp), "palm: palm detected (%s)\n", - t->palm.state == PALM_EDGE ? "edge" : "typing"); + t->palm.state == PALM_EDGE ? "edge" : + t->palm.state == PALM_TYPING ? "typing" : "trackpoint"); } static void @@ -948,6 +977,7 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data) tp->palm.trackpoint_active = true; } + tp->palm.trackpoint_last_event_time = time; libinput_timer_set(&tp->palm.trackpoint_timer, time + DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT); } diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index d4a57a84..f3c2bf7a 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -64,6 +64,7 @@ enum touch_palm_state { PALM_NONE = 0, PALM_EDGE, PALM_TYPING, + PALM_TRACKPOINT, }; enum button_event { @@ -281,6 +282,7 @@ struct tp_dispatch { bool trackpoint_active; struct libinput_event_listener trackpoint_listener; struct libinput_timer trackpoint_timer; + uint64_t trackpoint_last_event_time; } palm; struct { From f0c8286ae83fc7a69f56e7d87be8938aba75aa6f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 24 Jun 2015 11:41:47 +1000 Subject: [PATCH 08/26] touchpad: disable trackpoint palm detection on small touchpads Tested on three laptops here, Lenovo T61, X220 and an HP EliteBook (?), all with small touchpads. It's hard to have a hand position where the palm touches the touchpad while using the trackpoint. So we might as well save us the effort of monitoring events and enabling/disabling it on demand. As a side-effect this fixes 1233844, but that's more a coincidence. https://bugzilla.redhat.com/show_bug.cgi?id=1233844 Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 20 ++++++++++++++------ src/evdev-mt-touchpad.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 538c2d77..24743406 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -520,6 +520,9 @@ tp_palm_detect_trackpoint(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { + if (!tp->palm.monitor_trackpoint) + return 0; + if (t->palm.state == PALM_NONE && t->state == TOUCH_BEGIN && tp->palm.trackpoint_active) { @@ -844,7 +847,8 @@ tp_remove_sendevents(struct tp_dispatch *tp) libinput_timer_cancel(&tp->palm.trackpoint_timer); libinput_timer_cancel(&tp->dwt.keyboard_timer); - if (tp->buttons.trackpoint) + if (tp->buttons.trackpoint && + tp->palm.monitor_trackpoint) libinput_device_remove_event_listener( &tp->palm.trackpoint_listener); @@ -1109,9 +1113,10 @@ tp_interface_device_added(struct evdev_device *device, /* Don't send any pending releases to the new trackpoint */ tp->buttons.active_is_topbutton = false; tp->buttons.trackpoint = added_device; - libinput_device_add_event_listener(&added_device->base, - &tp->palm.trackpoint_listener, - tp_trackpoint_event, tp); + if (tp->palm.monitor_trackpoint) + libinput_device_add_event_listener(&added_device->base, + &tp->palm.trackpoint_listener, + tp_trackpoint_event, tp); } if (added_device->tags & EVDEV_TAG_KEYBOARD && @@ -1150,8 +1155,9 @@ tp_interface_device_removed(struct evdev_device *device, tp->buttons.active = 0; tp->buttons.active_is_topbutton = false; } - libinput_device_remove_event_listener( - &tp->palm.trackpoint_listener); + if (tp->palm.monitor_trackpoint) + libinput_device_remove_event_listener( + &tp->palm.trackpoint_listener); tp->buttons.trackpoint = NULL; } @@ -1455,6 +1461,8 @@ tp_init_palmdetect(struct tp_dispatch *tp, tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05; tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2; + tp->palm.monitor_trackpoint = true; + return 0; } diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index f3c2bf7a..2466dab5 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -283,6 +283,7 @@ struct tp_dispatch { struct libinput_event_listener trackpoint_listener; struct libinput_timer trackpoint_timer; uint64_t trackpoint_last_event_time; + bool monitor_trackpoint; } palm; struct { From a851415c61d1664cd14f79bfd09373b924faaabc Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 1 Jul 2015 10:55:23 +1000 Subject: [PATCH 09/26] test: add the warning to the rules file too The rules file in /run may be left over after an unclean exit and mess with things. Signed-off-by: Peter Hutterer --- test/litest.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/litest.c b/test/litest.c index 003a5bc7..456b8a96 100644 --- a/test/litest.c +++ b/test/litest.c @@ -52,7 +52,7 @@ #define UDEV_RULES_D "/run/udev/rules.d" #define UDEV_RULE_PREFIX "99-litest-" #define UDEV_HWDB_D "/etc/udev/hwdb.d" -#define UDEV_COMMON_RULE_FILE UDEV_RULES_D "/91-litest-model-quirks.rules" +#define UDEV_COMMON_RULE_FILE UDEV_RULES_D "/91-litest-model-quirks-REMOVEME.rules" #define UDEV_COMMON_HWDB_FILE UDEV_HWDB_D "/91-litest-model-quirks-REMOVEME.hwdb" static int in_debugger = -1; @@ -923,16 +923,20 @@ litest_copy_file(const char *dest, const char *src, const char *header) static inline void litest_install_model_quirks(void) { - litest_copy_file(UDEV_COMMON_RULE_FILE, LIBINPUT_UDEV_RULES_FILE, NULL); - litest_copy_file(UDEV_COMMON_HWDB_FILE, - LIBINPUT_UDEV_HWDB_FILE, + const char *warning = "#################################################################\n" "# WARNING: REMOVE THIS FILE\n" - "# This is the run-time hwdb file for the libinput test suite and\n" + "# This is a run-time file for the libinput test suite and\n" "# should be removed on exit. If the test-suite is not currently \n" "# running, remove this file and update your hwdb: \n" "# sudo udevadm hwdb --update\n" - "#################################################################\n\n"); + "#################################################################\n\n"; + litest_copy_file(UDEV_COMMON_RULE_FILE, + LIBINPUT_UDEV_RULES_FILE, + warning); + litest_copy_file(UDEV_COMMON_HWDB_FILE, + LIBINPUT_UDEV_HWDB_FILE, + warning); } static inline void From 2285217ae177236fd6bd3cde06328c73513dbd07 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 1 Jul 2015 09:33:51 +1000 Subject: [PATCH 10/26] udev: make a note that hwdb matches are exclusive Signed-off-by: Peter Hutterer --- udev/90-libinput-model-quirks.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/90-libinput-model-quirks.rules b/udev/90-libinput-model-quirks.rules index 79b9b36f..43674f55 100644 --- a/udev/90-libinput-model-quirks.rules +++ b/udev/90-libinput-model-quirks.rules @@ -11,6 +11,7 @@ ACTION!="add|change", GOTO="libinput_model_quirks_end" KERNEL!="event*", GOTO="libinput_model_quirks_end" +# Matches below are exclusive, if one matches we skip the rest # hwdb matches: # # libinput:touchpad: From 6ea69c2b3d18ea3994a9577e52060e992d46cc70 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 12 Jun 2015 15:31:56 +1000 Subject: [PATCH 11/26] filter: reduce deceleration to minimal speeds only Deceleration at low speeds is intended to enhance precision when moving the pointer slowly. However, the adaptive deceleration we used was badly calibrated, at slow-but-normal speeds the pointer became too slow to manouver. We don't want to drop deceleration completely, the subpixel precision it provides is useful. And it also helps those that can't move a 1000dpi mouse by exactly one unit. Make the adaptive deceleration steeper so it only kicks in at extremely slow motions and defaults to 1 at anything resembling normal movement (i.e. pointer moves like the physical device does). Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filter.c b/src/filter.c index b37ca766..1e057823 100644 --- a/src/filter.c +++ b/src/filter.c @@ -387,7 +387,7 @@ pointer_accel_profile_linear(struct motion_filter *filter, const double incline = accel_filter->incline; double factor; - s1 = min(1, 0.3 + speed_in * 4); + s1 = min(1, 0.3 + speed_in * 10); s2 = 1 + (speed_in - threshold) * incline; factor = min(max_accel, s2 > 1 ? s2 : s1); From c06d825c53b9d1c56b4e5aa09f39d7af4e9b444e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 26 Jun 2015 09:07:24 +1000 Subject: [PATCH 12/26] Drop motion normalization of unaccelerated deltas This simply doesn't work for low-dpi mice. Normalizing a 400dpi mouse to a 1000dpi mouse forces a minimum movement of 2.5 units and the resulting pixel jumps. It is impossible for the caller to detect whether the jump was caused by a single motion or multiple motion events. This is technically an API break, but not really. The accelerated data was already relatively meaningless, even if normalized as the data did not correspond predictably to any input motion (unless you know the implementation acceleration function in the caller). So we can drop the mention from there without expecting any ill effects in the caller. The unaccelerated data was useless for low-dpi mice and could only be used to measure the physical distance of the mouse movement - something not used in any caller we're aware of (if needed, we can add that functionality as a separate call). Dropping motion normalization for unaccelerated deltas also restores true dpi capabilities to users of that API, mostly games that want to make use of high-dpi mice. This is a simplified patch, the normalization is still in place for most of libinput, it merely carries the original coordinates in the event itself. In the case of touchpads, the coordinates are unnormalized into the x-axis coordinate space as per the documentation. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- doc/normalization-of-relative-motion.dox | 31 +++++++++++++++++++++--- src/evdev-mt-touchpad-gestures.c | 8 ++++-- src/evdev-mt-touchpad.h | 15 ++++++++++++ src/evdev.c | 5 +++- src/libinput-private.h | 2 +- src/libinput.c | 10 ++++---- src/libinput.h | 26 +++++++++++--------- 7 files changed, 72 insertions(+), 25 deletions(-) diff --git a/doc/normalization-of-relative-motion.dox b/doc/normalization-of-relative-motion.dox index aaa1735f..dd5d39b3 100644 --- a/doc/normalization-of-relative-motion.dox +++ b/doc/normalization-of-relative-motion.dox @@ -12,10 +12,33 @@ physical movement or 10 millimeters, depending on the sensor. This affects pointer acceleration in libinput and interpretation of relative coordinates in callers. -libinput normalizes all relative input to a physical resolution of -1000dpi, the same delta from two different devices thus represents the -same physical movement of those two devices (within sensor error -margins). +libinput does partial normalization of relative input. For devices with a +resolution of 1000dpi and higher, motion events are normalized to a default +of 1000dpi before pointer acceleration is applied. As a result, devices with +1000dpi and above feel the same. + +Devices below 1000dpi are not normalized (normalization of a 1-device unit +movement on a 400dpi mouse would cause a 2.5 pixel movement). Instead, +libinput applies a dpi-dependent acceleration function. At low speeds, a +1-device unit movement usually translates into a 1-pixel movements. As the +movement speed increases, acceleration is applied - at high speeds a low-dpi +device will roughly feel the same as a higher-dpi mouse. + +This normalization only applies to accelerated coordinates, unaccelerated +coordiantes are left in device-units. It is up to the caller to interpret +those coordinates correctly. + +@section Normalization of touchpad coordinates + +Touchpads may have a different resolution for the horizontal and vertical +axis. Interpreting coordinates from the touchpad without taking resolutino +into account results in uneven motion. + +libinput scales unaccelerated touchpad motion do the resolution of the +touchpad's x axis, i.e. the unaccelerated value for the y axis is: + y = (x / resolution_x) * resolution_y + +@section Setting custom DPI settings Devices usually do not advertise their resolution and libinput relies on the udev property MOUSE_DPI for this information. This property is usually diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 328a744b..e85a9d77 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -91,6 +91,7 @@ static void tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) { struct normalized_coords delta, unaccel; + struct device_float_coords raw; /* When a clickpad is clicked, combine motion of all active touches */ if (tp->buttons.is_clickpad && tp->buttons.state) @@ -101,8 +102,11 @@ tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) delta = tp_filter_motion(tp, &unaccel, time); if (!normalized_is_zero(delta) || !normalized_is_zero(unaccel)) { - pointer_notify_motion(&tp->device->base, time, - &delta, &unaccel); + raw = tp_unnormalize_for_xaxis(tp, unaccel); + pointer_notify_motion(&tp->device->base, + time, + &delta, + &raw); } } diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 36260c68..a12c87a7 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -318,6 +318,21 @@ tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta) return normalized; } +/** + * Takes a dpi-normalized set of coordinates, returns a set of coordinates + * in the x-axis' coordinate space. + */ +static inline struct device_float_coords +tp_unnormalize_for_xaxis(struct tp_dispatch *tp, struct normalized_coords delta) +{ + struct device_float_coords raw; + + raw.x = delta.x / tp->accel.x_scale_coeff; + raw.y = delta.y / tp->accel.x_scale_coeff; /* <--- not a typo */ + + return raw; +} + struct normalized_coords tp_get_delta(struct tp_touch *t); diff --git a/src/evdev.c b/src/evdev.c index 63d2ca8e..9602587c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -281,6 +281,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) struct libinput_seat *seat = base->seat; struct normalized_coords accel, unaccel; struct device_coords point; + struct device_float_coords raw; slot = device->mt.slot; @@ -289,6 +290,8 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) return; case EVDEV_RELATIVE_MOTION: normalize_delta(device, &device->rel, &unaccel); + raw.x = device->rel.x; + raw.y = device->rel.y; device->rel.x = 0; device->rel.y = 0; @@ -305,7 +308,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) break; - pointer_notify_motion(base, time, &accel, &unaccel); + pointer_notify_motion(base, time, &accel, &raw); break; case EVDEV_ABSOLUTE_MT_DOWN: if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) diff --git a/src/libinput-private.h b/src/libinput-private.h index 5192b651..d11f000f 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -324,7 +324,7 @@ void pointer_notify_motion(struct libinput_device *device, uint64_t time, const struct normalized_coords *delta, - const struct normalized_coords *unaccel); + const struct device_float_coords *raw); void pointer_notify_motion_absolute(struct libinput_device *device, diff --git a/src/libinput.c b/src/libinput.c index 319934ac..d164604c 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -96,7 +96,7 @@ struct libinput_event_pointer { struct libinput_event base; uint32_t time; struct normalized_coords delta; - struct normalized_coords delta_unaccel; + struct device_float_coords delta_raw; struct device_coords absolute; struct discrete_coords discrete; uint32_t button; @@ -339,7 +339,7 @@ libinput_event_pointer_get_dx_unaccelerated( 0, LIBINPUT_EVENT_POINTER_MOTION); - return event->delta_unaccel.x; + return event->delta_raw.x; } LIBINPUT_EXPORT double @@ -351,7 +351,7 @@ libinput_event_pointer_get_dy_unaccelerated( 0, LIBINPUT_EVENT_POINTER_MOTION); - return event->delta_unaccel.y; + return event->delta_raw.y; } LIBINPUT_EXPORT double @@ -1130,7 +1130,7 @@ void pointer_notify_motion(struct libinput_device *device, uint64_t time, const struct normalized_coords *delta, - const struct normalized_coords *unaccel) + const struct device_float_coords *raw) { struct libinput_event_pointer *motion_event; @@ -1144,7 +1144,7 @@ pointer_notify_motion(struct libinput_device *device, *motion_event = (struct libinput_event_pointer) { .time = time, .delta = *delta, - .delta_unaccel = *unaccel, + .delta_raw = *raw, }; post_device_event(device, time, diff --git a/src/libinput.h b/src/libinput.h index 7d907f16..5df71836 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -462,8 +462,8 @@ libinput_event_pointer_get_time(struct libinput_event_pointer *event); * If a device employs pointer acceleration, the delta returned by this * function is the accelerated delta. * - * Relative motion deltas are normalized to represent those of a device with - * 1000dpi resolution. See @ref motion_normalization for more details. + * Relative motion deltas are to be interpreted as pixel movement of a + * standardized mouse. See @ref motion_normalization for more details. * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. @@ -483,8 +483,8 @@ libinput_event_pointer_get_dx(struct libinput_event_pointer *event); * If a device employs pointer acceleration, the delta returned by this * function is the accelerated delta. * - * Relative motion deltas are normalized to represent those of a device with - * 1000dpi resolution. See @ref motion_normalization for more details. + * Relative motion deltas are to be interpreted as pixel movement of a + * standardized mouse. See @ref motion_normalization for more details. * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. @@ -501,10 +501,11 @@ libinput_event_pointer_get_dy(struct libinput_event_pointer *event); * current event. For pointer events that are not of type @ref * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. * - * Relative unaccelerated motion deltas are normalized to represent those of a - * device with 1000dpi resolution. See @ref motion_normalization for more - * details. Note that unaccelerated events are not equivalent to 'raw' events - * as read from the device. + * Relative unaccelerated motion deltas are raw device coordinates. + * Note that these coordinates are subject to the device's native + * resolution. Touchpad coordinates represent raw device coordinates in the + * X resolution of the touchpad. See @ref motion_normalization for more + * details. * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. @@ -522,10 +523,11 @@ libinput_event_pointer_get_dx_unaccelerated( * current event. For pointer events that are not of type @ref * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. * - * Relative unaccelerated motion deltas are normalized to represent those of a - * device with 1000dpi resolution. See @ref motion_normalization for more - * details. Note that unaccelerated events are not equivalent to 'raw' events - * as read from the device. + * Relative unaccelerated motion deltas are raw device coordinates. + * Note that these coordinates are subject to the device's native + * resolution. Touchpad coordinates represent raw device coordinates in the + * X resolution of the touchpad. See @ref motion_normalization for more + * details. * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. From 92e415eadd90d15b6a20bffdc9a0e66d7df8c308 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 26 Jun 2015 11:06:05 +1000 Subject: [PATCH 13/26] test: add a low-dpi mouse test device Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/Makefile.am | 1 + test/litest-mouse-low-dpi.c | 75 +++++++++++++++++++++++++++++++++++++ test/litest.c | 2 + test/litest.h | 1 + 4 files changed, 79 insertions(+) create mode 100644 test/litest-mouse-low-dpi.c diff --git a/test/Makefile.am b/test/Makefile.am index 6a55c7f0..e8843c27 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -23,6 +23,7 @@ liblitest_la_SOURCES = \ litest-logitech-trackball.c \ litest-mouse.c \ litest-mouse-roccat.c \ + litest-mouse-low-dpi.c \ litest-ms-surface-cover.c \ litest-protocol-a-touch-screen.c \ litest-qemu-usb-tablet.c \ diff --git a/test/litest-mouse-low-dpi.c b/test/litest-mouse-low-dpi.c new file mode 100644 index 00000000..dccf40fa --- /dev/null +++ b/test/litest-mouse-low-dpi.c @@ -0,0 +1,75 @@ +/* + * Copyright © 2015 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. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +static void litest_mouse_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE_LOW_DPI); + litest_set_current_device(d); +} + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x1, + .product = 0x1, +}; + +static int events[] = { + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_KEY, BTN_MIDDLE, + EV_REL, REL_X, + EV_REL, REL_Y, + EV_REL, REL_WHEEL, + -1 , -1, +}; + +static const char udev_rule[] = +"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" +"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" +"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" +"\n" +"ATTRS{name}==\"litest Low DPI Mouse*\",\\\n" +" ENV{MOUSE_DPI}=\"400@125\"\n" +"\n" +"LABEL=\"touchpad_end\""; + +struct litest_test_device litest_mouse_low_dpi_device = { + .type = LITEST_MOUSE_LOW_DPI, + .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, + .shortname = "low-dpi mouse", + .setup = litest_mouse_setup, + .interface = NULL, + + .name = "Low DPI Mouse", + .id = &input_id, + .absinfo = NULL, + .events = events, + .udev_rule = udev_rule, +}; diff --git a/test/litest.c b/test/litest.c index 82df550d..5c665d0f 100644 --- a/test/litest.c +++ b/test/litest.c @@ -352,6 +352,7 @@ extern struct litest_test_device litest_ms_surface_cover_device; extern struct litest_test_device litest_logitech_trackball_device; extern struct litest_test_device litest_atmel_hover_device; extern struct litest_test_device litest_alps_dualpoint_device; +extern struct litest_test_device litest_mouse_low_dpi_device; struct litest_test_device* devices[] = { &litest_synaptics_clickpad_device, @@ -378,6 +379,7 @@ struct litest_test_device* devices[] = { &litest_logitech_trackball_device, &litest_atmel_hover_device, &litest_alps_dualpoint_device, + &litest_mouse_low_dpi_device, NULL, }; diff --git a/test/litest.h b/test/litest.h index 4990fdd1..9e782966 100644 --- a/test/litest.h +++ b/test/litest.h @@ -137,6 +137,7 @@ enum litest_device_type { LITEST_LOGITECH_TRACKBALL = -23, LITEST_ATMEL_HOVER = -24, LITEST_ALPS_DUALPOINT = -25, + LITEST_MOUSE_LOW_DPI = -26, }; enum litest_device_feature { From 40dab334ab4f5824489529a91df650defc59d86d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 19 Jun 2015 16:03:42 +1000 Subject: [PATCH 14/26] filter: pass the DPI to the acceleration filter Currently unused, but store the ratio of DPI:default DPI for later use. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 3 ++- src/evdev.h | 3 --- src/filter.c | 7 ++++++- src/filter.h | 3 ++- src/libinput-util.h | 3 +++ tools/ptraccel-debug.c | 3 ++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 9602587c..62e6b838 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1410,7 +1410,8 @@ int evdev_device_init_pointer_acceleration(struct evdev_device *device, accel_profile_func_t profile) { - device->pointer.filter = create_pointer_accelerator_filter(profile); + device->pointer.filter = create_pointer_accelerator_filter(profile, + device->dpi); if (!device->pointer.filter) return -1; diff --git a/src/evdev.h b/src/evdev.h index 0485894d..4e773449 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -36,9 +36,6 @@ #include "timer.h" #include "filter.h" -/* The HW DPI rate we normalize to before calculating pointer acceleration */ -#define DEFAULT_MOUSE_DPI 1000 - /* * The constant (linear) acceleration factor we use to normalize trackpoint * deltas before calculating pointer acceleration. diff --git a/src/filter.c b/src/filter.c index 1e057823..23e33495 100644 --- a/src/filter.c +++ b/src/filter.c @@ -111,6 +111,8 @@ struct pointer_accelerator { double threshold; /* units/ms */ double accel; /* unitless factor */ double incline; /* incline of the function */ + + double dpi_factor; }; static void @@ -346,7 +348,8 @@ struct motion_filter_interface accelerator_interface = { }; struct motion_filter * -create_pointer_accelerator_filter(accel_profile_func_t profile) +create_pointer_accelerator_filter(accel_profile_func_t profile, + int dpi) { struct pointer_accelerator *filter; @@ -369,6 +372,8 @@ create_pointer_accelerator_filter(accel_profile_func_t profile) filter->accel = DEFAULT_ACCELERATION; filter->incline = DEFAULT_INCLINE; + filter->dpi_factor = dpi/(double)DEFAULT_MOUSE_DPI; + return &filter->base; } diff --git a/src/filter.h b/src/filter.h index de949979..64a8b50b 100644 --- a/src/filter.h +++ b/src/filter.h @@ -58,7 +58,8 @@ typedef double (*accel_profile_func_t)(struct motion_filter *filter, uint64_t time); struct motion_filter * -create_pointer_accelerator_filter(accel_profile_func_t filter); +create_pointer_accelerator_filter(accel_profile_func_t filter, + int dpi); /* * Pointer acceleration profiles. diff --git a/src/libinput-util.h b/src/libinput-util.h index 0c56b765..00c93fe0 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -37,6 +37,9 @@ #define VENDOR_ID_APPLE 0x5ac #define VENDOR_ID_WACOM 0x56a +/* The HW DPI rate we normalize to before calculating pointer acceleration */ +#define DEFAULT_MOUSE_DPI 1000 + void set_logging_enabled(int enabled); diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c index c774e3bf..0cfe2b7e 100644 --- a/tools/ptraccel-debug.c +++ b/tools/ptraccel-debug.c @@ -199,7 +199,8 @@ main(int argc, char **argv) OPT_SPEED, }; - filter = create_pointer_accelerator_filter(pointer_accel_profile_linear); + filter = create_pointer_accelerator_filter(pointer_accel_profile_linear, + 1000); assert(filter != NULL); while (1) { From 4df1a9b66e437a191fab0ef4fc48511e993c4680 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 19 Jun 2015 16:19:27 +1000 Subject: [PATCH 15/26] tools: add --dpi= arg to ptraccel-debug Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- tools/ptraccel-debug.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c index 0cfe2b7e..b2dd1f90 100644 --- a/tools/ptraccel-debug.c +++ b/tools/ptraccel-debug.c @@ -168,6 +168,7 @@ usage(void) "--maxdx= ... in motion mode only. Stop increasing dx at maxdx\n" "--steps= ... in motion and delta modes only. Increase dx by step each round\n" "--speed= ... accel speed [-1, 1], default 0\n" + "--dpi= ... device resolution in DPI (default: 1000)\n" "\n" "If extra arguments are present and mode is not given, mode defaults to 'sequence'\n" "and the arguments are interpreted as sequence of delta x coordinates\n" @@ -191,18 +192,17 @@ main(int argc, char **argv) print_sequence = false; double custom_deltas[1024]; double speed = 0.0; + int dpi = 1000; + enum { OPT_MODE = 1, OPT_NEVENTS, OPT_MAXDX, OPT_STEP, OPT_SPEED, + OPT_DPI, }; - filter = create_pointer_accelerator_filter(pointer_accel_profile_linear, - 1000); - assert(filter != NULL); - while (1) { int c; int option_index = 0; @@ -212,6 +212,7 @@ main(int argc, char **argv) {"maxdx", 1, 0, OPT_MAXDX }, {"step", 1, 0, OPT_STEP }, {"speed", 1, 0, OPT_SPEED }, + {"dpi", 1, 0, OPT_DPI }, {0, 0, 0, 0} }; @@ -259,6 +260,9 @@ main(int argc, char **argv) case OPT_SPEED: speed = strtod(optarg, NULL); break; + case OPT_DPI: + dpi = strtod(optarg, NULL); + break; default: usage(); exit(1); @@ -266,6 +270,9 @@ main(int argc, char **argv) } } + filter = create_pointer_accelerator_filter(pointer_accel_profile_linear, + dpi); + assert(filter != NULL); filter_set_speed(filter, speed); if (!isatty(STDIN_FILENO)) { From 3928f3228105f65e4ee6186572e3f95f78c96113 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 23 Jun 2015 12:45:16 +1000 Subject: [PATCH 16/26] filter: add a custom low-dpi acceleration Motion normalization does not work well for devices below the default 1000dpi rate. A 400dpi mouse's minimum movement generates a 2.5 normalized motion, causing it to skip pixels at low speeds even when unaccelerated. Likewise, we don't want 1000dpi mice to be normalized to a 400dpi mouse, it feels sluggish even at higher acceleration speeds. Instead, add a custom acceleration method for lower-dpi mice. At low-speeds, one device unit results in a one-pixel movement. Depending on the DPI factor, the acceleration kicks in earlier and goes to higher acceleration so faster movements with a low-dpi mouse feel approximately the same as the same movement on a higher-dpi mouse. https://bugzilla.redhat.com/show_bug.cgi?id=1231304 Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 17 ++++++++++++++--- src/filter.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++----- src/filter.h | 5 +++++ 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 62e6b838..4c147b3d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1828,6 +1828,19 @@ evdev_configure_mt_device(struct evdev_device *device) return 0; } +static inline int +evdev_init_accel(struct evdev_device *device) +{ + accel_profile_func_t profile; + + if (device->dpi < DEFAULT_MOUSE_DPI) + profile = pointer_accel_profile_linear_low_dpi; + else + profile = pointer_accel_profile_linear; + + return evdev_device_init_pointer_acceleration(device, profile); +} + static int evdev_configure_device(struct evdev_device *device) { @@ -1923,9 +1936,7 @@ evdev_configure_device(struct evdev_device *device) udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK) { if (libevdev_has_event_code(evdev, EV_REL, REL_X) && libevdev_has_event_code(evdev, EV_REL, REL_Y) && - evdev_device_init_pointer_acceleration( - device, - pointer_accel_profile_linear) == -1) + evdev_init_accel(device) == -1) return -1; device->seat_caps |= EVDEV_DEVICE_POINTER; diff --git a/src/filter.c b/src/filter.c index 23e33495..35449f56 100644 --- a/src/filter.c +++ b/src/filter.c @@ -264,8 +264,16 @@ accelerator_filter(struct motion_filter *filter, double velocity; /* units/ms */ double accel_value; /* unitless factor */ struct normalized_coords accelerated; + struct normalized_coords unnormalized; + double dpi_factor = accel->dpi_factor; - feed_trackers(accel, unaccelerated, time); + /* For low-dpi mice, use device units, everything else uses + 1000dpi normalized */ + dpi_factor = min(1.0, dpi_factor); + unnormalized.x = unaccelerated->x * dpi_factor; + unnormalized.y = unaccelerated->y * dpi_factor; + + feed_trackers(accel, &unnormalized, time); velocity = calculate_velocity(accel, time); accel_value = calculate_acceleration(accel, data, @@ -273,10 +281,10 @@ accelerator_filter(struct motion_filter *filter, accel->last_velocity, time); - accelerated.x = accel_value * unaccelerated->x; - accelerated.y = accel_value * unaccelerated->y; + accelerated.x = accel_value * unnormalized.x; + accelerated.y = accel_value * unnormalized.y; - accel->last = *unaccelerated; + accel->last = unnormalized; accel->last_velocity = velocity; @@ -377,10 +385,46 @@ create_pointer_accelerator_filter(accel_profile_func_t profile, return &filter->base; } +/** + * Custom acceleration function for mice < 1000dpi. + * At slow motion, a single device unit causes a one-pixel movement. + * The threshold/max accel depends on the DPI, the smaller the DPI the + * earlier we accelerate and the higher the maximum acceleration is. Result: + * at low speeds we get pixel-precision, at high speeds we get approx. the + * same movement as a high-dpi mouse. + * + * Note: data fed to this function is in device units, not normalized. + */ +double +pointer_accel_profile_linear_low_dpi(struct motion_filter *filter, + void *data, + double speed_in, /* in device units */ + uint64_t time) +{ + struct pointer_accelerator *accel_filter = + (struct pointer_accelerator *)filter; + + double s1, s2; + double max_accel = accel_filter->accel; /* unitless factor */ + const double threshold = accel_filter->threshold; /* units/ms */ + const double incline = accel_filter->incline; + double factor; + double dpi_factor = accel_filter->dpi_factor; + + max_accel /= dpi_factor; + + s1 = min(1, 0.3 + speed_in * 10); + s2 = 1 + (speed_in - threshold * dpi_factor) * incline; + + factor = min(max_accel, s2 > 1 ? s2 : s1); + + return factor; +} + double pointer_accel_profile_linear(struct motion_filter *filter, void *data, - double speed_in, + double speed_in, /* 1000-dpi normalized */ uint64_t time) { struct pointer_accelerator *accel_filter = diff --git a/src/filter.h b/src/filter.h index 64a8b50b..617fab1f 100644 --- a/src/filter.h +++ b/src/filter.h @@ -66,6 +66,11 @@ create_pointer_accelerator_filter(accel_profile_func_t filter, */ double +pointer_accel_profile_linear_low_dpi(struct motion_filter *filter, + void *data, + double speed_in, + uint64_t time); +double pointer_accel_profile_linear(struct motion_filter *filter, void *data, double speed_in, From 79b7707d761f7e4ef788aa1d162763b0043fbf25 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 2 Jul 2015 13:39:40 +1000 Subject: [PATCH 17/26] test: wait for the uinput_monitor on test devices Set up a udev_monitor before each device creation and wait for the monitor to notify us of the newly created device. This should take the place of the various sleep loops we currently have sprinkled around the code and provide a reliability when testing. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/litest.c | 96 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/test/litest.c b/test/litest.c index 0c5eedb9..a5eeb5a7 100644 --- a/test/litest.c +++ b/test/litest.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "litest.h" #include "litest-int.h" @@ -1079,32 +1080,6 @@ litest_restore_log_handler(struct libinput *libinput) libinput_log_set_handler(libinput, litest_log_handler); } -static inline void -litest_wait_for_udev(int fd) -{ - struct udev *udev; - struct udev_device *device; - struct stat st; - int loop_count = 0; - - litest_assert_int_ge(fstat(fd, &st), 0); - - udev = udev_new(); - device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); - litest_assert_ptr_notnull(device); - while (device && !udev_device_get_property_value(device, "ID_INPUT")) { - loop_count++; - litest_assert_int_lt(loop_count, 200); - - udev_device_unref(device); - msleep(10); - device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); - } - - udev_device_unref(device); - udev_unref(udev); -} - struct litest_device * litest_add_device_with_overrides(struct libinput *libinput, enum litest_device_type which, @@ -1132,8 +1107,6 @@ litest_add_device_with_overrides(struct libinput *libinput, rc = libevdev_new_from_fd(fd, &d->evdev); litest_assert_int_eq(rc, 0); - litest_wait_for_udev(fd); - d->libinput = libinput; d->libinput_device = libinput_path_add_device(d->libinput, path); litest_assert(d->libinput_device != NULL); @@ -1220,11 +1193,6 @@ litest_delete_device(struct litest_device *d) free(d->private); memset(d,0, sizeof(*d)); free(d); - - /* zzz so udev can catch up with things, so we don't accidentally open - * an old device in the next test and then get all upset when things blow - * up */ - msleep(10); } void @@ -1756,11 +1724,11 @@ litest_assert_empty_queue(struct libinput *li) litest_assert(empty_queue); } -struct libevdev_uinput * -litest_create_uinput_device_from_description(const char *name, - const struct input_id *id, - const struct input_absinfo *abs_info, - const int *events) +static struct libevdev_uinput * +litest_create_uinput(const char *name, + const struct input_id *id, + const struct input_absinfo *abs_info, + const int *events) { struct libevdev_uinput *uinput; struct libevdev *dev; @@ -1848,6 +1816,58 @@ litest_create_uinput_device_from_description(const char *name, return uinput; } +struct libevdev_uinput * +litest_create_uinput_device_from_description(const char *name, + const struct input_id *id, + const struct input_absinfo *abs_info, + const int *events) +{ + struct libevdev_uinput *uinput; + const char *syspath; + + struct udev *udev; + struct udev_monitor *udev_monitor; + struct udev_device *udev_device; + const char *udev_action; + const char *udev_syspath; + + udev = udev_new(); + litest_assert_notnull(udev); + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + litest_assert_notnull(udev_monitor); + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", + NULL); + /* remove O_NONBLOCK */ + fcntl(udev_monitor_get_fd(udev_monitor), F_SETFL, 0); + litest_assert_int_eq(udev_monitor_enable_receiving(udev_monitor), + 0); + + uinput = litest_create_uinput(name, id, abs_info, events); + + syspath = libevdev_uinput_get_syspath(uinput); + + /* blocking, we don't want to continue until udev is ready */ + do { + udev_device = udev_monitor_receive_device(udev_monitor); + litest_assert_notnull(udev_device); + udev_action = udev_device_get_action(udev_device); + if (strcmp(udev_action, "add") != 0) { + udev_device_unref(udev_device); + continue; + } + + udev_syspath = udev_device_get_syspath(udev_device); + } while (!udev_syspath || strcmp(udev_syspath, syspath) != 0); + + litest_assert(udev_device_get_property_value(udev_device, "ID_INPUT")); + + udev_device_unref(udev_device); + udev_monitor_unref(udev_monitor); + udev_unref(udev); + + return uinput; +} + static struct libevdev_uinput * litest_create_uinput_abs_device_v(const char *name, struct input_id *id, From 97f447d670229f34490e6d0744d595388f737d7c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 2 Jul 2015 14:21:45 +1000 Subject: [PATCH 18/26] test: up the default test timeout to 10s 3s is too easy to hit on congested systems. 10s is overkill, but it's still better to pass a test late than having to restart the whole test-suite again. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/litest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/litest.c b/test/litest.c index a5eeb5a7..a91207e4 100644 --- a/test/litest.c +++ b/test/litest.c @@ -2390,6 +2390,8 @@ main(int argc, char **argv) list_init(&all_tests); + setenv("CK_DEFAULT_TIMEOUT", "10", 0); + mode = litest_parse_argv(argc, argv); if (mode == LITEST_MODE_ERROR) return EXIT_FAILURE; From 676be4b94443eb5d245551a71a2fd220cd8b81de Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 2 Jul 2015 14:22:05 +1000 Subject: [PATCH 19/26] test: use poll instead of a busy wait Drop the busy loop we had waiting for an event to appear and just call poll on the libinput fd. This actually makes the tests more correct, if we now time out where we didn't before it means we're not setting the timers correctly. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/litest.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/litest.c b/test/litest.c index a91207e4..df521fe6 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1560,6 +1560,7 @@ litest_wait_for_event_of_type(struct libinput *li, ...) enum libinput_event_type types[32] = {LIBINPUT_EVENT_NONE}; size_t ntypes = 0; enum libinput_event_type type; + struct pollfd fds; va_start(args, li); type = va_arg(args, int); @@ -1571,12 +1572,16 @@ litest_wait_for_event_of_type(struct libinput *li, ...) } va_end(args); + fds.fd = libinput_get_fd(li); + fds.events = POLLIN; + fds.revents = 0; + while (1) { size_t i; struct libinput_event *event; while ((type = libinput_next_event_type(li)) == LIBINPUT_EVENT_NONE) { - msleep(10); + poll(&fds, 1, -1); libinput_dispatch(li); } From 261c779f1c2d62838f399f14dc15e3ac2f65c031 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 3 Jul 2015 08:13:24 +1000 Subject: [PATCH 20/26] test: add some tests for udev tagging We can't easily test for DMI matches, but anything that hooks onto pid/vid is easy to verify for correctness. Signed-off-by: Peter Hutterer --- test/device.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/test/device.c b/test/device.c index f9ce5d3d..3f61f08c 100644 --- a/test/device.c +++ b/test/device.c @@ -947,6 +947,65 @@ START_TEST(device_wheel_only) } END_TEST +START_TEST(device_udev_tag_alps) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_ALPS_TOUCHPAD"); + + if (strstr(libinput_device_get_name(device), "ALPS")) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +START_TEST(device_udev_tag_wacom) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_WACOM_TOUCHPAD"); + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +START_TEST(device_udev_tag_apple) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_WACOM_TOUCHPAD"); + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST void litest_setup_tests(void) { @@ -989,4 +1048,8 @@ litest_setup_tests(void) litest_add_no_device("device:invalid devices", abs_mt_device_missing_res); litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE); + + litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY); } From a1feb4483621a117fedc646d3bdecc437c5f3937 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 3 Jul 2015 08:26:04 +1000 Subject: [PATCH 21/26] test: send a single motion event for relative tests only Since 69449ca854, the minimum deceleration is 0.3 and we don't get a 0 motion event anymore. We can drop the helper function now too. What we do in that test instead is pump one relative motion event through before we start comparing the events, this way our second, third, .. events will have some acceleration applied and the tests compare more accurate values. Signed-off-by: Peter Hutterer --- test/pointer.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/test/pointer.c b/test/pointer.c index 688b6b0b..49cc85ab 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -35,52 +35,26 @@ #include "libinput-util.h" #include "litest.h" -static struct libinput_event_pointer * -get_accelerated_motion_event(struct libinput *li) -{ - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - while (1) { - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - if (fabs(libinput_event_pointer_get_dx(ptrev)) < DBL_MIN && - fabs(libinput_event_pointer_get_dy(ptrev)) < DBL_MIN) { - libinput_event_destroy(event); - continue; - } - - return ptrev; - } - - litest_abort_msg("No accelerated pointer motion event found"); - return NULL; -} - static void test_relative_event(struct litest_device *dev, int dx, int dy) { struct libinput *li = dev->libinput; struct libinput_event_pointer *ptrev; + struct libinput_event *event; double ev_dx, ev_dy; double expected_dir; double expected_length; double actual_dir; double actual_length; - /* Send two deltas, as the first one may be eaten up by an - * acceleration filter. */ - litest_event(dev, EV_REL, REL_X, dx); - litest_event(dev, EV_REL, REL_Y, dy); - litest_event(dev, EV_SYN, SYN_REPORT, 0); litest_event(dev, EV_REL, REL_X, dx); litest_event(dev, EV_REL, REL_Y, dy); litest_event(dev, EV_SYN, SYN_REPORT, 0); libinput_dispatch(li); - ptrev = get_accelerated_motion_event(li); + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); expected_length = sqrt(4 * dx*dx + 4 * dy*dy); expected_dir = atan2(dx, dy); @@ -97,7 +71,7 @@ test_relative_event(struct litest_device *dev, int dx, int dy) * indifference). */ litest_assert(fabs(expected_dir - actual_dir) < M_PI_2); - libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + libinput_event_destroy(event); litest_drain_events(dev->libinput); } @@ -120,6 +94,13 @@ START_TEST(pointer_motion_relative) { struct litest_device *dev = litest_current_device(); + /* send a single event, the first movement + is always decelerated by 0.3 */ + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(dev->libinput); + litest_drain_events(dev->libinput); test_relative_event(dev, 1, 0); From 08fba7bd96d9a2f273bccf050bc2cc1c2f5c3dfa Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 3 Jul 2015 08:43:27 +1000 Subject: [PATCH 22/26] test: add a test for minimum motion movement The first motion on a device must have the mimimum movement factor (0.3) Signed-off-by: Peter Hutterer --- test/pointer.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/pointer.c b/test/pointer.c index 49cc85ab..2cd2a2da 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -115,6 +115,54 @@ START_TEST(pointer_motion_relative) } END_TEST +START_TEST(pointer_motion_relative_min_decel) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event_pointer *ptrev; + struct libinput_event *event; + double evx, evy; + int dx, dy; + int cardinal = _i; /* ranged test */ + double len; + + int deltas[8][2] = { + /* N, NE, E, ... */ + { 0, 1 }, + { 1, 1 }, + { 1, 0 }, + { 1, -1 }, + { 0, -1 }, + { -1, -1 }, + { -1, 0 }, + { -1, 1 }, + }; + + litest_drain_events(dev->libinput); + + dx = deltas[cardinal][0]; + dy = deltas[cardinal][1]; + + litest_event(dev, EV_REL, REL_X, dx); + litest_event(dev, EV_REL, REL_Y, dy); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); + evx = libinput_event_pointer_get_dx(ptrev); + evy = libinput_event_pointer_get_dy(ptrev); + + ck_assert((evx == 0.0) == (dx == 0)); + ck_assert((evy == 0.0) == (dy == 0)); + + len = vector_length(evx, evy); + ck_assert(fabs(len) >= 0.3); + + libinput_event_destroy(event); +} +END_TEST + static void test_absolute_event(struct litest_device *dev, double x, double y) { @@ -1328,8 +1376,10 @@ void litest_setup_tests(void) { struct range axis_range = {ABS_X, ABS_Y + 1}; + struct range compass = {0, 7}; /* cardinal directions */ litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_ANY); + litest_add_ranged("pointer:motion", pointer_motion_relative_min_decel, LITEST_RELATIVE, LITEST_ANY, &compass); litest_add("pointer:motion", pointer_motion_absolute, LITEST_ABSOLUTE, LITEST_ANY); litest_add("pointer:motion", pointer_motion_unaccel, LITEST_RELATIVE, LITEST_ANY); litest_add("pointer:button", pointer_button, LITEST_BUTTON, LITEST_CLICKPAD); From 2e339095b38b06b72a5ce6c4485c8aad758a74e7 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 3 Jul 2015 09:09:16 +1000 Subject: [PATCH 23/26] test: add a test for 0/0 relative motion events This test doesn't really test for that because the kernel shouldn't forward these events to us in the first place. It's merely a canary to warn us if this ever changes and we end up not ignoring the events. The test is only run for one device (the default mouse), no need to waste more time on this. Signed-off-by: Peter Hutterer --- test/pointer.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/pointer.c b/test/pointer.c index 2cd2a2da..28d7c9a6 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -115,6 +115,47 @@ START_TEST(pointer_motion_relative) } END_TEST +START_TEST(pointer_motion_relative_zero) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + + /* NOTE: this test does virtually nothing. The kernel should not + * allow 0/0 events to be passed to userspace. If it ever happens, + * let's hope this test fails if we do the wrong thing. + */ + litest_drain_events(li); + + for (i = 0; i < 5; i++) { + litest_event(dev, EV_REL, REL_X, 0); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + } + litest_assert_empty_queue(li); + + /* send a single event, the first movement + is always decelerated by 0.3 */ + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + libinput_event_destroy(libinput_get_event(li)); + litest_assert_empty_queue(li); + + for (i = 0; i < 5; i++) { + litest_event(dev, EV_REL, REL_X, 0); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(dev->libinput); + } + litest_assert_empty_queue(li); + +} +END_TEST + START_TEST(pointer_motion_relative_min_decel) { struct litest_device *dev = litest_current_device(); @@ -1379,6 +1420,7 @@ litest_setup_tests(void) struct range compass = {0, 7}; /* cardinal directions */ litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_ANY); + litest_add_for_device("pointer:motion", pointer_motion_relative_zero, LITEST_MOUSE); litest_add_ranged("pointer:motion", pointer_motion_relative_min_decel, LITEST_RELATIVE, LITEST_ANY, &compass); litest_add("pointer:motion", pointer_motion_absolute, LITEST_ABSOLUTE, LITEST_ANY); litest_add("pointer:motion", pointer_motion_unaccel, LITEST_RELATIVE, LITEST_ANY); From 16b4dbac79d1918b9da30e7c4a4e16e3ad9ab8d3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 6 Jul 2015 11:22:34 +1000 Subject: [PATCH 24/26] Add missing "global" tag to the 0.19 symbol block Not required, but for consistency. Signed-off-by: Peter Hutterer --- src/libinput.sym | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libinput.sym b/src/libinput.sym index 2c023367..773a7a46 100644 --- a/src/libinput.sym +++ b/src/libinput.sym @@ -142,6 +142,7 @@ global: } LIBINPUT_0.14.0; LIBINPUT_0.19.0 { +global: libinput_device_config_tap_set_drag_lock_enabled; libinput_device_config_tap_get_drag_lock_enabled; libinput_device_config_tap_get_default_drag_lock_enabled; From cd6326aa22534a772fe60b84afd7e95411dc1d05 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 6 Jul 2015 11:37:46 +1000 Subject: [PATCH 25/26] test: initialize syspath When the condition with continue was hit, syspath was still compared in the loop condition, leading to crashes when strcmp()-ing a random string. Signed-off-by: Peter Hutterer --- test/litest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/litest.c b/test/litest.c index df521fe6..ab69d6c9 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1834,7 +1834,7 @@ litest_create_uinput_device_from_description(const char *name, struct udev_monitor *udev_monitor; struct udev_device *udev_device; const char *udev_action; - const char *udev_syspath; + const char *udev_syspath = NULL; udev = udev_new(); litest_assert_notnull(udev); From 610e17a70576c0df56d7d65c119ec19408d53787 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 6 Jul 2015 10:21:59 +1000 Subject: [PATCH 26/26] configure.ac: libinput 0.19.0 Signed-off-by: Peter Hutterer --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 314b0d46..978bbeaf 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.64]) m4_define([libinput_major_version], [0]) -m4_define([libinput_minor_version], [18]) +m4_define([libinput_minor_version], [19]) m4_define([libinput_micro_version], [0]) m4_define([libinput_version], [libinput_major_version.libinput_minor_version.libinput_micro_version]) @@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) # b) If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # c) If the interface is the same as the previous version, change to C:R+1:A -LIBINPUT_LT_VERSION=12:3:2 +LIBINPUT_LT_VERSION=13:0:3 AC_SUBST(LIBINPUT_LT_VERSION) AM_SILENT_RULES([yes])