ps2: add more keys
This commit is contained in:
parent
b836cf7fc7
commit
250d70a958
@ -134,15 +134,15 @@ table! {
|
|||||||
pub static CODE_SET_1_E0: [Key; 128; Key::Unknown] = [
|
pub static CODE_SET_1_E0: [Key; 128; Key::Unknown] = [
|
||||||
0x1D => Key::RControl,
|
0x1D => Key::RControl,
|
||||||
0x38 => Key::RAlt,
|
0x38 => Key::RAlt,
|
||||||
// 0x47 => Key::Home,
|
0x47 => Key::Home,
|
||||||
// 0x48 => Key::Up,
|
0x48 => Key::Up,
|
||||||
// 0x49 => Key::PageUp,
|
0x49 => Key::PageUp,
|
||||||
// 0x4B => Key::Left,
|
0x4B => Key::Left,
|
||||||
// 0x4D => Key::Right,
|
0x4D => Key::Right,
|
||||||
// 0x4F => Key::End,
|
0x4F => Key::End,
|
||||||
// 0x50 => Key::Down,
|
0x50 => Key::Down,
|
||||||
// 0x51 => Key::PageDown,
|
0x51 => Key::PageDown,
|
||||||
// 0x52 => Key::Insert,
|
0x52 => Key::Insert,
|
||||||
// 0x53 => Key::Delete,
|
0x53 => Key::Delete,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ impl InterruptHandler for PS2Controller {
|
|||||||
fn handle_irq(self: Arc<Self>, _vector: IrqVector) -> bool {
|
fn handle_irq(self: Arc<Self>, _vector: IrqVector) -> bool {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
let mut inner = self.inner.lock();
|
let mut inner = self.inner.lock();
|
||||||
|
let mut e0 = false;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let Some(mut scancode) = inner.try_recv() else {
|
let Some(mut scancode) = inner.try_recv() else {
|
||||||
@ -87,7 +88,10 @@ impl InterruptHandler for PS2Controller {
|
|||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
||||||
let e0 = scancode == 0xE0;
|
if scancode == 0xE0 {
|
||||||
|
e0 = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let release = scancode >= 0x80;
|
let release = scancode >= 0x80;
|
||||||
|
|
||||||
if release {
|
if release {
|
||||||
@ -101,6 +105,8 @@ impl InterruptHandler for PS2Controller {
|
|||||||
KeyboardKeyEvent::Pressed(key)
|
KeyboardKeyEvent::Pressed(key)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
e0 = false;
|
||||||
|
|
||||||
ygg_driver_input::send_event(event);
|
ygg_driver_input::send_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,22 @@ pub enum KeyboardKey {
|
|||||||
RShift,
|
RShift,
|
||||||
LControl,
|
LControl,
|
||||||
RControl,
|
RControl,
|
||||||
|
PageUp,
|
||||||
|
PageDown,
|
||||||
LAlt,
|
LAlt,
|
||||||
RAlt,
|
RAlt,
|
||||||
CapsLock,
|
CapsLock,
|
||||||
Escape,
|
Escape,
|
||||||
Backspace,
|
Backspace,
|
||||||
Tab,
|
Tab,
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Home,
|
||||||
|
End,
|
||||||
|
Insert,
|
||||||
|
Delete,
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +64,16 @@ impl KeyboardKey {
|
|||||||
// 0x98: Escape
|
// 0x98: Escape
|
||||||
// 0x99: Backspace
|
// 0x99: Backspace
|
||||||
// 0x9A: Tab
|
// 0x9A: Tab
|
||||||
|
// 0xA0: PageUp
|
||||||
|
// 0xA1: PageDown
|
||||||
|
// 0xA2: Up
|
||||||
|
// 0xA3: Down
|
||||||
|
// 0xA4: Left
|
||||||
|
// 0xA5: Right
|
||||||
|
// 0xA6: Home
|
||||||
|
// 0xA7: End
|
||||||
|
// 0xA8: Insert
|
||||||
|
// 0xA9: Delete
|
||||||
// 0xFF: Unknown
|
// 0xFF: Unknown
|
||||||
KeyboardKeyCode(match self {
|
KeyboardKeyCode(match self {
|
||||||
Self::Char(b) => b as u16,
|
Self::Char(b) => b as u16,
|
||||||
@ -69,6 +89,16 @@ impl KeyboardKey {
|
|||||||
Self::Escape => 0x98,
|
Self::Escape => 0x98,
|
||||||
Self::Backspace => 0x99,
|
Self::Backspace => 0x99,
|
||||||
Self::Tab => 0x9A,
|
Self::Tab => 0x9A,
|
||||||
|
Self::PageUp => 0xA0,
|
||||||
|
Self::PageDown => 0xA1,
|
||||||
|
Self::Up => 0xA2,
|
||||||
|
Self::Down => 0xA3,
|
||||||
|
Self::Left => 0xA4,
|
||||||
|
Self::Right => 0xA5,
|
||||||
|
Self::Home => 0xA6,
|
||||||
|
Self::End => 0xA7,
|
||||||
|
Self::Insert => 0xA8,
|
||||||
|
Self::Delete => 0xA9,
|
||||||
Self::Unknown => 0xFF,
|
Self::Unknown => 0xFF,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -93,6 +123,16 @@ impl KeyboardKey {
|
|||||||
0x98 => Self::Escape,
|
0x98 => Self::Escape,
|
||||||
0x99 => Self::Backspace,
|
0x99 => Self::Backspace,
|
||||||
0x9A => Self::Tab,
|
0x9A => Self::Tab,
|
||||||
|
0xA0 => Self::PageUp,
|
||||||
|
0xA1 => Self::PageDown,
|
||||||
|
0xA2 => Self::Up,
|
||||||
|
0xA3 => Self::Down,
|
||||||
|
0xA4 => Self::Left,
|
||||||
|
0xA5 => Self::Right,
|
||||||
|
0xA6 => Self::Home,
|
||||||
|
0xA7 => Self::End,
|
||||||
|
0xA8 => Self::Insert,
|
||||||
|
0xA9 => Self::Delete,
|
||||||
_ => Self::Unknown,
|
_ => Self::Unknown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user