mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
patch up QR code PR, change method signature as discussed
now any modal notification can also render as a QR code
This commit is contained in:
parent
679fde33a7
commit
cd8c762c55
11 changed files with 65 additions and 66 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
|
@ -395,6 +395,12 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "checked_int_cast"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.19"
|
version = "0.4.19"
|
||||||
|
|
@ -1059,6 +1065,7 @@ dependencies = [
|
||||||
"log-server",
|
"log-server",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"qrcode",
|
||||||
"rkyv",
|
"rkyv",
|
||||||
"susres",
|
"susres",
|
||||||
"ticktimer-server",
|
"ticktimer-server",
|
||||||
|
|
@ -1944,6 +1951,15 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "qrcode"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "16d2f1455f3630c6e5107b4f2b94e74d76dea80736de0981fd27644216cff57f"
|
||||||
|
dependencies = [
|
||||||
|
"checked_int_cast",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-error"
|
name = "quick-error"
|
||||||
version = "1.2.3"
|
version = "1.2.3"
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ mod progressbar;
|
||||||
pub use progressbar::*;
|
pub use progressbar::*;
|
||||||
mod consoleinput;
|
mod consoleinput;
|
||||||
pub use consoleinput::*;
|
pub use consoleinput::*;
|
||||||
mod qrcode;
|
|
||||||
pub use self::qrcode::*;
|
|
||||||
|
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
|
|
||||||
|
|
@ -39,7 +37,6 @@ pub enum ActionType {
|
||||||
CheckBoxes,
|
CheckBoxes,
|
||||||
Slider,
|
Slider,
|
||||||
Notification,
|
Notification,
|
||||||
Qrcode,
|
|
||||||
ConsoleInput
|
ConsoleInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,32 +80,18 @@ impl Modals {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// this blocks until the notification has been acknowledged.
|
/// this blocks until the notification has been acknowledged.
|
||||||
pub fn show_notification(&self, notification: &str) -> Result<(), xous::Error> {
|
pub fn show_notification(&self, notification: &str, as_qrcode: bool) -> Result<(), xous::Error> {
|
||||||
self.lock();
|
self.lock();
|
||||||
let spec = ManagedNotification {
|
let spec = ManagedNotification {
|
||||||
token: self.token,
|
token: self.token,
|
||||||
message: xous_ipc::String::from_str(notification),
|
message: xous_ipc::String::from_str(notification),
|
||||||
as_qrcode: false,
|
as_qrcode,
|
||||||
};
|
};
|
||||||
let buf = Buffer::into_buf(spec).or(Err(xous::Error::InternalError))?;
|
let buf = Buffer::into_buf(spec).or(Err(xous::Error::InternalError))?;
|
||||||
buf.lend(self.conn, Opcode::Notification.to_u32().unwrap()).or(Err(xous::Error::InternalError))?;
|
buf.lend(self.conn, Opcode::Notification.to_u32().unwrap()).or(Err(xous::Error::InternalError))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// this blocks until the qrcode has been acknowledged.
|
|
||||||
pub fn show_qrcode(&self, text: &str) -> Result<(), xous::Error> {
|
|
||||||
self.lock();
|
|
||||||
let spec = ManagedNotification {
|
|
||||||
token: self.token,
|
|
||||||
message: xous_ipc::String::from_str(text),
|
|
||||||
as_qrcode: true,
|
|
||||||
};
|
|
||||||
let buf = Buffer::into_buf(spec).or(Err(xous::Error::InternalError))?;
|
|
||||||
buf.lend(self.conn, Opcode::Notification.to_u32().unwrap()).or(Err(xous::Error::InternalError))?;
|
|
||||||
self.unlock();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn start_progress(&self, title: &str, start: u32, end: u32, current: u32) -> Result<(), xous::Error> {
|
pub fn start_progress(&self, title: &str, start: u32, end: u32, current: u32) -> Result<(), xous::Error> {
|
||||||
self.lock();
|
self.lock();
|
||||||
let spec = ManagedProgress {
|
let spec = ManagedProgress {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ pub(crate) fn spawn_test() {
|
||||||
|
|
||||||
// 3. test notificatons
|
// 3. test notificatons
|
||||||
log::info!("testing notification");
|
log::info!("testing notification");
|
||||||
modals.show_notification("This is a test!").expect("notification failed");
|
modals.show_notification("This is a test!", false).expect("notification failed");
|
||||||
log::info!("notification test done");
|
log::info!("notification test done");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -93,12 +93,12 @@ pub(crate) fn spawn_test() {
|
||||||
|
|
||||||
// 3. test notificatons
|
// 3. test notificatons
|
||||||
log::info!("testing notification");
|
log::info!("testing notification");
|
||||||
modals.show_notification("这是一个测验!").expect("notification failed");
|
modals.show_notification("这是一个测验!", false).expect("notification failed");
|
||||||
log::info!("notification test done");
|
log::info!("notification test done");
|
||||||
|
|
||||||
// 4. test qrcode
|
// 4. test qrcode
|
||||||
log::info!("testing qrcode");
|
log::info!("testing qrcode");
|
||||||
modals.show_qrcode("https://github.com/betrusted-io/xous-core").expect("qrcode failed");
|
modals.show_notification("https://github.com/betrusted-io/xous-core", true).expect("qrcode failed");
|
||||||
log::info!("qrcode test done");
|
log::info!("qrcode test done");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
log::warn!("EC firmware is too old to interoperate with the connec tion manager.");
|
log::warn!("EC firmware is too old to interoperate with the connec tion manager.");
|
||||||
let mut note = String::from(t!("net.ec_rev_old", xous::LANG));
|
let mut note = String::from(t!("net.ec_rev_old", xous::LANG));
|
||||||
note.push_str(&format!("\n\n{}{}.{}.{}+{}", t!("net.ec_current_rev", xous::LANG), maj, min, rev, commits));
|
note.push_str(&format!("\n\n{}{}.{}.{}+{}", t!("net.ec_current_rev", xous::LANG), maj, min, rev, commits));
|
||||||
modals.show_notification(¬e).unwrap();
|
modals.show_notification(¬e, false).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let run = Arc::new(AtomicBool::new(rev_ok));
|
let run = Arc::new(AtomicBool::new(rev_ok));
|
||||||
|
|
|
||||||
|
|
@ -523,7 +523,7 @@ impl PddbOs {
|
||||||
self.clear_password(); // clear the bad password entry
|
self.clear_password(); // clear the bad password entry
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
let modals = modals::Modals::new(&xns).expect("can't connect to Modals server");
|
let modals = modals::Modals::new(&xns).expect("can't connect to Modals server");
|
||||||
modals.show_notification(t!("pddb.badpass_infallible", xous::LANG)).expect("notification failed");
|
modals.show_notification(t!("pddb.badpass_infallible", xous::LANG), false).expect("notification failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1367,7 +1367,7 @@ impl PddbOs {
|
||||||
self.rootkeys.decrypt_block(GenericArray::from_mut_slice(&mut checkblock_a));
|
self.rootkeys.decrypt_block(GenericArray::from_mut_slice(&mut checkblock_a));
|
||||||
|
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))] // skip this dialog in hosted mode
|
#[cfg(any(target_os = "none", target_os = "xous"))] // skip this dialog in hosted mode
|
||||||
modals.show_notification(t!("pddb.checkpass", xous::LANG)).expect("notification failed");
|
modals.show_notification(t!("pddb.checkpass", xous::LANG), false).expect("notification failed");
|
||||||
|
|
||||||
self.clear_password();
|
self.clear_password();
|
||||||
let mut checkblock_b = [0u8; BLOCK_SIZE];
|
let mut checkblock_b = [0u8; BLOCK_SIZE];
|
||||||
|
|
@ -1376,7 +1376,7 @@ impl PddbOs {
|
||||||
if checkblock_a == checkblock_b {
|
if checkblock_a == checkblock_b {
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
modals.show_notification(t!("pddb.checkpass_fail", xous::LANG)).expect("notification failed");
|
modals.show_notification(t!("pddb.checkpass_fail", xous::LANG), false).expect("notification failed");
|
||||||
self.clear_password();
|
self.clear_password();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1132,7 +1132,7 @@ fn xmain() -> ! {
|
||||||
for basis in bases.iter() {
|
for basis in bases.iter() {
|
||||||
note.push_str(basis);
|
note.push_str(basis);
|
||||||
}
|
}
|
||||||
modals.show_notification(¬e).expect("couldn't show basis list");
|
modals.show_notification(¬e, false).expect("couldn't show basis list");
|
||||||
},
|
},
|
||||||
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
Some(Opcode::DangerousDebug) => {
|
Some(Opcode::DangerousDebug) => {
|
||||||
|
|
@ -1281,7 +1281,7 @@ fn try_mount_or_format(modals: &modals::Modals, pddb_os: &mut PddbOs, basis_cach
|
||||||
log::error!("Despite formatting, no PDDB was found!");
|
log::error!("Despite formatting, no PDDB was found!");
|
||||||
let mut err = String::from(t!("pddb.internalerror", xous::LANG));
|
let mut err = String::from(t!("pddb.internalerror", xous::LANG));
|
||||||
err.push_str(" #1"); // punt and leave an error code, because this "should" be rare
|
err.push_str(" #1"); // punt and leave an error code, because this "should" be rare
|
||||||
modals.show_notification(err.as_str()).expect("notification failed");
|
modals.show_notification(err.as_str(), false).expect("notification failed");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1306,7 +1306,7 @@ fn try_mount_or_format(modals: &modals::Modals, pddb_os: &mut PddbOs, basis_cach
|
||||||
log::error!("Despite formatting, no PDDB was found!");
|
log::error!("Despite formatting, no PDDB was found!");
|
||||||
let mut err = String::from(t!("pddb.internalerror", xous::LANG));
|
let mut err = String::from(t!("pddb.internalerror", xous::LANG));
|
||||||
err.push_str(" #1"); // punt and leave an error code, because this "should" be rare
|
err.push_str(" #1"); // punt and leave an error code, because this "should" be rare
|
||||||
modals.show_notification(err.as_str()).expect("notification failed");
|
modals.show_notification(err.as_str(), false).expect("notification failed");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ fn xmain() -> ! {
|
||||||
// - pepper
|
// - pepper
|
||||||
|
|
||||||
if keys.is_initialized() {
|
if keys.is_initialized() {
|
||||||
modals.show_notification(t!("rootkeys.already_init", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.already_init", xous::LANG), false).expect("modals error");
|
||||||
#[cfg(feature="tts")]
|
#[cfg(feature="tts")]
|
||||||
tts.tts_blocking(t!("rootkeys.already_init", xous::LANG)).unwrap();
|
tts.tts_blocking(t!("rootkeys.already_init", xous::LANG)).unwrap();
|
||||||
keys.set_ux_password_type(None);
|
keys.set_ux_password_type(None);
|
||||||
|
|
@ -552,16 +552,16 @@ fn xmain() -> ! {
|
||||||
).expect("couldn't initiate dialog box");
|
).expect("couldn't initiate dialog box");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::AlignmentError) => {
|
Err(RootkeyResult::AlignmentError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::KeyError) => {
|
Err(RootkeyResult::KeyError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::IntegrityError) => {
|
Err(RootkeyResult::IntegrityError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::FlashError) => {
|
Err(RootkeyResult::FlashError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -576,7 +576,7 @@ fn xmain() -> ! {
|
||||||
log::info!("Vbus is: {:.3}V", vbus);
|
log::info!("Vbus is: {:.3}V", vbus);
|
||||||
if vbus > 1.5 {
|
if vbus > 1.5 {
|
||||||
// if power is plugged in, request that it be removed
|
// if power is plugged in, request that it be removed
|
||||||
modals.show_notification(t!("rootkeys.init.unplug_power", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.unplug_power", xous::LANG), false).expect("modals error");
|
||||||
log::info!("vbus is high, holding off on reboot");
|
log::info!("vbus is high, holding off on reboot");
|
||||||
send_message(main_cid,
|
send_message(main_cid,
|
||||||
xous::Message::new_scalar(Opcode::UxTryReboot.to_usize().unwrap(), 0, 0, 0, 0)
|
xous::Message::new_scalar(Opcode::UxTryReboot.to_usize().unwrap(), 0, 0, 0, 0)
|
||||||
|
|
@ -629,7 +629,7 @@ fn xmain() -> ! {
|
||||||
SignatureResult::DevKeyOk => t!("rootkeys.gwup.viewinfo_dk", xous::LANG),
|
SignatureResult::DevKeyOk => t!("rootkeys.gwup.viewinfo_dk", xous::LANG),
|
||||||
_ => {
|
_ => {
|
||||||
modals.dynamic_notification_close().expect("modals error");
|
modals.dynamic_notification_close().expect("modals error");
|
||||||
modals.show_notification(t!("rootkeys.gwup.no_update_found", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.gwup.no_update_found", xous::LANG), false).expect("modals error");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -659,18 +659,18 @@ fn xmain() -> ! {
|
||||||
match modals.get_radiobutton(prompt) {
|
match modals.get_radiobutton(prompt) {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
if response == t!("rootkeys.gwup.short", xous::LANG) {
|
if response == t!("rootkeys.gwup.short", xous::LANG) {
|
||||||
modals.show_notification(info.as_str()).expect("modals error");
|
modals.show_notification(info.as_str(), false).expect("modals error");
|
||||||
} else if response == t!("rootkeys.gwup.details", xous::LANG) {
|
} else if response == t!("rootkeys.gwup.details", xous::LANG) {
|
||||||
modals.show_notification(info.as_str()).expect("modals error");
|
modals.show_notification(info.as_str(), false).expect("modals error");
|
||||||
let gw_info = keys.fetch_gw_metadata(GatewareRegion::Staging);
|
let gw_info = keys.fetch_gw_metadata(GatewareRegion::Staging);
|
||||||
// truncate the message to better fit in the rendering box
|
// truncate the message to better fit in the rendering box
|
||||||
let info_len = if gw_info.log_len > 256 { 256 } else {gw_info.log_len};
|
let info_len = if gw_info.log_len > 256 { 256 } else {gw_info.log_len};
|
||||||
let info = format!("{}", str::from_utf8(&gw_info.log_str[..info_len as usize]).unwrap());
|
let info = format!("{}", str::from_utf8(&gw_info.log_str[..info_len as usize]).unwrap());
|
||||||
modals.show_notification(info.as_str()).expect("modals error");
|
modals.show_notification(info.as_str(), false).expect("modals error");
|
||||||
// truncate the message to better fit in the rendering box
|
// truncate the message to better fit in the rendering box
|
||||||
let status_len = if gw_info.status_len > 256 { 256 } else {gw_info.status_len};
|
let status_len = if gw_info.status_len > 256 { 256 } else {gw_info.status_len};
|
||||||
let info = format!("{}", str::from_utf8(&gw_info.status_str[..status_len as usize]).unwrap());
|
let info = format!("{}", str::from_utf8(&gw_info.status_str[..status_len as usize]).unwrap());
|
||||||
modals.show_notification(info.as_str()).expect("modals error");
|
modals.show_notification(info.as_str(), false).expect("modals error");
|
||||||
} else {
|
} else {
|
||||||
skip_confirmation = true;
|
skip_confirmation = true;
|
||||||
}
|
}
|
||||||
|
|
@ -760,21 +760,21 @@ fn xmain() -> ! {
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
modals.show_notification(t!("rootkeys.gwup.finished", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.gwup.finished", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::AlignmentError) => {
|
Err(RootkeyResult::AlignmentError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::KeyError) => {
|
Err(RootkeyResult::KeyError) => {
|
||||||
// probably a bad password, purge it, so the user can try again
|
// probably a bad password, purge it, so the user can try again
|
||||||
keys.purge_password(PasswordType::Update);
|
keys.purge_password(PasswordType::Update);
|
||||||
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::IntegrityError) => {
|
Err(RootkeyResult::IntegrityError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::FlashError) => {
|
Err(RootkeyResult::FlashError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -834,21 +834,21 @@ fn xmain() -> ! {
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
modals.show_notification(t!("rootkeys.signxous.finished", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.signxous.finished", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::AlignmentError) => {
|
Err(RootkeyResult::AlignmentError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::KeyError) => {
|
Err(RootkeyResult::KeyError) => {
|
||||||
// probably a bad password, purge it, so the user can try again
|
// probably a bad password, purge it, so the user can try again
|
||||||
keys.purge_password(PasswordType::Update);
|
keys.purge_password(PasswordType::Update);
|
||||||
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::IntegrityError) => {
|
Err(RootkeyResult::IntegrityError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::FlashError) => {
|
Err(RootkeyResult::FlashError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -885,7 +885,7 @@ fn xmain() -> ! {
|
||||||
// more keys with more passwords, this policy may need to become markedly more complicated!
|
// more keys with more passwords, this policy may need to become markedly more complicated!
|
||||||
|
|
||||||
// otherwise, an invalid password request
|
// otherwise, an invalid password request
|
||||||
modals.show_notification(t!("rootkeys.bad_password_request", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.bad_password_request", xous::LANG), false).expect("modals error");
|
||||||
|
|
||||||
xous::return_scalar(msg.sender, 0).unwrap();
|
xous::return_scalar(msg.sender, 0).unwrap();
|
||||||
}
|
}
|
||||||
|
|
@ -978,7 +978,7 @@ fn xmain() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(Opcode::BbramProvision) => {
|
Some(Opcode::BbramProvision) => {
|
||||||
modals.show_notification(t!("rootkeys.bbram.confirm", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.bbram.confirm", xous::LANG), false).expect("modals error");
|
||||||
let console_input = gam::modal::ConsoleInput::new(
|
let console_input = gam::modal::ConsoleInput::new(
|
||||||
main_cid,
|
main_cid,
|
||||||
Opcode::UxBbramCheckReturn.to_u32().unwrap()
|
Opcode::UxBbramCheckReturn.to_u32().unwrap()
|
||||||
|
|
@ -1016,7 +1016,7 @@ fn xmain() -> ! {
|
||||||
rootkeys_modal.activate();
|
rootkeys_modal.activate();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
modals.show_notification(t!("rootkeys.bbram.no_helper", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.bbram.no_helper", xous::LANG), false).expect("modals error");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1039,21 +1039,21 @@ fn xmain() -> ! {
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
modals.show_notification(t!("rootkeys.bbram.finished", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.bbram.finished", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::AlignmentError) => {
|
Err(RootkeyResult::AlignmentError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_alignment", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::KeyError) => {
|
Err(RootkeyResult::KeyError) => {
|
||||||
// probably a bad password, purge it, so the user can try again
|
// probably a bad password, purge it, so the user can try again
|
||||||
keys.purge_password(PasswordType::Update);
|
keys.purge_password(PasswordType::Update);
|
||||||
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_key", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::IntegrityError) => {
|
Err(RootkeyResult::IntegrityError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_verify", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
Err(RootkeyResult::FlashError) => {
|
Err(RootkeyResult::FlashError) => {
|
||||||
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG)).expect("modals error");
|
modals.show_notification(t!("rootkeys.init.fail_burn", xous::LANG), false).expect("modals error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -639,14 +639,14 @@ fn xmain() -> ! {
|
||||||
}),
|
}),
|
||||||
Some(StatusOpcode::TrySuspend) => {
|
Some(StatusOpcode::TrySuspend) => {
|
||||||
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
||||||
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG)).expect("couldn't notify that power is plugged in");
|
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG), false).expect("couldn't notify that power is plugged in");
|
||||||
} else {
|
} else {
|
||||||
susres.initiate_suspend().expect("couldn't initiate suspend op");
|
susres.initiate_suspend().expect("couldn't initiate suspend op");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(StatusOpcode::BatteryDisconnect) => {
|
Some(StatusOpcode::BatteryDisconnect) => {
|
||||||
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
||||||
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG)).expect("couldn't notify that power is plugged in");
|
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG), false).expect("couldn't notify that power is plugged in");
|
||||||
} else {
|
} else {
|
||||||
gam.shipmode_blank_request().ok();
|
gam.shipmode_blank_request().ok();
|
||||||
ticktimer.sleep_ms(500).unwrap();
|
ticktimer.sleep_ms(500).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ pub fn start_time_ux(sid: xous::SID) {
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
Some(TimeUxOp::SetTime) => xous::msg_scalar_unpack!(msg, _, _, _, _, {
|
Some(TimeUxOp::SetTime) => xous::msg_scalar_unpack!(msg, _, _, _, _, {
|
||||||
if !pddb_poller.is_mounted_nonblocking() {
|
if !pddb_poller.is_mounted_nonblocking() {
|
||||||
modals.show_notification(t!("stats.please_mount", xous::LANG)).expect("couldn't show notification");
|
modals.show_notification(t!("stats.please_mount", xous::LANG), false).expect("couldn't show notification");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mut tz_set_handle = pddb::Pddb::new();
|
let mut tz_set_handle = pddb::Pddb::new();
|
||||||
|
|
@ -573,7 +573,7 @@ pub fn start_time_ux(sid: xous::SID) {
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::info!("Err: {:?}", err);
|
log::info!("Err: {:?}", err);
|
||||||
modals.show_notification(t!("rtc.ntp_fail", xous::LANG)).expect("couldn't show NTP error");
|
modals.show_notification(t!("rtc.ntp_fail", xous::LANG), false).expect("couldn't show NTP error");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -641,7 +641,7 @@ pub fn start_time_ux(sid: xous::SID) {
|
||||||
}),
|
}),
|
||||||
Some(TimeUxOp::SetTimeZone) => xous::msg_scalar_unpack!(msg, _, _, _, _, {
|
Some(TimeUxOp::SetTimeZone) => xous::msg_scalar_unpack!(msg, _, _, _, _, {
|
||||||
if !pddb_poller.is_mounted_nonblocking() {
|
if !pddb_poller.is_mounted_nonblocking() {
|
||||||
modals.show_notification(t!("stats.please_mount", xous::LANG)).expect("couldn't show notification");
|
modals.show_notification(t!("stats.please_mount", xous::LANG), false).expect("couldn't show notification");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let tz = modals.get_text(
|
let tz = modals.get_text(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue