Translate keycodes for keys 0-9

This commit is contained in:
Philipp Oppermann
2019-01-25 14:22:25 +01:00
parent 25796110f3
commit 895991fee3

View File

@@ -60,6 +60,23 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: &mut Exceptio
let port = Port::new(0x60);
let scancode: u8 = unsafe { port.read() };
print!("{}", scancode);
// new
let key = match scancode {
0x02 => Some('1'),
0x03 => Some('2'),
0x04 => Some('3'),
0x05 => Some('4'),
0x06 => Some('5'),
0x07 => Some('6'),
0x08 => Some('7'),
0x09 => Some('8'),
0x0a => Some('9'),
0x0b => Some('0'),
_ => None,
};
if let Some(key) = key {
print!("{}", key);
}
unsafe { PICS.lock().notify_end_of_interrupt(KEYBOARD_INTERRUPT_ID) }
}