fix logic bug in usb lock status update

This commit is contained in:
bunnie 2022-02-06 01:31:08 +08:00
parent 3dae62a20d
commit c86df3d095
2 changed files with 8 additions and 4 deletions

View file

@ -506,12 +506,14 @@ mod implementation {
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Llio { pub struct Llio {
usb_disable: bool,
} }
pub fn log_init() -> *mut u32 { 0 as *mut u32 } pub fn log_init() -> *mut u32 { 0 as *mut u32 }
impl Llio { impl Llio {
pub fn new(_handler_conn: xous::CID, _gpio_base: *mut u32) -> Llio { pub fn new(_handler_conn: xous::CID, _gpio_base: *mut u32) -> Llio {
Llio { Llio {
usb_disable: false,
} }
} }
pub fn suspend(&self) {} pub fn suspend(&self) {}
@ -590,9 +592,10 @@ mod implementation {
} }
pub fn get_usb_disable(&self) -> bool { pub fn get_usb_disable(&self) -> bool {
false self.usb_disable
} }
pub fn set_usb_disable(&mut self, _state: bool) { pub fn set_usb_disable(&mut self, state: bool) {
self.usb_disable = state;
} }
} }

View file

@ -452,12 +452,13 @@ fn xmain() -> ! {
|| (sec_notes.lock().unwrap().len() > 1) || (sec_notes.lock().unwrap().len() > 1)
&& ((stats_phase % secnotes_interval) == 0) && ((stats_phase % secnotes_interval) == 0)
{ {
log::info!("updating lock state text");
if debug_locked != is_locked { if debug_locked != is_locked {
if debug_locked { if is_locked {
sec_notes sec_notes
.lock() .lock()
.unwrap() .unwrap()
.remove(&"secnotes.usb_unlock".to_string()); .remove(&"secnote.usb_unlock".to_string()); // this is the key, not the value to remove
} else { } else {
sec_notes.lock().unwrap().insert( sec_notes.lock().unwrap().insert(
"secnotes.usb_unlock".to_string(), "secnotes.usb_unlock".to_string(),