diff options
author | Marvin Borner | 2020-08-16 21:51:51 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-16 21:51:51 +0200 |
commit | 4ff8a6f6d65bb7867854daada597bfe5ca47ec3f (patch) | |
tree | 85688b74bfb9c1842953f32eb1d721c73154368b /kernel/drivers | |
parent | d261bcea8955358ebe8e0c7e7a04a6ac883d85bd (diff) |
Added support for two-byte scancodes
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/keyboard.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index 1cf103a..b08278d 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -8,16 +8,31 @@ char keymap[128]; +int state = 0; +int merged = 0; void keyboard_handler() { u32 scancode = (u32)inb(0x60); - // TODO: Support multi-byte scancodes - /* printf("%x %x %x %x\n", scancode, inb(0x60), inb(0x60), inb(0x60)); */ + // TODO: Support more than two-byte scancodes + if (scancode == 0xe0) { + merged = 0xe0; + state = 1; + return; + } else { + merged = scancode << 8 | merged; + } + + // TODO: "Merge" scancode to linux keycode? + printf("%x %x = %x\n", scancode, state ? 0xe0 : 0, merged); if ((scancode & 0x80) == 0) { // PRESS event_trigger(EVENT_KEYBOARD, (u32 *)scancode); - } + } else + print("\n"); + + state = 0; + merged = 0; } void keyboard_acknowledge() |