diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/kbd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/kernel/kbd.c b/src/kernel/kbd.c index 29c0350..f7158bb 100644 --- a/src/kernel/kbd.c +++ b/src/kernel/kbd.c @@ -78,11 +78,15 @@ void init_kbd() { drives->free_file(drives, stf); } +static uint8_t last_code_byte = 0; static inline uint8_t get_next_code_byte() { - for (uint32_t spin = 0; spin < 10000000; ++spin) - ; - return inb(PS2_DATA); + uint8_t cb; + do + cb = inb(PS2_DATA); + while (cb == last_code_byte); + last_code_byte = cb; + return cb; } static enum key_modifiers_t keymods = 0; @@ -90,6 +94,7 @@ static enum key_modifiers_t keymods = 0; void on_kbd_isr() { //logf(LOG_INFO, "on_kbd_isr()"); while (inb(PS2_CMD) & PS2S_CODE_READY) { + last_code_byte = 0; uint8_t code[256]; uint8_t code_i = 0; sub_table: |