Skip to content
  • Peter Hutterer's avatar
    evdev: add new debouncing code · de994d13
    Peter Hutterer authored
    
    
    The current debouncing code monitors events and switches on when events are
    too close together. From then on, any event can be delayed.
    
    Vicente Bergas provided an algorithm that avoids most of these delays:
    on a button state change we now forward the change without delay but start a
    timer. If the button changes state during that timer, the changes are
    ignored. On timer expiry, events are sent to match the hardware state
    with the client's view of the device. This is only done if needed.
    
    Thus, a press-release sequence of: PRP sends a single press event, a sequence of
    PRPR sends press and then the release at the end of the timeout. The timeout
    is short enough that the delay should not be noticeable.
    
    This new mode is called the 'bounce' mode. The old mode is now referred to as
    'spurious' mode and only covers the case of a button held down that loses
    contact. It works as before, monitoring a button for these spurious contact
    losses and switching on. When on, button release events are delayed as before.
    
    The whole button debouncing moves to a state machine which makes debugging a
    lot easier. See the accompanying SVG for the diagram.
    
    Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    de994d13