xous-core/services/shellchat/src/cmds/test.rs
bunnie a4f8346c34 reflect the latest fixes to the secure boot process
also patch up some issues with sha512 reset and loose
ends on docs and updates
2021-07-13 00:46:31 +08:00

48 lines
1.2 KiB
Rust

use crate::{ShellCmdApi,CommonEnv};
use xous_ipc::String;
#[derive(Debug)]
pub struct Test {
state: u32
}
impl Test {
pub fn new() -> Self {
Test {
state: 0
}
}
}
impl<'a> ShellCmdApi<'a> for Test {
cmd_api!(test);
fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
use core::fmt::Write;
self.state += 1;
let mut ret = String::<1024>::new();
write!(ret, "Test has run {} times.\n", self.state).unwrap();
let mut tokens = args.as_str().unwrap().split(' ');
if let Some(sub_cmd) = tokens.next() {
match sub_cmd {
"devboot" => {
env.gam.set_devboot(true).unwrap();
write!(ret, "devboot on").unwrap();
}
"devbootoff" => {
// this should do nothing if devboot was already set
env.gam.set_devboot(false).unwrap();
write!(ret, "devboot off").unwrap();
}
_ => {
() // do nothing
}
}
}
Ok(Some(ret))
}
}