diff options
author | Marvin Borner | 2020-08-26 01:12:36 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-26 01:12:36 +0200 |
commit | 1e1889b89a59ef090851d779941049f7f96c45bc (patch) | |
tree | 7bd8fd1069225f5a1d490fba88ec0fdc189638f0 /kernel/drivers | |
parent | 2b26af8325b9492948cb7fe516638537e4e58337 (diff) |
Some cursor things
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/keyboard.c | 3 | ||||
-rw-r--r-- | kernel/drivers/mouse.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index 14445d4..854ab3b 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -29,6 +29,8 @@ void keyboard_handler() // TODO: "Merge" scancode to linux keycode? /* printf("%x %x = %x\n", scancode, state ? 0xe0 : 0, merged); */ + free(event); + event = malloc(sizeof(*event)); event->magic = KEYBOARD_MAGIC; event->press = (scancode & 0x80) == 0; event->scancode = event->press ? scancode : scancode & ~0x80; @@ -54,7 +56,6 @@ void keyboard_rate() void keyboard_install() { //keyboard_rate(); TODO: Fix keyboard rate? - event = malloc(sizeof(*event)); irq_install_handler(1, keyboard_handler); } diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c index 64204c3..a5f5d0c 100644 --- a/kernel/drivers/mouse.c +++ b/kernel/drivers/mouse.c @@ -1,5 +1,6 @@ // MIT License, Copyright (c) 2020 Marvin Borner +#include <boot.h> #include <cpu.h> #include <event.h> #include <interrupts.h> @@ -29,6 +30,8 @@ void mouse_handler() case 2: mouse_byte[2] = inb(0x60); + free(event); + event = malloc(sizeof(*event)); event->magic = MOUSE_MAGIC; event->diff_x = mouse_byte[1]; event->diff_y = mouse_byte[2]; @@ -76,8 +79,6 @@ char mouse_read() void mouse_install() { - event = malloc(sizeof(*event)); - u8 status; // Enable auxiliary mouse device |