• Dmitry Torokhov's avatar
    Input: libps2 - do not discard non-ack bytes when controlling LEDs · f219050a
    Dmitry Torokhov authored
    Upon receiving a PS/2 command the device and controller are supposed to
    stop sending normal data (scancodes or movement packets) and instead
    immediately start delivering ACK/NAK and command response. Unfortunately
    often EC has an output buffer which may contain latched data by the time
    the EC receives a command from the host. The kernel used to ignore such
    data, but that may cause "stuck" keys if the data dropped happens to be a
    break code or a part of a break code. This occasionally happens, for
    example, on Chromebooks when the kernel tries to toggle CapsLock LED on
    a keyboard while user releases Alt+Search keyboard shortcut.
    
    Fix this by passing the first non-ACK byte to the normal handler for a
    handful of PS/2 commands that are expected to be used during normal device
    operation (as opposed to probe/configuration time).
    Reviewed-by: default avatarRaul E Rangel <rrangel@chromium.org>
    Link: https://lore.kernel.org/r/20230511185252.386941-8-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    f219050a
libps2.c 16 KB