libpayload: Fix handling of CAPS LOCK key on PS/2 keyboards

The PS/2 keyboard driver set and reset the caps LED to show the
keyboard status. Unfortunately, that configuration happens over
the same path used to transmit keypresses.

In face of certain error conditions, the keyboard stopped working.
This change makes keyboard handling more robust.

Change-Id: I0489a9983ea7dab00357220e09398dd1a8538839
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/430
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2011-11-10 15:48:37 +01:00 committed by Stefan Reinauer
parent f5e102d810
commit 583abc2eb2
1 changed files with 4 additions and 2 deletions

View File

@ -166,11 +166,13 @@ static struct layout_maps keyboard_layouts[] = {
static void keyboard_cmd(unsigned char cmd, unsigned char val)
{
while (inb(0x64) & 2);
outb(cmd, 0x60);
/* wait until keyboard controller accepts cmds: */
mdelay(20);
while (inb(0x64) & 2);
outb(val, 0x60);
while (inb(0x64) & 2);
mdelay(20);
}
int keyboard_havechar(void)