mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix hosted mode
This commit is contained in:
parent
7ec01905aa
commit
d9a65a51d9
3 changed files with 38 additions and 3 deletions
|
|
@ -11,9 +11,11 @@ use std::{fs::File, io, io::BufRead};
|
|||
|
||||
#[cfg(feature = "hosted-baosec")]
|
||||
use bao1x_emu::trng::Trng;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
use bao1x_hal_service::api::TimeOp;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
use bao1x_hal_service::trng::Trng;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
use chrono::{DateTime, Utc};
|
||||
use keystore::Keystore;
|
||||
use locales::t;
|
||||
|
|
@ -79,6 +81,7 @@ pub struct ActionManager {
|
|||
|
||||
gfx: ux_api::service::gfx::Gfx,
|
||||
// used to set time when QR codes are scanned
|
||||
#[cfg(feature = "board-baosec")]
|
||||
rtc_conn: xous::CID,
|
||||
// used to type passwords
|
||||
usb_dev: usb_bao1x::UsbHid,
|
||||
|
|
@ -94,6 +97,7 @@ impl ActionManager {
|
|||
let storage_manager = storage::Manager::new(&xns);
|
||||
|
||||
let mc = (*mode.lock().unwrap()).clone();
|
||||
#[cfg(feature = "board-baosec")]
|
||||
let rtc_conn =
|
||||
xous::connect(xous::SID::from_bytes(bao1x_hal_service::api::TIME_SERVER_PUBLIC).unwrap())
|
||||
.unwrap();
|
||||
|
|
@ -113,6 +117,7 @@ impl ActionManager {
|
|||
main_conn,
|
||||
keystore: Keystore::new(&xns),
|
||||
gfx: ux_api::service::gfx::Gfx::new(&xns).unwrap(),
|
||||
#[cfg(feature = "board-baosec")]
|
||||
rtc_conn,
|
||||
usb_dev: usb_bao1x::UsbHid::new(),
|
||||
}
|
||||
|
|
@ -1455,8 +1460,9 @@ impl ActionManager {
|
|||
self.storage.borrow_mut().update(&storage::ContentKind::Password, guid, pw).unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn set_time(&self, time_str: &str) {
|
||||
match DateTime::parse_from_rfc3339(time_str) {
|
||||
pub(crate) fn set_time(&self, _time_str: &str) {
|
||||
#[cfg(feature = "board-baosec")]
|
||||
match DateTime::parse_from_rfc3339(_time_str) {
|
||||
Ok(datetime) => {
|
||||
let utc_time = datetime.with_timezone(&Utc);
|
||||
log::info!("Time (UTC): {}", utc_time);
|
||||
|
|
|
|||
|
|
@ -82,4 +82,4 @@ rramtests = []
|
|||
# loaded and run.
|
||||
duart-debug-hal = ["bao1x-hal/debug-print-duart"]
|
||||
|
||||
default = []
|
||||
default = ["with-pddb"]
|
||||
|
|
|
|||
|
|
@ -42,6 +42,35 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
|||
let mut tokens = args.split(' ');
|
||||
if let Some(sub_cmd) = tokens.next() {
|
||||
match sub_cmd {
|
||||
"std1" => {
|
||||
use std::fs::File;
|
||||
const DEFAULT_LIST: &'static str = "bunnie:bunnie@kosagi.com:b@bunnie.org";
|
||||
let path = "vault.config/usernames";
|
||||
// Try to open for reading first
|
||||
let result = if let Ok(mut file) = File::open(path) {
|
||||
let mut content = String::new();
|
||||
file.read_to_string(&mut content).unwrap();
|
||||
content
|
||||
} else {
|
||||
// Create new file and write default content
|
||||
let mut file = File::create(path).unwrap();
|
||||
file.write_all(DEFAULT_LIST.as_bytes()).unwrap();
|
||||
DEFAULT_LIST.to_string()
|
||||
};
|
||||
log::info!("result: {}", result);
|
||||
}
|
||||
"std2" => {
|
||||
use std::fs;
|
||||
let path = "vault.config/usernames";
|
||||
let mut intermediate = fs::read_to_string(path).unwrap();
|
||||
intermediate.push_str(":more@more.com");
|
||||
fs::write(path, intermediate).unwrap();
|
||||
}
|
||||
"std3" => {
|
||||
use std::fs;
|
||||
let path = "vault.config/usernames";
|
||||
log::info!("file: {}", fs::read_to_string(path).unwrap());
|
||||
}
|
||||
"basislist" => {
|
||||
let bases = self.pddb.list_basis();
|
||||
for basis in bases {
|
||||
|
|
|
|||
Loading…
Reference in a new issue