mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add pddb shell debug commands
This commit is contained in:
parent
489a26dd11
commit
6e5506a23d
3 changed files with 48 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ root-keys = {path="../root-keys"}
|
|||
jtag = {path="../jtag"}
|
||||
net = {path="../net"}
|
||||
dns = {path="../dns"}
|
||||
pddb = {path="../pddb"}
|
||||
|
||||
trng = {path = "../trng"}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ mod keys; use keys::*;
|
|||
mod wlan; use wlan::*;
|
||||
mod jtag_cmd; use jtag_cmd::*;
|
||||
mod net_cmd; use net_cmd::*;
|
||||
mod pddb_cmd; use pddb_cmd::*;
|
||||
|
||||
//mod fcc; use fcc::*;
|
||||
//mod pds; // dependency of the FCC file
|
||||
|
|
@ -125,6 +126,7 @@ pub struct CmdEnv {
|
|||
keys_cmd: Keys,
|
||||
jtag_cmd: JtagCmd,
|
||||
net_cmd: NetCmd,
|
||||
pddb_cmd: PddbCmd,
|
||||
|
||||
//fcc_cmd: Fcc,
|
||||
}
|
||||
|
|
@ -178,6 +180,7 @@ impl CmdEnv {
|
|||
keys_cmd: Keys::new(&xns),
|
||||
jtag_cmd: JtagCmd::new(&xns),
|
||||
net_cmd: NetCmd::new(&xns),
|
||||
pddb_cmd: PddbCmd::new(&xns),
|
||||
|
||||
//fcc_cmd: fcc,
|
||||
}
|
||||
|
|
@ -217,6 +220,7 @@ impl CmdEnv {
|
|||
&mut wlan_cmd,
|
||||
&mut self.jtag_cmd,
|
||||
&mut self.net_cmd,
|
||||
&mut self.pddb_cmd,
|
||||
|
||||
//&mut self.fcc_cmd,
|
||||
];
|
||||
|
|
|
|||
43
services/shellchat/src/cmds/pddb_cmd.rs
Normal file
43
services/shellchat/src/cmds/pddb_cmd.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
use crate::{ShellCmdApi, CommonEnv};
|
||||
use xous_ipc::String;
|
||||
|
||||
pub struct PddbCmd {
|
||||
manager: pddb::PddbBasisManager,
|
||||
}
|
||||
impl PddbCmd {
|
||||
pub fn new(xns: &xous_names::XousNames) -> PddbCmd {
|
||||
PddbCmd {
|
||||
manager: pddb::PddbBasisManager::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||
cmd_api!(pddb); // inserts boilerplate for command API
|
||||
|
||||
fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
|
||||
use core::fmt::Write;
|
||||
let mut ret = String::<1024>::new();
|
||||
let helpstring = "pddb [basislist]";
|
||||
|
||||
let mut tokens = args.as_str().unwrap().split(' ');
|
||||
|
||||
if let Some(sub_cmd) = tokens.next() {
|
||||
match sub_cmd {
|
||||
"basislist" => {
|
||||
let bases = self.manager.list_basis();
|
||||
for basis in bases {
|
||||
write!(ret, "{}\n", basis).unwrap();
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
write!(ret, "{}", helpstring).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
write!(ret, "{}", helpstring).unwrap();
|
||||
}
|
||||
Ok(Some(ret))
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue