link: fix race condition enabling keyboard interrupt
Previously, an edge on a keyboard row could be missed if it occurred
after the last scan, but before interrupts are enabled. Now we
explicitly check if any keys are down before waiting for an interrupt,
and if any are, we simply don't wait to scan.
BUG=chrome-os-partner:7484
BRANCH=link
TEST=the race condition's really tricky to hit
The best we can do for testing is to ensure that we ARE sleeping in
the normal case where no keys are held down. For that, don't press
any keys, and run 'taskinfo' from the EC console twice about 10 sec
apart. Both printouts should have virtually identical times for the
KEYSCAN task.
Change-Id: I4e0ef18a2d71d0a5d3655742bd49fc15afc4aaed
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34709
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
1 file changed