diff options
author | Nico Huber <nico.h@gmx.de> | 2020-11-01 19:36:48 +0100 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2020-12-24 08:18:41 +0000 |
commit | a160d93dda188b33b4b28bb888bd78120e42695d (patch) | |
tree | 4fa8a73248e4fbf6fafb7e0db559cf2f8ded1e5f /configs/config.pcengines_apu4 | |
parent | f651022df366565871ca28bff644c049f46bcf0e (diff) |
libpayload/keyboard: Revise keyboard_cmd() error handling
Even if we are careful, it's still possible that we read spurious
data from the keyboard, e.g. keystrokes. Namely, when we send the
reset/disable command, there is a race before the command is pro-
cessed.
So we should always process data from the keyboard in a loop. We
break it, when an ACK (0xfa) or a NAK (0xfe) is received, and warn
on unexpected data unless it might be due to the mentioned race.
This also gives us the opportunity to use command-specific timeouts
which we take from Linux: 1s for the keyboard self-test (as there
are keyboards that perform the test before acking the command) and
200ms for all other commands.
Change-Id: I60a2643a8ff4b9231c63bf970c8749c97c7d8926
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47083
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'configs/config.pcengines_apu4')
0 files changed, 0 insertions, 0 deletions