Bug 103636 - Debouncing causes "sticky" buttons
Summary: Debouncing causes "sticky" buttons
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
: 103673 103811 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-09 05:18 UTC by Lewis Diamond
Modified: 2017-11-25 18:33 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
evemu test, doesn't repro for me, but might be helpful. (265.40 KB, text/plain)
2017-11-09 05:25 UTC, Lewis Diamond
Details

Description Lewis Diamond 2017-11-09 05:18:05 UTC
Commit 55d1bb1217388e99b9405654c14881a9ebf8f880 introduced a bug for me. When repeatedly clicking all 3 buttons of my mouse VERY fast all at the same time (pretty much smashing my mouse buttons), it gets into a state of "stickiness". When in that state, clicking 2 buttons simultaneously will release only one of them.

Unfortunately evemu does not allow me to reproduce.

If any information / debugging help is needed let me know. I already set up everything to compile install and test (found the commit with git bisect).
Comment 1 Lewis Diamond 2017-11-09 05:25:58 UTC
Created attachment 135336 [details]
evemu test, doesn't repro for me, but might be helpful.
Comment 2 Peter Hutterer 2017-11-09 05:57:30 UTC
E: 4.135016 0004 0004 589825	# EV_MSC / MSC_SCAN             589825
E: 4.135016 0001 0110 0000	# EV_KEY / BTN_LEFT             0
E: 4.135016 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +9ms
E: 4.136733 0004 0004 589825	# EV_MSC / MSC_SCAN             589825
E: 4.136733 0001 0110 0001	# EV_KEY / BTN_LEFT             1
E: 4.136733 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +1ms

This is your problem. A button left press comes 1ms after the previous button release, libinput assumes that this is a bouncing button with a flaky contact and enables button debouncing. From then on, button events are debounced, so anything within the 12ms debounce timeout will be filtered. See

https://wayland.freedesktop.org/libinput/doc/latest/button_debouncing.html

When you run libinput debug-events you should see a "Enabling button debouncing" message when this happens. I question your ability to really release and click within 1ms though :) I think we need some special timeout to paper over multiple button releases, afaict this only happens when multiple buttons change state.

There's another patch on the list atm that will have to be merged first before we can fix this issue here though

https://lists.freedesktop.org/archives/wayland-devel/2017-November/035666.html
Comment 3 Lewis Diamond 2017-11-09 17:49:52 UTC
For the record, this also triggered the issue:
https://gist.github.com/lewisdiamond/cb22aa11a3eee8305fd636b40f889b2f

No "Enabling button debouncing" message was printed

Maybe we could simply have an option to disable debouncing.
Comment 4 Peter Hutterer 2017-11-10 00:01:22 UTC
https://wayland.freedesktop.org/libinput/doc/latest/faq.html#faq_configuration

You need to use --verbose to see that message
Comment 5 Peter Hutterer 2017-11-13 23:02:39 UTC
*** Bug 103673 has been marked as a duplicate of this bug. ***
Comment 6 Peter Hutterer 2017-11-14 05:27:22 UTC
reproduced it with attachment 135377 [details] from 103673 after some modifications (reduced the timeout for the right button release and removed the 'cycle the stuck button once' bit.
but I find I can only trigger it if I replay the recording twice with quick succession (i.e. hitting enter twice with evemu-play).

The good news is that this is fixed by the debounce patches I just sent to the list. [1] With those, the state is always reset correctly. Some of the button events get 'lost' but that's kinda the point of the debouncing code. Let's wait for those to get merged and then we can check again whether there are any issues left.

[1] https://lists.freedesktop.org/archives/wayland-devel/2017-November/035782.html
Comment 7 rrkay 2017-11-17 23:34:19 UTC
I second the request for having a way to disable debouncing.

This new feature breaks high frequency input in video games. 
Along with this issue, my left/right mouse buttons stop working correctly when switching from a video game window (Dota 2) and another workspace in i3 window manager, making input very inconsistent.

This doesn't happen in 1.8.3, only started with 1.9.1, still occurs in 1.9.2.

I also have some trouble getting consistent output of the "debouncing" messages with libinput-debug-events --verbose.
Comment 8 rrkay 2017-11-18 00:02:54 UTC
Don't mind me, I'm a clueless user. Didn't realize Peter's patch wasn't merged yet. Sorry for adding noise, and thanks a lot Peter.
Comment 9 Peter Hutterer 2017-11-20 01:31:16 UTC
*** Bug 103811 has been marked as a duplicate of this bug. ***
Comment 10 Peter Hutterer 2017-11-20 03:19:11 UTC
Should be fixed with 0e0dfe9bdfa0, please test git master and re-open if it's still an issue
Comment 11 Antti Korpi 2017-11-22 13:48:13 UTC
Confirming: current git master (following 0e0dfe9bdfa0) fixes this for me.
Comment 12 Hi-Angel 2017-11-24 20:16:47 UTC
@Peter Hutterer I just built from the git for testing. I see something weird is happening, I don't know if it's relevant or a new problem. After installing libinput I ran Xonotic from a terminal, and played a bit, then I switched to workspace with browser to type something. After a while I switched to the workspace with game, and noticed movement became oddly slow. I closed the game, switched back to the terminal, and then in terminal started self-typing the following:

fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:fingerprint:

Thanks though it's not ":7 days left:".
Comment 13 Hi-Angel 2017-11-24 21:45:56 UTC
Can't reproduce another time. I just hope you have any ideas, that sounds like some forgotten debugging code in the library.
Comment 14 Peter Hutterer 2017-11-25 02:25:27 UTC
no idea what that could be. the closest would be that you had "fingerprint:" highlighted and a set of ghost middle button events kept pasting this. There's nothing else in libinput that could otherwise trigger this...
Comment 15 Hi-Angel 2017-11-25 18:33:44 UTC
(In reply to Peter Hutterer from comment #14)
> no idea what that could be. the closest would be that you had "fingerprint:"
> highlighted and a set of ghost middle button events kept pasting this.
> There's nothing else in libinput that could otherwise trigger this...

Thank you, I thought it'd be nice to mention it's probably something with my mouse, i.e. not libinput. About 15 minutes ago for no reason stopped working wheel scroll (middle button works though),  though touchpad side-scroll still works. `evemu-record` shows no events; I tried different usb-ports, different libinput versions, reboots with them… To no avail.

That said, I don't really see how could that influence my in-game movement, but oh well, can't reproduce anymore anyway.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.