mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add a "rawserial" feature to the UART injection path
This commit is contained in:
parent
62913a6560
commit
0d1244dc32
2 changed files with 14 additions and 2 deletions
|
|
@ -27,5 +27,6 @@ utralib = {path = "../../utralib"}
|
||||||
[features]
|
[features]
|
||||||
debugprint = []
|
debugprint = []
|
||||||
debuginject = [] # used only if you want key injection via the UART
|
debuginject = [] # used only if you want key injection via the UART
|
||||||
|
rawserial = []
|
||||||
braille = []
|
braille = []
|
||||||
default = ["debuginject"] # "debugprint"
|
default = ["debuginject", "rawserial"] # "debugprint"
|
||||||
|
|
|
||||||
|
|
@ -840,6 +840,16 @@ fn main() -> ! {
|
||||||
log::trace!("{:x} {}", k, kbd.debug);
|
log::trace!("{:x} {}", k, kbd.debug);
|
||||||
kbd.debug = 0;
|
kbd.debug = 0;
|
||||||
|
|
||||||
|
#[cfg(feature="rawserial")]
|
||||||
|
{
|
||||||
|
for listener in blocking_listener.drain(..) {
|
||||||
|
// we must unblock anyways once the key is hit; even if the key is invalid,
|
||||||
|
// send the invalid key. The receiving library function will clean this up into a nil-response vector.
|
||||||
|
xous::return_scalar2(listener, k, 0).unwrap();
|
||||||
|
}
|
||||||
|
continue; // do not execute the remaining code in this branch
|
||||||
|
}
|
||||||
|
|
||||||
let key = match esc_index {
|
let key = match esc_index {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
esc_chars[i] = (k & 0xff) as u8;
|
esc_chars[i] = (k & 0xff) as u8;
|
||||||
|
|
@ -886,7 +896,7 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#cfg[feature="debuginject"]
|
#[cfg(feature="debuginject")]
|
||||||
if let Some(conn) = listener_conn {
|
if let Some(conn) = listener_conn {
|
||||||
if key != '\u{0000}' {
|
if key != '\u{0000}' {
|
||||||
log::info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path
|
log::info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path
|
||||||
|
|
@ -900,6 +910,7 @@ fn main() -> ! {
|
||||||
).unwrap();
|
).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature="debuginject")]
|
||||||
for listener in blocking_listener.drain(..) {
|
for listener in blocking_listener.drain(..) {
|
||||||
// we must unblock anyways once the key is hit; even if the key is invalid,
|
// we must unblock anyways once the key is hit; even if the key is invalid,
|
||||||
// send the invalid key. The receiving library function will clean this up into a nil-response vector.
|
// send the invalid key. The receiving library function will clean this up into a nil-response vector.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue