From d261bcea8955358ebe8e0c7e7a04a6ac883d85bd Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 16 Aug 2020 20:15:55 +0200 Subject: Added scancode list and resolver --- kernel/drivers/keyboard.c | 11 ++++++----- kernel/features/event.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'kernel') 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 #include #include +#include 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; -- cgit v1.2.3