@@ -394,7 +394,7 @@ use std::collections::{HashMap, BTreeSet};
394
394
use std:: io:: ErrorKind ;
395
395
use core:: fmt:: Write ;
396
396
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
397
- use std:: sync:: { Arc , Mutex } ;
397
+ use std:: sync:: Arc ;
398
398
399
399
use locales:: t;
400
400
@@ -490,34 +490,6 @@ fn wrapped_main() -> ! {
490
490
}
491
491
} ) ;
492
492
493
- let hide_startingup_notif = Arc :: new ( Mutex :: new ( false ) ) ;
494
- let hide_startingup_notif_clone = hide_startingup_notif. clone ( ) ;
495
-
496
- std:: thread:: spawn ( move || {
497
- // For some weird reason spawning a dynamic notification without waiting 800ms in a separate thread
498
- // makes it impossible to read, because it gets covered by hundreds of those modal security lines (???).
499
- // This thread waits on hide_startingup_notif to become true, then disimsses the dynamic notification that it created
500
- // previously.
501
- // To allow other threads to do work, yield to kernel every time the variable is read as false.
502
-
503
- let xns = xous_names:: XousNames :: new ( ) . unwrap ( ) ;
504
- let modals = modals:: Modals :: new ( & xns) . expect ( "can't connect to Modals server" ) ;
505
-
506
- std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 1000 ) ) ;
507
-
508
- modals. dynamic_notification ( Some ( "Starting up..." ) , Some ( "Precursor is booting up, please wait." ) ) . unwrap ( ) ;
509
-
510
- loop {
511
- if * hide_startingup_notif_clone. lock ( ) . unwrap ( ) {
512
- modals. dynamic_notification_close ( ) . unwrap ( ) ;
513
- break ;
514
- }
515
-
516
- xous:: yield_slice ( ) ;
517
- } ;
518
- } ) ;
519
-
520
-
521
493
// OS-specific PDDB driver
522
494
let mut pddb_os = PddbOs :: new ( Rc :: clone ( & entropy) , pw_cid) ;
523
495
// storage for the basis cache
@@ -684,8 +656,6 @@ fn wrapped_main() -> ! {
684
656
// - code = 2 -> mount failed, because too many PINs were retried. `count` is the number of retries.
685
657
// If we need more nuance out of this routine, consider creating a custom public enum type to help marshall this.
686
658
Opcode :: TryMount => xous:: msg_blocking_scalar_unpack!( msg, _, _, _, _, {
687
- * hide_startingup_notif. lock( ) . unwrap( ) = true ;
688
-
689
659
if basis_cache. basis_count( ) > 0 {
690
660
xous:: return_scalar2( msg. sender, 0 , 0 ) . expect( "couldn't return scalar" ) ;
691
661
} else {
@@ -699,8 +669,6 @@ fn wrapped_main() -> ! {
699
669
} else {
700
670
match ensure_password( & modals, & mut pddb_os, pw_cid) {
701
671
PasswordState :: Correct => {
702
- modals. dynamic_notification( Some ( "Starting up..." ) , Some ( "Mounting PDDB, please wait." ) ) . unwrap( ) ;
703
-
704
672
if try_mount_or_format( & modals, & mut pddb_os, & mut basis_cache, PasswordState :: Correct , time_resetter) {
705
673
is_mounted. store( true , Ordering :: SeqCst ) ;
706
674
for requester in mount_notifications. drain( ..) {
@@ -712,12 +680,8 @@ fn wrapped_main() -> ! {
712
680
} else {
713
681
xous:: return_scalar2( msg. sender, 1 , 0 ) . expect( "couldn't return scalar" ) ;
714
682
}
715
-
716
- modals. dynamic_notification_close( ) . unwrap( ) ;
717
683
} ,
718
684
PasswordState :: Uninit => {
719
- modals. dynamic_notification( Some ( "Starting up..." ) , Some ( "Mounting PDDB, please wait." ) ) . unwrap( ) ;
720
-
721
685
if try_mount_or_format( & modals, & mut pddb_os, & mut basis_cache, PasswordState :: Uninit , time_resetter) {
722
686
for requester in mount_notifications. drain( ..) {
723
687
xous:: return_scalar2( requester, 0 , 0 ) . expect( "couldn't return scalar" ) ;
@@ -729,8 +693,6 @@ fn wrapped_main() -> ! {
729
693
} else {
730
694
xous:: return_scalar2( msg. sender, 1 , 0 ) . expect( "couldn't return scalar" ) ;
731
695
}
732
-
733
- modals. dynamic_notification_close( ) . unwrap( ) ;
734
696
} ,
735
697
PasswordState :: ForcedAbort ( failcount) => {
736
698
xous:: return_scalar2( msg. sender, 2 ,
@@ -1965,11 +1927,14 @@ fn ensure_password(modals: &modals::Modals, pddb_os: &mut PddbOs, _pw_cid: xous:
1965
1927
fn try_mount_or_format ( modals : & modals:: Modals , pddb_os : & mut PddbOs , basis_cache : & mut BasisCache , pw_state : PasswordState , time_resetter : xous:: CID ) -> bool {
1966
1928
log:: info!( "Attempting to mount the PDDB" ) ;
1967
1929
if pw_state == PasswordState :: Correct {
1930
+ modals. dynamic_notification ( Some ( t ! ( "pddb.waitmount" , xous:: LANG ) ) , None ) . unwrap ( ) ;
1968
1931
if let Some ( sys_basis) = pddb_os. pddb_mount ( ) {
1969
1932
log:: info!( "PDDB mount operation finished successfully" ) ;
1970
1933
basis_cache. basis_add ( sys_basis) ;
1934
+ modals. dynamic_notification_close ( ) . unwrap ( ) ;
1971
1935
return true
1972
1936
}
1937
+ modals. dynamic_notification_close ( ) . unwrap ( ) ;
1973
1938
}
1974
1939
// correct password but no mount -> offer to format; uninit -> offer to format
1975
1940
if pw_state == PasswordState :: Correct || pw_state == PasswordState :: Uninit {
@@ -2026,12 +1991,14 @@ fn try_mount_or_format(modals: &modals::Modals, pddb_os: &mut PddbOs, basis_cach
2026
1991
0 , 0 , 0 , 0
2027
1992
)
2028
1993
) . expect ( "couldn't reset time" ) ;
2029
-
1994
+ modals . dynamic_notification ( Some ( t ! ( "pddb.waitmount" , xous :: LANG ) ) , None ) . unwrap ( ) ;
2030
1995
if let Some ( sys_basis) = pddb_os. pddb_mount ( ) {
2031
1996
log:: info!( "PDDB mount operation finished successfully" ) ;
2032
1997
basis_cache. basis_add ( sys_basis) ;
1998
+ modals. dynamic_notification_close ( ) . unwrap ( ) ;
2033
1999
true
2034
2000
} else {
2001
+ modals. dynamic_notification_close ( ) . unwrap ( ) ;
2035
2002
log:: error!( "Despite formatting, no PDDB was found!" ) ;
2036
2003
let mut err = String :: from ( t ! ( "pddb.internalerror" , xous:: LANG ) ) ;
2037
2004
err. push_str ( " #1" ) ; // punt and leave an error code, because this "should" be rare
0 commit comments