small patch: in case unexpected kbd int

This commit is contained in:
catfood 2023-01-02 17:14:31 +08:00
parent 309485b903
commit a389dcf93a

View File

@ -13,6 +13,7 @@
#include "stdio.h" #include "stdio.h"
#include "assert.h" #include "assert.h"
#include "minix_keymap.h" #include "minix_keymap.h"
#include "serialport.h"
#include "memman.h" #include "memman.h"
static int code_with_E0; static int code_with_E0;
@ -204,6 +205,14 @@ static void kb_wait() /* 等待 8042 的输入缓冲区空 */
} while (kb_stat & 0x02); } while (kb_stat & 0x02);
} }
static void kb_ack()
{
u8 kb_read;
do {
kb_read = inb(KB_DATA);
} while (kb_read != KB_ACK);
}
/** /**
* Set the leds according to: caps_lock, num_lock & scroll_lock. * Set the leds according to: caps_lock, num_lock & scroll_lock.
@ -233,10 +242,11 @@ void init_kb()
scroll_lock = 0; scroll_lock = 0;
set_leds(); set_leds();
init_mouse();
put_irq_handler(KEYBOARD_IRQ, kb_handler); put_irq_handler(KEYBOARD_IRQ, kb_handler);
enable_irq(KEYBOARD_IRQ); enable_irq(KEYBOARD_IRQ);
init_mouse();
} }
static u16 map_key(int code) static u16 map_key(int code)
@ -441,7 +451,7 @@ static void ps2_push(NTTY *tty, u32 key)
{ {
if ((key & MOUSEBTN_CLICK) && (key & MOUSEBTN_M)) if ((key & MOUSEBTN_CLICK) && (key & MOUSEBTN_M))
{ {
kprintf("middle btn click %x\n", key); // kprintf("middle btn click %x\n", key);
vga_tty_scroll(tty, 3); vga_tty_scroll(tty, 3);
} }
} }