Fix input blocked when keyboard input is fast

master
Jiajie Chen 6 years ago
parent 9dd576d6a1
commit 543fb971ed

@ -18,9 +18,12 @@ pub fn receive() -> Option<char> {
}
let mut keyboard = KEYBOARD.lock();
let port = Port::<u8>::new(0x60);
let data_port = Port::<u8>::new(0x60);
let status_port = Port::<u8>::new(0x64);
let scancode = unsafe { port.read() };
// Output buffer status = 1
if unsafe { status_port.read() } & (1 << 0) != 0 {
let scancode = unsafe { data_port.read() };
if let Ok(Some(key_event)) = keyboard.add_byte(scancode) {
if let Some(key) = keyboard.process_keyevent(key_event) {
match key {
@ -29,5 +32,6 @@ pub fn receive() -> Option<char> {
}
}
}
}
None
}
Loading…
Cancel
Save