aboutsummaryrefslogtreecommitdiff
path: root/drivers/ps2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ps2.c')
-rw-r--r--drivers/ps2.c11
1 files changed, 11 insertions, 0 deletions
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);
}