mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'backups' into main
This commit is contained in:
commit
363a528961
7 changed files with 174 additions and 56 deletions
|
|
@ -291,10 +291,10 @@ impl Llio {
|
|||
if let xous::Result::Scalar2(val1, val2) = response {
|
||||
Ok(
|
||||
SemVer {
|
||||
maj: (val1 >> 24) as u16,
|
||||
min: (val1 >> 16) as u16,
|
||||
rev: (val1 >> 8) as u16,
|
||||
extra: (val1 >> 0) as u16,
|
||||
maj: ((val1 >> 24) & 0xff) as u16,
|
||||
min: ((val1 >> 16) & 0xff) as u16,
|
||||
rev: ((val1 >> 8) & 0xff) as u16,
|
||||
extra: ((val1 >> 0) & 0xff) as u16,
|
||||
commit: Some(val2 as u32),
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@
|
|||
"en-tts": "Root keys already initialized."
|
||||
},
|
||||
"rootkeys.confirm": {
|
||||
"en": "This will initialize the root keys on your Precursor device.\n\nYou will be prompted for two passwords:\n\t1. Device unlock PIN code\n\t2. System update passphrase.\n\nAre you ready?",
|
||||
"en": "🔐Create passwords for your Precursor device🔐\n\nYou will be prompted for two passwords:\n\t1. Device unlock PIN code\n\t2. System update passphrase.\n\nAre you ready?",
|
||||
"ja": "これにより、Precursorデバイスのルートキーが初期化されます。\n\n2つのパスワードの入力を求められます。\n\t1.デバイスのロック解除PINコード\n\t2.システムアップデートパスフレーズ。\n\n準備はいいですか?",
|
||||
"zh": "仅当您准备好信 任此设备时才 应继续",
|
||||
"en-tts": "You should only proceed with this operation if you are ready to trust this device."
|
||||
|
|
@ -131,6 +131,12 @@
|
|||
"zh": "我先检查一下,稍后再试",
|
||||
"en-tts": "I'll try again after inspecting my device."
|
||||
},
|
||||
"rootkeys.confirm.dont_ask": {
|
||||
"en": "Stop bothering me; I know what I'm doing.",
|
||||
"ja": "二度と気にしないで",
|
||||
"zh": "不要再打扰我了",
|
||||
"en-tts": "Stop bothering me; I know what I'm doing."
|
||||
},
|
||||
"rootkeys.setup_wait": {
|
||||
"en": "Initializing keys. This takes a few minutes. Do not reset or sleep!",
|
||||
"ja": "キーを初期化中です。これには数分かかります。リセットやスリープはしないでください。",
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ pub(crate) enum Opcode {
|
|||
IsZeroKey = 44,
|
||||
/// Erase the backup block
|
||||
EraseBackupBlock = 45,
|
||||
/// Checks to see if "don't ask me about updates" is set
|
||||
IsDontAskSet = 46,
|
||||
}
|
||||
|
||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -2499,25 +2499,45 @@ impl<'a> RootKeys {
|
|||
}
|
||||
}
|
||||
pub fn should_prompt_for_update(&mut self) -> bool {
|
||||
let soc_region = self.gateware();
|
||||
if u32::from_le_bytes(soc_region[soc_region.len() - 4..].try_into().unwrap()) == 0xFFFF_FFFF {
|
||||
let soc_region = self.staging();
|
||||
let status = u32::from_le_bytes(soc_region[soc_region.len() - 4..].try_into().unwrap());
|
||||
log::info!("prompt for update: {:x?}", status);
|
||||
if status == 0xFFFF_FFFF {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
/// the update prompt is reset every time you stage a new update
|
||||
pub fn set_prompt_for_update(&mut self, state: bool) {
|
||||
let patch_data = if state {
|
||||
[0xffu8; 4]
|
||||
} else {
|
||||
[0x0u8; 4]
|
||||
};
|
||||
self.spinor.patch(
|
||||
self.staging(),
|
||||
self.staging_base(),
|
||||
&patch_data,
|
||||
self.staging().len() as u32 - 4
|
||||
).expect("couldn't patch update prompt");
|
||||
}
|
||||
pub fn is_dont_ask_init_set(&mut self) -> bool {
|
||||
let soc_region = self.gateware();
|
||||
let status = u32::from_le_bytes(soc_region[soc_region.len() - 4..].try_into().unwrap());
|
||||
log::info!("prompt for root key init: {:x?}", status);
|
||||
// just check the first byte, although a full word is written for the flag
|
||||
status != 0xffff_ffff
|
||||
}
|
||||
/// this is reset every time the gateware is updated. That's rather intentional, if someone
|
||||
/// *is* updating their gateware and they haven't initialized root keys...maybe they should?
|
||||
pub fn set_dont_ask_init(&mut self) {
|
||||
self.spinor.patch(
|
||||
self.gateware(),
|
||||
self.gateware_base(),
|
||||
&patch_data,
|
||||
self.gateware().len() as u32 - 4
|
||||
).expect("couldn't patch update prompt");
|
||||
&[0u8; 4],
|
||||
self.gateware().len() as u32 - 4,
|
||||
).expect("couldn't erase backup region");
|
||||
}
|
||||
pub fn read_backup_header(&mut self) -> Option<BackupHeader> {
|
||||
let kernel = self.kernel();
|
||||
|
|
|
|||
|
|
@ -101,6 +101,17 @@ impl RootKeys {
|
|||
Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
pub fn is_dont_ask_set(&self) -> Result<bool, xous::Error> {
|
||||
let response = send_message(self.conn,
|
||||
Message::new_blocking_scalar(Opcode::IsDontAskSet.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).expect("couldn't send IsDontAsk check message");
|
||||
if let xous::Result::Scalar1(result) = response {
|
||||
if result != 0 {return Ok(true)} else {return Ok(false)}
|
||||
} else {
|
||||
log::error!("unexpected return value: {:#?}", response);
|
||||
Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn do_update_gw_ux_flow(&self) {
|
||||
send_message(self.conn,
|
||||
|
|
@ -108,10 +119,16 @@ impl RootKeys {
|
|||
0, 0, 0, 0)
|
||||
).expect("couldn't send message to root keys");
|
||||
}
|
||||
pub fn do_update_gw_ux_flow_blocking(&self) {
|
||||
send_message(self.conn,
|
||||
Message::new_blocking_scalar(Opcode::UxUpdateGateware.to_usize().unwrap(),
|
||||
0, 0, 0, 0)
|
||||
).expect("couldn't send message to root keys");
|
||||
}
|
||||
|
||||
pub fn do_init_keys_ux_flow(&self) {
|
||||
send_message(self.conn,
|
||||
Message::new_scalar(Opcode::UxTryInitKeys.to_usize().unwrap(),
|
||||
Message::new_blocking_scalar(Opcode::UxTryInitKeys.to_usize().unwrap(),
|
||||
0, 0, 0, 0)
|
||||
).expect("couldn't send message to root keys");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,6 +360,8 @@ mod implementation {
|
|||
pub fn is_zero_key(&self) -> Option<bool> { Some(true) }
|
||||
pub fn setup_restore_init(&mut self, _key: backups::BackupKey, _rom: backups::KeyRomExport) {
|
||||
}
|
||||
pub fn is_dont_ask_set(&self) -> bool {false}
|
||||
pub fn set_dont_ask(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -464,6 +466,7 @@ fn main() -> ! {
|
|||
let mut reboot_initiated = false;
|
||||
let mut aes_sender: Option<xous::MessageSender> = None;
|
||||
let mut backup_header: Option<BackupHeader> = None;
|
||||
let mut deferred_response: Option<xous::MessageSender> = None;
|
||||
loop {
|
||||
let mut msg = xous::receive_message(keys_sid).unwrap();
|
||||
let opcode: Option<Opcode> = FromPrimitive::from_usize(msg.body.id());
|
||||
|
|
@ -507,6 +510,12 @@ fn main() -> ! {
|
|||
|
||||
// UX flow opcodes
|
||||
Some(Opcode::UxTryInitKeys) => msg_scalar_unpack!(msg, _, _, _, _, {
|
||||
match msg.body {
|
||||
xous::Message::BlockingScalar(_) => {
|
||||
deferred_response = Some(msg.sender);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
if false { // short-circuit for testing subroutines
|
||||
let _success = keys.test(&mut rootkeys_modal, main_cid);
|
||||
|
||||
|
|
@ -515,7 +524,9 @@ fn main() -> ! {
|
|||
send_message(main_cid,
|
||||
xous::Message::new_scalar(Opcode::UxTryReboot.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).expect("couldn't initiate dialog box");
|
||||
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
// overall flow:
|
||||
|
|
@ -538,17 +549,35 @@ fn main() -> ! {
|
|||
#[cfg(feature="tts")]
|
||||
tts.tts_blocking(t!("rootkeys.already_init", xous::LANG)).unwrap();
|
||||
keys.set_ux_password_type(None);
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
modals.add_list_item(t!("rootkeys.confirm.yes", xous::LANG)).expect("modals error");
|
||||
modals.add_list_item(t!("rootkeys.confirm.no", xous::LANG)).expect("modals error");
|
||||
if deferred_response.is_some() {
|
||||
modals.add_list_item(t!("rootkeys.confirm.dont_ask", xous::LANG)).expect("modals error");
|
||||
}
|
||||
log::info!("{}ROOTKEY.CONFIRM,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
||||
match modals.get_radiobutton(t!("rootkeys.confirm", xous::LANG)) {
|
||||
Ok(response) => {
|
||||
if response == t!("rootkeys.confirm.no", xous::LANG) {
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else if response == t!("rootkeys.confirm.dont_ask", xous::LANG) {
|
||||
keys.set_dont_ask_init();
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else if response != t!("rootkeys.confirm.yes", xous::LANG) {
|
||||
log::error!("Got unexpected response: {:?}", response);
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
// do nothing, this is the forward path
|
||||
|
|
@ -642,6 +671,9 @@ fn main() -> ! {
|
|||
modals.show_notification(t!("rootkeys.wrong_state", xous::LANG), None).expect("modals error");
|
||||
}
|
||||
}
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
},
|
||||
Some(Opcode::UxTryReboot) => {
|
||||
log::info!("{}ROOTKEY.INITDONE,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
||||
|
|
@ -741,6 +773,12 @@ fn main() -> ! {
|
|||
}
|
||||
}
|
||||
Some(Opcode::UxUpdateGateware) => {
|
||||
match msg.body {
|
||||
xous::Message::BlockingScalar(_) => {
|
||||
deferred_response = Some(msg.sender);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
// steps:
|
||||
// - check update signature "Inspecting gateware update, this will take a moment..."
|
||||
// - if no signature found: "No valid update found! (ok -> exit out)"
|
||||
|
|
@ -757,6 +795,9 @@ fn main() -> ! {
|
|||
_ => {
|
||||
modals.dynamic_notification_close().expect("modals error");
|
||||
modals.show_notification(t!("rootkeys.gwup.no_update_found", xous::LANG), None).expect("modals error");
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
|
@ -803,7 +844,13 @@ fn main() -> ! {
|
|||
skip_confirmation = true;
|
||||
}
|
||||
}
|
||||
_ => {log::error!("get_radiobutton failed"); continue;}
|
||||
_ => {
|
||||
log::error!("get_radiobutton failed");
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if !skip_confirmation {
|
||||
modals.add_list_item(t!("rootkeys.gwup.yes", xous::LANG)).expect("modals error");
|
||||
|
|
@ -811,9 +858,15 @@ fn main() -> ! {
|
|||
match modals.get_radiobutton(t!("rootkeys.gwup.proceed_confirm", xous::LANG)) {
|
||||
Ok(response) => {
|
||||
if response == t!("rootkeys.gwup.no", xous::LANG) {
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} if response != t!("rootkeys.gwup.yes", xous::LANG) {
|
||||
log::error!("got unexpected response from radio box: {:?}", response);
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
// just proceed forward!
|
||||
|
|
@ -821,6 +874,9 @@ fn main() -> ! {
|
|||
}
|
||||
_ => {
|
||||
log::error!("modals error, aborting");
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -909,6 +965,9 @@ fn main() -> ! {
|
|||
modals.show_notification(t!("rootkeys.wrong_state", xous::LANG), None).expect("modals error");
|
||||
}
|
||||
}
|
||||
if let Some(dr) = deferred_response.take() {
|
||||
xous::return_scalar(dr, 0).unwrap();
|
||||
}
|
||||
}
|
||||
Some(Opcode::UxSelfSignXous) => {
|
||||
if keys.is_pcache_update_password_valid() {
|
||||
|
|
@ -1485,6 +1544,13 @@ fn main() -> ! {
|
|||
xous::return_scalar2(msg.sender, 0, 0).ok();
|
||||
}
|
||||
}),
|
||||
Some(Opcode::IsDontAskSet) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||
if keys.is_dont_ask_init_set() {
|
||||
xous::return_scalar(msg.sender, 1).ok();
|
||||
} else {
|
||||
xous::return_scalar(msg.sender, 0).ok();
|
||||
}
|
||||
}),
|
||||
Some(Opcode::TestUx) => msg_blocking_scalar_unpack!(msg, _arg, _, _, _, {
|
||||
// dummy test for now
|
||||
xous::return_scalar(msg.sender, 1234).unwrap();
|
||||
|
|
|
|||
|
|
@ -294,7 +294,51 @@ fn wrapped_main() -> ! {
|
|||
);
|
||||
}
|
||||
|
||||
// --------------------------- spawn a time UX manager thread
|
||||
let time_sid = xous::create_server().unwrap();
|
||||
let time_cid = xous::connect(time_sid).unwrap();
|
||||
time::start_time_ux(time_sid);
|
||||
// this is used by the main loop to get the localtime to show on the status bar
|
||||
let mut localtime = llio::LocalTime::new();
|
||||
|
||||
// ---------------------------- connect to the com & root keys server (prereq for menus)
|
||||
let keys = Arc::new(Mutex::new(
|
||||
root_keys::RootKeys::new(&xns, None)
|
||||
.expect("couldn't connect to root_keys to query initialization state"),
|
||||
));
|
||||
let mut com = com::Com::new(&xns).expect("|status: can't connect to COM");
|
||||
|
||||
// ---------------------------- build menus
|
||||
// used to hide time when the PDDB is not mounted
|
||||
let pddb_poller = pddb::PddbMountPoller::new();
|
||||
// these menus stake a claim on some security-sensitive connections; occupy them upstream of trying to do an update
|
||||
log::debug!("starting main menu thread");
|
||||
let main_menu_sid = xous::create_server().unwrap();
|
||||
let status_cid = xous::connect(status_sid).unwrap();
|
||||
let menu_manager = create_main_menu(keys.clone(), main_menu_sid, status_cid, &com, time_cid);
|
||||
create_app_menu(xous::connect(status_sid).unwrap());
|
||||
let kbd_mgr = xous::create_server().unwrap();
|
||||
let kbd_menumatic = create_kbd_menu(xous::connect(status_sid).unwrap(), kbd_mgr);
|
||||
let kbd = keyboard::Keyboard::new(&xns).unwrap();
|
||||
|
||||
// ---------------------------- Automatic backlight-related variables.
|
||||
// must be upstream of the update check, because we need to occupy the keyboard
|
||||
// server slot to prevent e.g. a keyboard logger from taking our passwords!
|
||||
kbd.register_observer(
|
||||
SERVER_NAME_STATUS,
|
||||
StatusOpcode::Keypress.to_u32().unwrap() as usize,
|
||||
);
|
||||
|
||||
let enabled = Arc::new(Mutex::new(false));
|
||||
let (tx, rx): (Sender<BacklightThreadOps>, Receiver<BacklightThreadOps>) = unbounded();
|
||||
|
||||
let rx = Box::new(rx);
|
||||
|
||||
let thread_already_running = Arc::new(Mutex::new(false));
|
||||
let thread_conn = xous::connect(status_sid).unwrap();
|
||||
|
||||
// ------------------------ check firmware status and apply updates
|
||||
// all security sensitive servers must be occupied at this point in time.
|
||||
// in debug mode, anyone could, in theory, connect to and trigger an EC update, given this permissive policy.
|
||||
#[cfg(feature="dbg-ecupdate")]
|
||||
let ecup_sid = xns.register_name("__ECUP server__", None).unwrap(); // do not change name, it is referred to in shellchat
|
||||
|
|
@ -343,11 +387,6 @@ fn wrapped_main() -> ! {
|
|||
unsafe{xous::disconnect(ecup_conn).ok()};
|
||||
}
|
||||
|
||||
let keys = Arc::new(Mutex::new(
|
||||
root_keys::RootKeys::new(&xns, None)
|
||||
.expect("couldn't connect to root_keys to query initialization state"),
|
||||
));
|
||||
|
||||
// check for backups after EC updates, but before we check for gateware updates
|
||||
let mut backup_time: Option<DateTime::<Utc>> = None;
|
||||
let mut restore_running = false;
|
||||
|
|
@ -377,7 +416,7 @@ fn wrapped_main() -> ! {
|
|||
// check for gateware updates
|
||||
let staged_sv = match keys.lock().unwrap().staged_semver() {
|
||||
Ok(sv) => {
|
||||
log::info!("Stage gateware version: {:?}", sv);
|
||||
log::info!("Staged gateware version: {:?}", sv);
|
||||
Some(sv)
|
||||
},
|
||||
Err(xous::Error::InvalidString) => {log::info!("No staged gateware found; metadata is blank"); None},
|
||||
|
|
@ -400,6 +439,9 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
}
|
||||
}
|
||||
if !keys.lock().unwrap().is_dont_ask_set().unwrap_or(false) {
|
||||
keys.lock().unwrap().do_init_keys_ux_flow();
|
||||
}
|
||||
}
|
||||
} else if !restore_running {
|
||||
log::info!("checking gateware signature...");
|
||||
|
|
@ -440,7 +482,7 @@ fn wrapped_main() -> ! {
|
|||
match modals.get_radiobutton(t!("socup.candidate", xous::LANG)) {
|
||||
Ok(response) => {
|
||||
if response.as_str() == t!("rootkeys.gwup.yes", xous::LANG) {
|
||||
keys.lock().unwrap().do_update_gw_ux_flow();
|
||||
keys.lock().unwrap().do_update_gw_ux_flow_blocking();
|
||||
soc_updated = true;
|
||||
} else if response.as_str() == t!("socup.ignore", xous::LANG) {
|
||||
keys.lock().unwrap().set_update_prompt(false);
|
||||
|
|
@ -482,7 +524,6 @@ fn wrapped_main() -> ! {
|
|||
// this takes a few seconds, so we have a dead-wait here. This is a good spot for it because
|
||||
// the status bar reads "booting up..." during this period.
|
||||
log::debug!("syncing with COM");
|
||||
let mut com = com::Com::new(&xns).expect("|status: can't connect to COM");
|
||||
com.ping(0).unwrap(); // this will block until the COM is ready to take events
|
||||
com.hook_batt_stats(battstats_cb)
|
||||
.expect("|status: couldn't hook callback for events from COM");
|
||||
|
|
@ -490,26 +531,7 @@ fn wrapped_main() -> ! {
|
|||
com.req_batt_stats()
|
||||
.expect("Can't get battery stats from COM");
|
||||
|
||||
// --------------------------- spawn a time UX manager thread
|
||||
let time_sid = xous::create_server().unwrap();
|
||||
let time_cid = xous::connect(time_sid).unwrap();
|
||||
time::start_time_ux(time_sid);
|
||||
// this is used by the main loop to get the localtime to show on the status bar
|
||||
let mut localtime = llio::LocalTime::new();
|
||||
|
||||
// ---------------------------- build menus
|
||||
// used to hide time when the PDDB is not mounted
|
||||
let pddb_poller = pddb::PddbMountPoller::new();
|
||||
|
||||
log::debug!("starting main menu thread");
|
||||
let main_menu_sid = xous::create_server().unwrap();
|
||||
let status_cid = xous::connect(status_sid).unwrap();
|
||||
let menu_manager = create_main_menu(keys.clone(), main_menu_sid, status_cid, &com, time_cid);
|
||||
create_app_menu(xous::connect(status_sid).unwrap());
|
||||
let kbd_mgr = xous::create_server().unwrap();
|
||||
let kbd_menumatic = create_kbd_menu(xous::connect(status_sid).unwrap(), kbd_mgr);
|
||||
let kbd = keyboard::Keyboard::new(&xns).unwrap();
|
||||
|
||||
// ---------------------- final cleanup before entering main loop
|
||||
log::debug!("subscribe to wifi updates");
|
||||
netmgr.wifi_state_subscribe(cb_cid, StatusOpcode::WifiStats.to_u32().unwrap()).unwrap();
|
||||
let mut wifi_status: WlanStatus = WlanStatus::from_ipc(WlanStatusIpc::default());
|
||||
|
|
@ -527,7 +549,6 @@ fn wrapped_main() -> ! {
|
|||
});
|
||||
log::info!("|status: starting main loop"); // don't change this -- factory test looks for this exact string
|
||||
|
||||
// ---------------------- final cleanup before entering main loop
|
||||
// add a security note if we're booting with a "zero key"
|
||||
match keys.lock().unwrap().is_zero_key().expect("couldn't query zero key status") {
|
||||
Some(q) => match q {
|
||||
|
|
@ -555,20 +576,6 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
});
|
||||
|
||||
// Automatic backlight-related variables.
|
||||
kbd.register_observer(
|
||||
SERVER_NAME_STATUS,
|
||||
StatusOpcode::Keypress.to_u32().unwrap() as usize,
|
||||
);
|
||||
|
||||
let enabled = Arc::new(Mutex::new(false));
|
||||
let (tx, rx): (Sender<BacklightThreadOps>, Receiver<BacklightThreadOps>) = unbounded();
|
||||
|
||||
let rx = Box::new(rx);
|
||||
|
||||
let thread_already_running = Arc::new(Mutex::new(false));
|
||||
let thread_conn = xous::connect(status_sid).unwrap();
|
||||
|
||||
pump_run.store(true, Ordering::Relaxed); // start status thread updating
|
||||
loop {
|
||||
let msg = xous::receive_message(status_sid).unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue