[Wayland-bugs] [Bug 101796] Keys can get stuck permanently when grabbing keyboard with evdev

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Jul 15 20:03:13 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=101796

            Bug ID: 101796
           Summary: Keys can get stuck permanently when grabbing keyboard
                    with evdev
           Product: Wayland
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: libinput
          Assignee: wayland-bugs at lists.freedesktop.org
          Reporter: noah.bergbauer at tum.de

The logic in evdev.c
(https://github.com/wayland-project/libinput/blob/688142c8a22c00cfe7b9dec6a71e935b899d8b65/src/evdev.c#L167-L169)
remembers how many times a key is pressed simultaneously and only emits KEY_UP
events when this counter is incremented to 1 and KEY_DOWN when it is
decremented to 0.

This is problematic as key release events might get dropped, for example if the
keyboard is exclusively grabbed by evdev's EVIOCGRAB while a key is pressed.

This issue is easily reproducible by launching one instance of
libinput-debug-events (or any libinput-based application that reads keyboard
input) and then running this in another terminal:
libinput-debug-events --device /path/to/keyboard --grab & (sleep 1 ; killall
libinput-debug-events)

Because you submit the command by pressing the Enter key and
libinput-debug-events launches fast enough, the release event for your Enter
key happens after the device is grabbed, so the first instance of
libinput-debug-events will not receive it. Because of this bug, the Enter key
is now permanently stuck there as it is always pressed either 1 or 2 times, so
libinput will never send any key events for it again.

(Please note that running this test inside any libinput-based desktop
environment (xf86-input-libinput or Wayland) obviously triggers the same bug
and may force you to restart your window manager.)



In other implementations (xf86-input-evdev, Microsoft Windows), missing release
events are handled gracefully: As pressing an already held key indicates a
missing release event, they just ignore this, so a subsequent key release event
actually releases the key.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20170715/c740d152/attachment.html>


More information about the wayland-bugs mailing list