diff --git a/kaleid/kernel/io/keyb.c b/kaleid/kernel/io/keyb.c index e676302..c0c5f50 100644 --- a/kaleid/kernel/io/keyb.c +++ b/kaleid/kernel/io/keyb.c @@ -26,9 +26,30 @@ #include extern void KeybIsr(void); - +extern void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags); void KeybSetup(void) { - CpuRegisterIrq(KeybIsr, 0x21, 0x8E); + IdtRegisterIrq(KeybIsr, 0x21, 0x8E); } + + +uchar KeybHandler(void) +{ + uchar status; + uchar code; + + // write EOI + outb(0x20, 0x20); + + status = IoReadByteFromPort(KeybStatusPort); + + if (status & 0x01) { + code = IoReadByteFromPort(KeybDataPort); + + if(code < 0) return 0; + + return code; + } +} +