[PATCH libinput 0/1] Fix debouncing algorithm

Vicente Bergas vicencb at gmail.com
Tue Nov 7 21:26:11 UTC 2017

Hi Peter,

On Thu, Nov 2, 2017 at 2:04 AM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Thu, Nov 02, 2017 at 12:34:01AM +0100, Vicente Bergas wrote:
>> I hope it is fixed, but not been able to run the test-suite.
>> Please, can you confirm if the new test-suite passes?
> running the full test suite should be a simple sudo ninja test, or you run
> it directly with
>  sudo ./build/libinput-test-suite-runner --filter-test="*sometestname*"
> That is particularly useful when you are working on a specific feature and
> want a quick test turnover time (the full suite can take up 20 min or
> longer)
> https://wayland.freedesktop.org/libinput/doc/latest/test-suite.html
> has more documentation and we can add to that what's missing

I ran the test suite and it failed :(
One of the reasons it failed is because the time parameter passed to
fallback_interface_process is far behind the current time.
Is that expected?
I expected that the time parameter would be the same (or very close
to) the current time.
If you apply the following patch to the currently released libinput,
then you will be able to reproduce with:
./build/libinput-test-suite-runner --filter-test="debouce_timer"
All 14 tests will fail in the newly added check.

--- a/src/evdev-fallback.c
+++ b/src/evdev-fallback.c
@@ -28,6 +28,8 @@

 #include <mtdev-plumbing.h>

+#include <inttypes.h>
 #include "evdev.h"

 #define    DEBOUNCE_TIME ms2us(12)
@@ -1132,6 +1134,10 @@ fallback_interface_process(struct
evdev_dispatch *evdev_dispatch,
     struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
     enum evdev_event_type sent;

+    uint64_t now = libinput_now(dispatch->debounce.timer.libinput);
+    if(time+DEBOUNCE_TIME < now)
+        log_bug_libinput(dispatch->debounce.timer.libinput, "event
time is far behind: %"PRId64"\n", time-now);
     if (dispatch->ignore_events)

(this patch is for ilustrative purposes only, not to be merged)


> rest of the comments are in the v2 patch (haven't looked at it yet though),
> many thanks for the v2
> Cheers,
>    Peter

More information about the wayland-devel mailing list