aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2020-08-16 21:51:51 +0200
committerMarvin Borner2020-08-16 21:51:51 +0200
commit4ff8a6f6d65bb7867854daada597bfe5ca47ec3f (patch)
tree85688b74bfb9c1842953f32eb1d721c73154368b /kernel/drivers
parentd261bcea8955358ebe8e0c7e7a04a6ac883d85bd (diff)
Added support for two-byte scancodes
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/keyboard.c21
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()