Fixed kbd (buffer flush)
This commit is contained in:
@@ -176,9 +176,6 @@ void keyboard_handler()
|
||||
key_status &= ~ALT_PRESSED_BIT;
|
||||
break;
|
||||
}
|
||||
|
||||
// Send EOI
|
||||
outb(0x20, 0x20);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -200,20 +197,21 @@ void keyboard_handler()
|
||||
|
||||
default:
|
||||
{
|
||||
// Should we get a SHIFTED char or a regular one?
|
||||
unsigned char c = (key_status & SHIFT_PRESSED_BIT) ? keymap_shifted[scancode] : keymap[scancode];
|
||||
|
||||
if (c)
|
||||
// Avoiding buffer overflow from extended keys lol
|
||||
if (scancode < 128)
|
||||
{
|
||||
// Should probably have a keyboard buffer here... instead of this
|
||||
_putchar(c);
|
||||
// Should we get a SHIFTED char or a regular one?
|
||||
unsigned char c = (key_status & SHIFT_PRESSED_BIT) ? keymap_shifted[scancode] : keymap[scancode];
|
||||
|
||||
if (c)
|
||||
{
|
||||
// Should probably have a keyboard buffer here... instead of this
|
||||
_putchar(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End of Interrupt (to master PIC)
|
||||
outb(0x20, 0x20);
|
||||
}
|
||||
|
||||
void keyboard_init(unsigned char layout)
|
||||
@@ -233,10 +231,16 @@ void keyboard_init(unsigned char layout)
|
||||
break;
|
||||
|
||||
default:
|
||||
skputs("Unsupported layout.");
|
||||
panic(NULL, "Unsupported keyboard layout");
|
||||
return;
|
||||
}
|
||||
|
||||
// Flush keyboard buffer
|
||||
while (inb(0x64) & 1)
|
||||
{
|
||||
inb(0x60);
|
||||
}
|
||||
|
||||
// Unmask IRQ1
|
||||
uint8_t mask = inb(0x21);
|
||||
mask &= ~(1 << 1);
|
||||
|
||||
Reference in New Issue
Block a user