mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
remove suspend/resume awareness from app
In retrospect forcing apps to manage their suspend in resume crosses too many abstraction barriers. Instead, the app should specify the mode of the hardware, but then the driver should be responsible for restoring that state on resume, not the app.
This commit is contained in:
parent
a0217d9ffd
commit
943e45f17e
2 changed files with 0 additions and 28 deletions
|
|
@ -2,7 +2,6 @@
|
|||
#![cfg_attr(target_os = "none", no_main)]
|
||||
|
||||
mod ux;
|
||||
use susres::SuspendOrder;
|
||||
use ux::*;
|
||||
use num_traits::*;
|
||||
use xous_ipc::Buffer;
|
||||
|
|
@ -133,9 +132,6 @@ pub(crate) enum VaultOp {
|
|||
/// PDDB basis change
|
||||
BasisChange,
|
||||
|
||||
/// Suspend/resume notifications
|
||||
SuspendResume,
|
||||
|
||||
/// Nop while waiting for prerequisites to be filled
|
||||
Nop,
|
||||
|
||||
|
|
@ -267,12 +263,6 @@ fn main() -> ! {
|
|||
// starts a thread to keep NTP up-to-date
|
||||
ntp_updater(time_conn);
|
||||
|
||||
// register with the susres so we can enforce our USB policy
|
||||
let mut susres = susres::Susres::new(
|
||||
Some(SuspendOrder::Early), &xns,
|
||||
VaultOp::SuspendResume as u32, conn
|
||||
).expect("couldn't create suspend/resume object");
|
||||
|
||||
let modals = modals::Modals::new(&xns).unwrap();
|
||||
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
||||
loop {
|
||||
|
|
@ -280,16 +270,6 @@ fn main() -> ! {
|
|||
let opcode: Option<VaultOp> = FromPrimitive::from_usize(msg.body.id());
|
||||
log::debug!("{:?}", opcode);
|
||||
match opcode {
|
||||
Some(VaultOp::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||
vaultux.suspend();
|
||||
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
|
||||
if allow_redraw {
|
||||
// if we're in the foreground, we set the USB policy. This is a cooperative measure,
|
||||
// nothing prevents other processes from being stupid about this, but see
|
||||
// issue #178: https://github.com/betrusted-io/xous-core/issues/178
|
||||
vaultux.resume();
|
||||
}
|
||||
}),
|
||||
Some(VaultOp::IncrementalLine) => {
|
||||
if action_active.load(Ordering::SeqCst) {
|
||||
log::trace!("action active, skipping incremental input");
|
||||
|
|
|
|||
|
|
@ -182,14 +182,6 @@ impl VaultUx {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn suspend(&self) {
|
||||
// nothing to do in particular. PDDB should sync itself.
|
||||
}
|
||||
pub(crate) fn resume(&self) {
|
||||
self.usb_dev.switch_to_core(usb_device_xous::UsbDeviceType::Hid).unwrap();
|
||||
self.usb_dev.restrict_debug_access(true).unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn update_mode(&mut self) {
|
||||
self.title_dirty = true;
|
||||
self.filtered_list.clear();
|
||||
|
|
|
|||
Loading…
Reference in a new issue