From e065a7048aa98d253cdcc9298c934bb7af7feaa9 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Tue, 3 Feb 2015 18:23:04 -0500 Subject: some work --- drivers/ps2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/ps2.c') diff --git a/drivers/ps2.c b/drivers/ps2.c index ff85091..0d466aa 100644 --- a/drivers/ps2.c +++ b/drivers/ps2.c @@ -4,20 +4,31 @@ #include "isr.h" #include "ps2.h" +static void ps2_wait(void) +{ + /* wait for the keyboard */ + while(1) + if ((inb(0x64) & 2) == 0) break; +} + void ps2_set_leds(uint8_t status) { + ps2_wait(); outb(0x60, 0xED); outb(0x60, status); } static void ps2_handler(struct regs_t regs) { + (void) regs; uint8_t scancode = inb(0x60); /* TODO: handle scancode */ + printf("key %x\n", scancode); } static void ps2_set_scancode_set(uint8_t set) { + ps2_wait(); outb(0x60, 0xF0); outb(0x60, set); } -- cgit v1.1