mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
patch to fix backspace on console injection
This commit is contained in:
parent
aab1625ba3
commit
4c05ee2fe6
1 changed files with 35 additions and 3 deletions
|
|
@ -861,6 +861,7 @@ fn xmain() -> ! {
|
||||||
log::warn!("kbd server is overriding WFI for debugging, remember to disable for production");
|
log::warn!("kbd server is overriding WFI for debugging, remember to disable for production");
|
||||||
llio.wfi_override(true).unwrap();
|
llio.wfi_override(true).unwrap();
|
||||||
}*/
|
}*/
|
||||||
|
let mut inject_esc = false;
|
||||||
|
|
||||||
log::trace!("starting main loop");
|
log::trace!("starting main loop");
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -900,15 +901,46 @@ fn xmain() -> ! {
|
||||||
Some(Opcode::SetChordInterval) => msg_scalar_unpack!(msg, delay, _, _, _, {
|
Some(Opcode::SetChordInterval) => msg_scalar_unpack!(msg, delay, _, _, _, {
|
||||||
kbd.set_chord_interval(delay as u32);
|
kbd.set_chord_interval(delay as u32);
|
||||||
}),
|
}),
|
||||||
Some(Opcode::InjectKey) => msg_scalar_unpack!(msg, _k, _, _, _, {
|
Some(Opcode::InjectKey) => msg_scalar_unpack!(msg, k, _, _, _, {
|
||||||
let key = if let Some(a) = core::char::from_u32(_k as u32) {
|
// key substitutions to help things work better
|
||||||
|
// 5b31 = home
|
||||||
|
// 5b44 = left
|
||||||
|
// 5b43 = right
|
||||||
|
// 5b41 = up
|
||||||
|
// 5b42 = down
|
||||||
|
let k_prime = if !inject_esc {
|
||||||
|
match k {
|
||||||
|
0x7f => 0x08,
|
||||||
|
0x5b => {
|
||||||
|
inject_esc = true;
|
||||||
|
0x00
|
||||||
|
}
|
||||||
|
_ => k as u32
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inject_esc = false;
|
||||||
|
match k {
|
||||||
|
0x31 => '∴' as u32,
|
||||||
|
0x44 => '←' as u32,
|
||||||
|
0x43 => '→' as u32,
|
||||||
|
0x41 => '↑' as u32,
|
||||||
|
0x42 => '↓' as u32,
|
||||||
|
_ => {
|
||||||
|
log::warn!("unknown escape sequence, ignoring: 0x5b{:x}", k);
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let key = if let Some(a) = core::char::from_u32(k_prime) {
|
||||||
a
|
a
|
||||||
} else {
|
} else {
|
||||||
|
log::warn!("Uninterpreable key sequence, ignoring: 0x{:x}", k);
|
||||||
'\u{0000}'
|
'\u{0000}'
|
||||||
};
|
};
|
||||||
log::trace!("got inject key, listener_conn: {:?}", listener_conn);
|
log::trace!("got inject key, listener_conn: {:?}", listener_conn);
|
||||||
if let Some(conn) = listener_conn {
|
if let Some(conn) = listener_conn {
|
||||||
info!("injecting key '{}'", key); // always be noisy about this, it's an exploit path
|
info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path
|
||||||
xous::send_message(conn,
|
xous::send_message(conn,
|
||||||
xous::Message::new_scalar(listener_op.unwrap(),
|
xous::Message::new_scalar(listener_op.unwrap(),
|
||||||
key as u32 as usize,
|
key as u32 as usize,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue