diff --git a/doc/button-debouncing-state-machine.svg b/doc/button-debouncing-state-machine.svg index 6f106a89..48723a13 100644 --- a/doc/button-debouncing-state-machine.svg +++ b/doc/button-debouncing-state-machine.svg @@ -1,6 +1,6 @@ - + @@ -8,12 +8,10 @@
-
-IS_UP
+
IS_UP
- -IS_UP + IS_UP
@@ -21,13 +19,10 @@ IS_UP
-
-button
-press
+
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -37,12 +32,10 @@ press
-
-DOWN_WAITING
+
DOWN_WAITING
- -DOWN_WAITING + DOWN_WAITING
@@ -50,12 +43,10 @@ DOWN_WAITING
-
-RELEASE_PENDING
+
RELEASE_PENDING
- -RELEASE_PENDING + RELEASE_PENDING
@@ -63,12 +54,10 @@ RELEASE_PENDING
-
-timeout
+
timeout
- -timeout + timeout
@@ -76,14 +65,10 @@ timeout
-
-notify
-button
-release
+
notify
button
release
- -[Not supported by viewer] + [Not supported by viewer]
@@ -91,14 +76,10 @@ release
-
-notify
-button
-press
+
notify
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -108,12 +89,10 @@ press
-
-IS_DOWN
+
IS_DOWN
- -IS_DOWN + IS_DOWN
@@ -123,13 +102,10 @@ IS_DOWN
-
-button
-release
+
button
release
- -button<br>release + button<br>release
@@ -141,12 +117,10 @@ button<br>release
-
-timeout
+
timeout
- -timeout + timeout
@@ -156,12 +130,10 @@ timeout
-
-IS_UP
+
IS_UP
- -IS_UP + IS_UP
@@ -169,13 +141,10 @@ IS_UP
-
-button
-release
+
button
release
- -button<br>release + button<br>release
@@ -185,13 +154,10 @@ button<br>release
-
-button
-press
+
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -203,14 +169,10 @@ press
-
-notify
-button
-release
+
notify
button
release
- -[Not supported by viewer] + [Not supported by viewer]
@@ -218,12 +180,10 @@ release
-
-RELEASE_WAITING
+
RELEASE_WAITING
- -RELEASE_WAITING + RELEASE_WAITING
@@ -231,13 +191,10 @@ RELEASE_WAITING
-
-button
-press
+
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -247,29 +204,27 @@ press
-
-timeout
+
timeout
- -timeout + timeout
+ +
-
-MAYBE_SPURIOUS
+
MAYBE_SPURIOUS
- -MAYBE_SPURIOUS + MAYBE_SPURIOUS
@@ -279,13 +234,10 @@ MAYBE_SPURIOUS
-
-button
-release
+
button
release
- -button<br>release + button<br>release
@@ -297,13 +249,10 @@ button<br>release
-
-timeout
-short
+
timeout
short
- -timeout<br>short + timeout<br>short
@@ -317,13 +266,10 @@ timeout<br>short
-
-spurious
-enabled?
+
spurious
enabled?
- -spurious<br>enabled? + spurious<br>enabled?
@@ -332,12 +278,10 @@ spurious<br>enabled?
-
-no
+
no
- -no + no
@@ -345,13 +289,10 @@ no
-
-timeout
-short
+
timeout
short
- -timeout<br>short + timeout<br>short
@@ -361,12 +302,10 @@ timeout<br>short
-
-RELEASED
+
RELEASED
- -RELEASED + RELEASED
@@ -378,13 +317,10 @@ RELEASED
-
-button
-press
+
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -394,12 +330,10 @@ press
-
-PRESS_PENDING
+
PRESS_PENDING
- -PRESS_PENDING + PRESS_PENDING
@@ -409,13 +343,10 @@ PRESS_PENDING
-
-button
-release
+
button
release
- -button<br>release + button<br>release
@@ -427,12 +358,10 @@ button<br>release
-
-timeout
+
timeout
- -timeout + timeout
@@ -440,14 +369,10 @@ timeout
-
-notify
-button
-press
+
notify
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -463,12 +388,10 @@ press
-
-RELEASE_DELAYED
+
RELEASE_DELAYED
- -RELEASE_DELAYED + RELEASE_DELAYED
@@ -477,12 +400,10 @@ RELEASE_DELAYED
-
-yes
+
yes
- -yes + yes
@@ -490,13 +411,10 @@ yes
-
-timeout
-short
+
timeout
short
- -timeout<br>short + timeout<br>short
@@ -508,13 +426,10 @@ timeout<br>short
-
-button
-press
+
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -526,13 +441,10 @@ press
-
-set
-timer
+
set
timer
- -[Not supported by viewer] + [Not supported by viewer]
@@ -544,13 +456,10 @@ timer
-
-set
-timer
+
set
timer
- -[Not supported by viewer] + [Not supported by viewer]
@@ -562,13 +471,10 @@ timer
-
-set short
-timer
+
set short
timer
- -set short<br>timer + set short<br>timer
@@ -578,13 +484,10 @@ set short<br>timer
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -596,13 +499,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -614,13 +514,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -632,13 +529,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -650,13 +544,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -668,13 +559,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -682,12 +570,10 @@ button
-
-timeout
+
timeout
- -timeout + timeout
@@ -701,14 +587,10 @@ timeout
-
-notify
-button
-press
+
notify
button
press
- -[Not supported by viewer] + [Not supported by viewer]
@@ -720,13 +602,10 @@ press
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -736,13 +615,10 @@ button
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -752,14 +628,10 @@ button
-
-notify
-button
-release
+
notify
button
release
- -[Not supported by viewer] + [Not supported by viewer]
@@ -771,19 +643,13 @@ release
-

