mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
undo handlers for an aborted experiment
This commit is contained in:
parent
12f6192dae
commit
bdfeb9917a
1 changed files with 9 additions and 17 deletions
|
|
@ -36,10 +36,6 @@ impl<'a> ShellCmdApi<'a> for Usb {
|
||||||
self.usb_dev.ensure_core(usb_device_xous::UsbDeviceType::FidoKbd).unwrap();
|
self.usb_dev.ensure_core(usb_device_xous::UsbDeviceType::FidoKbd).unwrap();
|
||||||
write!(ret, "USB connected to HID (FIDO + keyboard) core").unwrap();
|
write!(ret, "USB connected to HID (FIDO + keyboard) core").unwrap();
|
||||||
}
|
}
|
||||||
"kbd" => {
|
|
||||||
self.usb_dev.ensure_core(usb_device_xous::UsbDeviceType::KbdOnly).unwrap();
|
|
||||||
write!(ret, "USB connected to keyboard only core").unwrap();
|
|
||||||
}
|
|
||||||
#[cfg(feature = "mass-storage")]
|
#[cfg(feature = "mass-storage")]
|
||||||
"ms" => {
|
"ms" => {
|
||||||
self.usb_dev.ensure_core(usb_device_xous::UsbDeviceType::MassStorage).unwrap();
|
self.usb_dev.ensure_core(usb_device_xous::UsbDeviceType::MassStorage).unwrap();
|
||||||
|
|
@ -91,7 +87,7 @@ impl<'a> ShellCmdApi<'a> for Usb {
|
||||||
write!(ret, "USB TRNG serial sending should be stopped.").ok();
|
write!(ret, "USB TRNG serial sending should be stopped.").ok();
|
||||||
}
|
}
|
||||||
"send" => match self.usb_dev.get_current_core() {
|
"send" => match self.usb_dev.get_current_core() {
|
||||||
Ok(UsbDeviceType::FidoKbd) | Ok(UsbDeviceType::Serial) | Ok(UsbDeviceType::KbdOnly) => {
|
Ok(UsbDeviceType::FidoKbd) | Ok(UsbDeviceType::Serial) => {
|
||||||
let mut val = String::new();
|
let mut val = String::new();
|
||||||
join_tokens(&mut val, &mut tokens);
|
join_tokens(&mut val, &mut tokens);
|
||||||
match self.usb_dev.send_str(&val) {
|
match self.usb_dev.send_str(&val) {
|
||||||
|
|
@ -114,12 +110,10 @@ impl<'a> ShellCmdApi<'a> for Usb {
|
||||||
}
|
}
|
||||||
test_str.push('\n');
|
test_str.push('\n');
|
||||||
match self.usb_dev.get_current_core() {
|
match self.usb_dev.get_current_core() {
|
||||||
Ok(UsbDeviceType::FidoKbd) | Ok(UsbDeviceType::KbdOnly) => {
|
Ok(UsbDeviceType::FidoKbd) => match self.usb_dev.send_str(&test_str) {
|
||||||
match self.usb_dev.send_str(&test_str) {
|
Ok(n) => write!(ret, "Sent {} test string", n).unwrap(),
|
||||||
Ok(n) => write!(ret, "Sent {} test string", n).unwrap(),
|
Err(_e) => write!(ret, "Can't send: are we connected to a host?").unwrap(),
|
||||||
Err(_e) => write!(ret, "Can't send: are we connected to a host?").unwrap(),
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(UsbDeviceType::Debug) => {
|
Ok(UsbDeviceType::Debug) => {
|
||||||
write!(ret, "HID core not connected: please issue 'usb hid' first").unwrap();
|
write!(ret, "HID core not connected: please issue 'usb hid' first").unwrap();
|
||||||
}
|
}
|
||||||
|
|
@ -138,12 +132,10 @@ impl<'a> ShellCmdApi<'a> for Usb {
|
||||||
_ => write!(ret, "Invalid response checking status").unwrap(),
|
_ => write!(ret, "Invalid response checking status").unwrap(),
|
||||||
},
|
},
|
||||||
"leds" => match self.usb_dev.get_current_core() {
|
"leds" => match self.usb_dev.get_current_core() {
|
||||||
Ok(UsbDeviceType::FidoKbd) | Ok(UsbDeviceType::KbdOnly) => {
|
Ok(UsbDeviceType::FidoKbd) => match self.usb_dev.get_led_state() {
|
||||||
match self.usb_dev.get_led_state() {
|
Ok(leds) => write!(ret, "LEDs: {:?}", leds).unwrap(),
|
||||||
Ok(leds) => write!(ret, "LEDs: {:?}", leds).unwrap(),
|
_ => write!(ret, "Not connected to USB host or other error").unwrap(),
|
||||||
_ => write!(ret, "Not connected to USB host or other error").unwrap(),
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(UsbDeviceType::Debug) => {
|
Ok(UsbDeviceType::Debug) => {
|
||||||
write!(ret, "HID core not connected: please issue 'usb hid' first").unwrap();
|
write!(ret, "HID core not connected: please issue 'usb hid' first").unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue