aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/keyboard.c
diff options
context:
space:
mode:
authorMarvin Borner2020-11-14 22:27:59 +0100
committerMarvin Borner2020-11-14 22:27:59 +0100
commit0621c44e439bedf034399e1bff139ef506039eba (patch)
tree68e69323391e5c4725fa6ef2d16e17e6664011b4 /kernel/drivers/keyboard.c
parent1af60d64fb97cfadab39b9d3e86248473cac0693 (diff)
Some fixes
I WAS BUG-SEARCHING FOR SEVERAL HOURS WHYYYY, WHEEERE, AAAAAH
Diffstat (limited to 'kernel/drivers/keyboard.c')
-rw-r--r--kernel/drivers/keyboard.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c
index 67e0a72..ac97d36 100644
--- a/kernel/drivers/keyboard.c
+++ b/kernel/drivers/keyboard.c
@@ -8,11 +8,10 @@
#include <print.h>
#include <sys.h>
-char keymap[128];
-struct event_keyboard *event;
+static struct event_keyboard *event = NULL;
-int state = 0;
-int merged = 0;
+static int state = 0;
+static int merged = 0;
void keyboard_handler()
{
int scancode = inb(0x60);
@@ -29,7 +28,8 @@ void keyboard_handler()
// TODO: "Merge" scancode to linux keycode?
/* printf("%x %x = %x\n", scancode, state ? 0xe0 : 0, merged); */
- free(event);
+ if (event)
+ free(event);
event = malloc(sizeof(*event));
event->magic = KEYBOARD_MAGIC;
event->press = (scancode & 0x80) == 0;
@@ -58,33 +58,3 @@ void keyboard_install(void)
//keyboard_rate(); TODO: Fix keyboard rate?
irq_install_handler(1, keyboard_handler);
}
-
-char keymap[128] = {
- 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
- '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
- '\n', 17, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
- 14, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 14, '*',
- 0, // Alt key
- ' ', // Space bar
- 15, // Caps lock
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F keys
- 0, // Num lock
- 0, // Scroll lock
- 0, // Home key
- 0, // Up arrow
- 0, // Page up
- '-',
- 0, // Left arrow
- 0,
- 0, // Right arrow
- '+',
- 0, // End key
- 0, // Down arrow
- 0, // Page down
- 0, // Insert key
- 0, // Delete key
- 0, 0, 0,
- 0, // F11
- 0, // F12
- 0, // Other keys
-};