@@ -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 ;
397
+ use std:: sync:: { Arc , Mutex } ;
398
398
399
399
use locales:: t;
400
400
@@ -490,6 +490,34 @@ 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
+
493
521
// OS-specific PDDB driver
494
522
let mut pddb_os = PddbOs :: new ( Rc :: clone ( & entropy) , pw_cid) ;
495
523
// storage for the basis cache
@@ -656,6 +684,8 @@ fn wrapped_main() -> ! {
656
684
// - code = 2 -> mount failed, because too many PINs were retried. `count` is the number of retries.
657
685
// If we need more nuance out of this routine, consider creating a custom public enum type to help marshall this.
658
686
Opcode :: TryMount => xous:: msg_blocking_scalar_unpack!( msg, _, _, _, _, {
687
+ * hide_startingup_notif. lock( ) . unwrap( ) = true ;
688
+
659
689
if basis_cache. basis_count( ) > 0 {
660
690
xous:: return_scalar2( msg. sender, 0 , 0 ) . expect( "couldn't return scalar" ) ;
661
691
} else {
@@ -669,6 +699,8 @@ fn wrapped_main() -> ! {
669
699
} else {
670
700
match ensure_password( & modals, & mut pddb_os, pw_cid) {
671
701
PasswordState :: Correct => {
702
+ modals. dynamic_notification( Some ( "Starting up..." ) , Some ( "Mounting PDDB, please wait." ) ) . unwrap( ) ;
703
+
672
704
if try_mount_or_format( & modals, & mut pddb_os, & mut basis_cache, PasswordState :: Correct , time_resetter) {
673
705
is_mounted. store( true , Ordering :: SeqCst ) ;
674
706
for requester in mount_notifications. drain( ..) {
@@ -680,8 +712,12 @@ fn wrapped_main() -> ! {
680
712
} else {
681
713
xous:: return_scalar2( msg. sender, 1 , 0 ) . expect( "couldn't return scalar" ) ;
682
714
}
715
+
716
+ modals. dynamic_notification_close( ) . unwrap( ) ;
683
717
} ,
684
718
PasswordState :: Uninit => {
719
+ modals. dynamic_notification( Some ( "Starting up..." ) , Some ( "Mounting PDDB, please wait." ) ) . unwrap( ) ;
720
+
685
721
if try_mount_or_format( & modals, & mut pddb_os, & mut basis_cache, PasswordState :: Uninit , time_resetter) {
686
722
for requester in mount_notifications. drain( ..) {
687
723
xous:: return_scalar2( requester, 0 , 0 ) . expect( "couldn't return scalar" ) ;
@@ -693,6 +729,8 @@ fn wrapped_main() -> ! {
693
729
} else {
694
730
xous:: return_scalar2( msg. sender, 1 , 0 ) . expect( "couldn't return scalar" ) ;
695
731
}
732
+
733
+ modals. dynamic_notification_close( ) . unwrap( ) ;
696
734
} ,
697
735
PasswordState :: ForcedAbort ( failcount) => {
698
736
xous:: return_scalar2( msg. sender, 2 ,
0 commit comments