mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 22:10:05 +01:00
Some devices have worn-out switches or just cheap switches that trigger multiple button events for each press. These can be identified by unfeasably short time deltas between the release and the next press event. In the recordings I've seen so far, that timeout is 8ms. We have a two-stage behavior: by default, we do not delay any events but we monitor timestamps. The first time a bouncing button is detected we switch to debounce mode. From then on, release events are delayed slightly to check for subsequent button events. If one occurs, the releas and press are filtered. If none occurs, the release event is passed to the caller. https://bugs.freedesktop.org/show_bug.cgi?id=100057 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
26 lines
1.2 KiB
Text
26 lines
1.2 KiB
Text
/**
|
|
|
|
@page button_debouncing Button debouncing
|
|
|
|
Physical buttons experience wear-and-tear with usage. On some devices this
|
|
can result in an effect called "contact bouncing" or "chatter". This effect
|
|
can cause the button to send multiple events within a short time frame, even
|
|
though the user only pressed or clicked the button once. This effect can be
|
|
counteracted by "debouncing" the buttons, usually by ignoring erroneous
|
|
events.
|
|
|
|
libinput has a built-in debouncing for hardware defects. This feature is
|
|
available for all button-base devices but not active by default. When
|
|
libinput detects a faulty button on a device, debouncing is enabled and a
|
|
warning is printed to the log. Subsequent button events are handled
|
|
correctly in that bouncing button events are ignored, a user should thus see
|
|
the expected behavior.
|
|
|
|
Note that libinput's debouncing intended to correct hardware damage or
|
|
substandard hardware. Debouncing is also used as an accessibility feature
|
|
but the requirements are different. In the accessibility feature, multiple
|
|
physical key presses, usually caused by involuntary muscle movement, must be
|
|
filtered to only one key press. This feature must be implemented higher in
|
|
the stack, libinput is limited to hardware debouncing.
|
|
|
|
*/
|