• Shawn Nematbakhsh's avatar
    Input: atkbd - fix multi-byte scancode handling on reconnect · be2d7e42
    Shawn Nematbakhsh authored
    On resume from suspend there is a possibility for multi-byte scancodes
    to be handled incorrectly. atkbd_reconnect disables the processing of
    scancodes in software by calling atkbd_disable, but the keyboard may
    still be active because no disconnect command was sent. Later, software
    handling is re-enabled. If a multi-byte scancode sent from the keyboard
    straddles the re-enable, only the latter byte(s) will be handled.
    
    In practice, this leads to cases where multi-byte break codes (ex. "e0
    4d" - break code for right-arrow) are misread as make codes ("4d" - make
    code for numeric 6), leading to one or more unwanted, untyped characters
    being interpreted.
    
    The solution implemented here involves sending command f5 (reset
    disable) to the keyboard prior to disabling software handling of codes.
    Later, the command to re-enable the keyboard is sent only after we are
    prepared to handle scancodes.
    Signed-off-by: default avatarShawn Nematbakhsh <shawnn@chromium.org>
    Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    be2d7e42
atkbd.c 43.9 KB