diff options
author | Marvin Borner | 2020-08-16 20:15:55 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-16 20:15:55 +0200 |
commit | d261bcea8955358ebe8e0c7e7a04a6ac883d85bd (patch) | |
tree | 7f37a96ac9d5b7cb92933cc807c52613161cd6cc /kernel | |
parent | 0dd3f5e6f4f7607611ce23510858ab3597b5df9f (diff) |
Added scancode list and resolver
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/drivers/keyboard.c | 11 | ||||
-rw-r--r-- | kernel/features/event.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index 6405018..1cf103a 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -4,18 +4,19 @@ #include <def.h> #include <event.h> #include <interrupts.h> +#include <print.h> char keymap[128]; void keyboard_handler() { - u8 scan_code = inb(0x60); + u32 scancode = (u32)inb(0x60); - if (scan_code > 128) - return; + // TODO: Support multi-byte scancodes + /* printf("%x %x %x %x\n", scancode, inb(0x60), inb(0x60), inb(0x60)); */ - if ((scan_code & 0x80) == 0) { // PRESS - event_trigger(EVENT_KEYBOARD, NULL); + if ((scancode & 0x80) == 0) { // PRESS + event_trigger(EVENT_KEYBOARD, (u32 *)scancode); } } diff --git a/kernel/features/event.c b/kernel/features/event.c index e91dcab..e6639e6 100644 --- a/kernel/features/event.c +++ b/kernel/features/event.c @@ -8,7 +8,7 @@ u32 (*event_table[])() = { [EVENT_KEYBOARD] = NULL, [EVENT_MOUSE] = NULL }; u32 event_map(enum event id, u32 (*function)()) { - printf("%x to %x\n", id, function); + // TODO: Support multiple events of same type if (id >= sizeof(event_table) / sizeof(*event_table)) return -1; |