summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@google.com>2017-10-13 12:46:11 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-19 14:56:09 -0700
commit3bd60c42ecd3d2ade28e1ce4fbc05aef4afdf077 (patch)
tree51fcf4806f5bd6108b867db1bc5938bedbf83651 /common/keyboard_8042.c
parentce2377414aeabddba8bfb109a9eb6aeb5303850f (diff)
downloadchrome-ec-3bd60c42ecd3d2ade28e1ce4fbc05aef4afdf077.tar.gz
Fix keyboard in systemd-boot
This prevents problematic disabling of the keystrokes by making it so that 0xAD can't disable keystrokes. Also cleans up keyboard controller enable/disable code. BRANCH=none BUG=none TEST=keyboard now working in UEFI bootloaders like systemd-boot (aka gummiboot) Change-Id: I921834fc418572c9a0f4586039ac1ce05504bf1d Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/722124 Tested-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 7aa82e2de8..4c1fb24395 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -424,22 +424,11 @@ static void keystroke_enable(int enable)
static void keyboard_enable(int enable)
{
- if (!keyboard_enabled && enable) {
+ if (!keyboard_enabled && enable)
CPRINTS("KB enable");
- } else if (keyboard_enabled && !enable) {
+ else if (keyboard_enabled && !enable)
CPRINTS("KB disable");
- reset_rate_and_delay();
- typematic_len = 0; /* stop typematic */
- /* Disable keystroke as well in case the BIOS doesn't
- * disable keystroke where repeated strokes are queued
- * before kernel initializes keyboard. Hence the kernel
- * is unable to get stable CTR read (get key codes
- * instead).
- */
- keystroke_enable(0);
- keyboard_clear_buffer();
- }
keyboard_enabled = enable;
}
@@ -688,6 +677,9 @@ static int handle_keyboard_command(uint8_t command, uint8_t *output)
case I8042_DIS_KB:
update_ctl_ram(0, read_ctl_ram(0) | I8042_KBD_DIS);
+ reset_rate_and_delay();
+ typematic_len = 0; /* stop typematic */
+ keyboard_clear_buffer();
break;
case I8042_ENA_KB: