aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/input/ps2/keyboard.c
diff options
context:
space:
mode:
authorMarvin Borner2019-12-08 12:27:00 +0100
committerMarvin Borner2019-12-08 12:27:00 +0100
commite3c982ee44cff38bd764fbb6ab94972cf868a10a (patch)
tree755ed2716a4a3fb6caf04abaef00a784297692fe /src/kernel/input/ps2/keyboard.c
parentd94b024b73aeca06de417e0fd3c502495312a8b2 (diff)
Working text input!
Diffstat (limited to 'src/kernel/input/ps2/keyboard.c')
-rw-r--r--src/kernel/input/ps2/keyboard.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/kernel/input/ps2/keyboard.c b/src/kernel/input/ps2/keyboard.c
index 9e133ef..223a7c5 100644
--- a/src/kernel/input/ps2/keyboard.c
+++ b/src/kernel/input/ps2/keyboard.c
@@ -106,7 +106,8 @@ void keyboard_handler(struct regs *r)
return;
}
- keyboard_buffer[strlen(keyboard_buffer)] = current_keymap[scan_code];
+ keyboard_char_buffer = current_keymap[scan_code];
+ keyboard_buffer[strlen(keyboard_buffer)] = keyboard_char_buffer;
} else { // RELEASE
if (current_keymap[scan_code] == -107) // TODO: IDK WHY -107?!
control_pressed = 0;
@@ -127,15 +128,15 @@ void keyboard_rate()
void keyboard_clear_buffer()
{
- memset(keyboard_buffer, 0, 4096);
+ kfree(keyboard_buffer);
+ keyboard_buffer = (char *) paging_alloc_pages(1); // 4KiB
+ paging_set_user((uint32_t) keyboard_buffer, 1);
}
// Installs the keyboard handler into IRQ1
void keyboard_install()
{
- keyboard_buffer = (char *) paging_alloc_pages(1); // 4KiB
- paging_set_user((uint32_t) keyboard_buffer, 1);
-
+ keyboard_clear_buffer();
keyboard_rate();
irq_install_handler(1, keyboard_handler);
shift_pressed = 0;