-Entry states: IS_UP, IS_DOWN
-

-

-Assumption: state is stored per-button, and OTHER BUTTON events are always processed before the actual button. Stored state per button is a single bit (up/down), a single state for the state machine across the device is sufficient.

-

-Start the state machine with IS_UP or IS_DOWN based on the button's bit, any OTHER BUTTON event will reset it to that state anyway, so the state can be re-used for the new button.
-

+

Entry states: IS_UP, IS_DOWN

+

Assumption: state is stored per-button, and OTHER BUTTON events are always processed before the actual button. Stored state per button is a single bit (up/down), a single state for the state machine across the device is sufficient.

+

Start the state machine with IS_UP or IS_DOWN based on the button's bit, any OTHER BUTTON event will reset it to that state anyway, so the state can be re-used for the new button.

- -[Not supported by viewer] + [Not supported by viewer] @@ -791,13 +657,10 @@ Start the state machine with IS_UP or IS_DOWN based on the button's bit, any OTH
-
-other
-button
+
other
button
- -[Not supported by viewer] + [Not supported by viewer]
@@ -809,13 +672,10 @@ button
-
-enable
-spurious
+
enable
spurious
- -enable<br>spurious + enable<br>spurious
@@ -831,12 +691,23 @@ enable<br>spurious
-
-IS_DOWN
+
IS_DOWN
- -IS_DOWN + IS_DOWN +
+ + + + + + + +
+
timeout
+
+
+ timeout
diff --git a/src/evdev-debounce.c b/src/evdev-debounce.c index 7f96249b..74faf39b 100644 --- a/src/evdev-debounce.c +++ b/src/evdev-debounce.c @@ -335,9 +335,6 @@ debounce_maybe_spurious_handle_event(struct fallback_dispatch *fallback, enum de case DEBOUNCE_EVENT_RELEASE: debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_WAITING); break; - case DEBOUNCE_EVENT_TIMEOUT: - log_debounce_bug(fallback, event); - break; case DEBOUNCE_EVENT_TIMEOUT_SHORT: debounce_cancel_timer(fallback); debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); @@ -345,6 +342,7 @@ debounce_maybe_spurious_handle_event(struct fallback_dispatch *fallback, enum de debounce_notify_button(fallback, LIBINPUT_BUTTON_STATE_PRESSED); break; + case DEBOUNCE_EVENT_TIMEOUT: case DEBOUNCE_EVENT_OTHERBUTTON: debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); debounce_notify_button(fallback,