@@ -67,7 +67,7 @@ use std::alloc::System;
67
67
#[ global_allocator]
68
68
static GLOBAL : Allocator < System > = Allocator :: system ( ) ;
69
69
#[ cfg( feature="tracking-alloc" ) ]
70
- use core:: sync:: atomic:: { AtomicIsize , Ordering } ;
70
+ use core:: sync:: atomic:: AtomicIsize ;
71
71
#[ cfg( feature="tracking-alloc" ) ]
72
72
struct StdoutTracker {
73
73
pub total : AtomicIsize ,
@@ -308,7 +308,6 @@ impl Repl{
308
308
write ! ( init_tv. text, "{}" , t!( "shellchat.bootwait" , xous:: LANG ) ) . ok ( ) ;
309
309
self . gam . post_textview ( & mut init_tv) . expect ( "couldn't render wait text" ) ;
310
310
self . gam . redraw ( ) . expect ( "couldn't redraw screen" ) ;
311
- return Ok ( ( ) )
312
311
}
313
312
314
313
// this defines the bottom border of the text bubbles as they stack up wards
@@ -417,54 +416,17 @@ fn wrapped_main() -> ! {
417
416
418
417
let mut allow_redraw = true ;
419
418
let pddb_init_done = Arc :: new ( AtomicBool :: new ( false ) ) ;
420
-
421
- // spawn a thread to auto-mount the PDDB. It's important that this spawn happens after
422
- // our GAM context has been registered (which happened in the `Repl::new()` call above)
423
- repl. redraw ( false ) . ok ( ) ;
424
- let _ = thread:: spawn ( {
419
+ repl. redraw ( pddb_init_done. load ( Ordering :: SeqCst ) ) . ok ( ) ;
420
+ thread:: spawn ( {
425
421
let pddb_init_done = pddb_init_done. clone ( ) ;
426
422
let main_conn = xous:: connect ( shch_sid) . unwrap ( ) ;
427
423
move || {
428
- let tt = ticktimer_server:: Ticktimer :: new ( ) . unwrap ( ) ;
429
- let xns = xous_names:: XousNames :: new ( ) . unwrap ( ) ;
430
- let gam = gam:: Gam :: new ( & xns) . unwrap ( ) ;
431
- while !gam. trusted_init_done ( ) . unwrap ( ) {
432
- tt. sleep_ms ( 50 ) . ok ( ) ;
433
- }
434
- loop {
435
- // Force the "please wait" message to disappear *prior* to the context switch out to the PDDB login box
436
- // this is necessary because if the mounting process is extremely fast, the subsequent redraw message
437
- // to clear the please wait message will get missed on the return.
438
- xous:: send_message ( main_conn,
439
- xous:: Message :: new_blocking_scalar ( ShellOpcode :: ForceRedraw . to_usize ( ) . unwrap ( ) , 0 , 0 , 0 , 0 )
440
- ) . ok ( ) ;
441
- let ( no_retry_failure, count) = pddb:: Pddb :: new ( ) . try_mount ( ) ;
442
- pddb_init_done. store ( true , Ordering :: SeqCst ) ;
443
- if no_retry_failure {
444
- // this includes both successfully mounted, and user abort of mount attempt
445
- break ;
446
- } else {
447
- // this indicates system was guttered due to a retry failure
448
- let xns = xous_names:: XousNames :: new ( ) . unwrap ( ) ;
449
- let susres = susres:: Susres :: new_without_hook ( & xns) . unwrap ( ) ;
450
- let llio = llio:: Llio :: new ( & xns) ;
451
- if ( ( llio. adc_vbus ( ) . unwrap ( ) as u32 ) * 503 ) < 150_000 {
452
- // try to force suspend if possible, so that users who are just playing around with
453
- // the device don't run the battery down accidentally.
454
- susres. initiate_suspend ( ) . ok ( ) ;
455
- tt. sleep_ms ( 1000 ) . unwrap ( ) ;
456
- let modals = modals:: Modals :: new ( & xns) . unwrap ( ) ;
457
- modals. show_notification (
458
- & t ! ( "login.fail" , xous:: LANG ) . replace ( "{fails}" , & count. to_string ( ) ) ,
459
- None
460
- ) . ok ( ) ;
461
- } else {
462
- // otherwise force a reboot cycle to slow down guessers
463
- susres. reboot ( true ) . expect ( "Couldn't reboot after too many failed password attempts" ) ;
464
- tt. sleep_ms ( 5000 ) . unwrap ( ) ;
465
- }
466
- }
467
- }
424
+ let pddb = pddb:: Pddb :: new ( ) ;
425
+ pddb. mount_attempted_blocking ( ) ;
426
+ pddb_init_done. store ( true , Ordering :: SeqCst ) ;
427
+ xous:: send_message ( main_conn,
428
+ xous:: Message :: new_scalar ( ShellOpcode :: Redraw . to_usize ( ) . unwrap ( ) , 0 , 0 , 0 , 0 )
429
+ ) . ok ( ) ;
468
430
}
469
431
} ) ;
470
432
0 commit comments