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);
|
||||
|
||||
@@ -54,6 +54,7 @@ static int is_transmit_empty()
|
||||
// Serial kernel putchar
|
||||
void skputc(char c)
|
||||
{
|
||||
// TODO: Spinlock here (serial access)
|
||||
while (!is_transmit_empty()); // wait for free spot
|
||||
outb(PORT, c);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ extern struct flanterm_context* ft_ctx;
|
||||
// Overhead that could be avoided, right? (for printf)
|
||||
void _putchar(char character)
|
||||
{
|
||||
// TODO: Spinlock here (terminal access)
|
||||
flanterm_write(ft_ctx, &character, 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user