[PATCH libinput v3 0/1] Fix debouncing algorithm

Vicente Bergas vicencb at gmail.com
Sat Nov 11 14:44:42 UTC 2017


On Wed, 8 Nov 2017 21:19:04 +1000, Peter Hutterer wrote:
>On Tue, Nov 07, 2017 at 10:26:11PM +0100, Vicente Bergas wrote:
>>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.
>
>yeah, it should be. in most case you get an  error message like this:
>litest error libinput bug: timer event19 debounce: offset negative (-3165)
>where the 'debounce' bit is the timer's name that gets wrongly set. For the
>test cases it's often a sign of a missing libinput_dispatch()
>e.g. for the timer_debounce it works with this diff applied:
>
>diff --git a/test/test-pointer.c b/test/test-pointer.c
>index 25ddc765..3ce80840 100644
>--- a/test/test-pointer.c
>+++ b/test/test-pointer.c
>@@ -2154,6 +2154,7 @@ START_TEST(debounce_timer)
>        litest_event(dev, EV_SYN, SYN_REPORT, 0);
>        litest_event(dev, EV_KEY, BTN_LEFT, 0);
>        litest_event(dev, EV_SYN, SYN_REPORT, 0);
>+       libinput_dispatch(li);
>
>        litest_timeout_debounce();
>        litest_drain_events(li);
>

Now that I have been able to run the test suite and having your hint about
libinput_dispatch, the new test suite is now fixed, it passes all bouncing
tests.
You can ignore v2 and go straight to v3.

>
>but I also see failures in e.g. trackpoint_topsoftbuttons_left_handed_both,
>touchpad_left_handed and pointer_left_handed which have no obvious error in
>the test case. After debugging this for way too long I discovered/remembered
>that litest_button_click() forces a debounce timeout (15ms). That's likely
>the source of your offsets, any test with that call can cause the test case
>failure. The debounce timeout was added there because otherwise we'd have to
>update a lot of test cases for debouncing - I guess with your new algorithm
>we'll have to do this anyway.
>
>Cheers,
>   Peter

Regards,
  Vicente.

Vicente Bergas (1):
  Fix debouncing algorithm

 doc/button_debouncing.dox |  16 ++--
 src/evdev-fallback.c      | 180 +++++++++++++----------------------
 src/evdev.h               |  19 ----
 test/litest.c             |   2 +-
 test/litest.h             |   4 +-
 test/test-pointer.c       | 237 ++++++++++++++++------------------------------
 6 files changed, 163 insertions(+), 295 deletions(-)

-- 
2.15.0



More information about the wayland-devel mailing list