5151static bool quit ;
5252static bool fastboot_repeat ;
5353static bool fastboot_done ;
54+ static bool fastboot_continue ;
5455
5556static int status_fd = -1 ;
5657
@@ -340,6 +341,22 @@ static void request_power_off(void)
340341 list_add (& work_items , & work .node );
341342}
342343
344+ static void request_fastboot_continue_fn (struct work * work , int ssh_stdin )
345+ {
346+ int ret ;
347+
348+ ret = cdba_send (ssh_stdin , MSG_FASTBOOT_CONTINUE );
349+ if (ret < 0 )
350+ err (1 , "failed to send fastboot continue request" );
351+ }
352+
353+ static void request_fastboot_continue (void )
354+ {
355+ static struct work work = { request_fastboot_continue_fn };
356+
357+ list_add (& work_items , & work .node );
358+ }
359+
343360struct fastboot_download_work {
344361 struct work work ;
345362
@@ -532,10 +549,14 @@ static int handle_message(struct circ_buf *buf)
532549 case MSG_FASTBOOT_PRESENT :
533550 if (* (uint8_t * )msg -> data ) {
534551 // printf("======================================== MSG_FASTBOOT_PRESENT(on)\n");
535- if (!fastboot_done || fastboot_repeat )
552+ if (fastboot_continue ) {
553+ request_fastboot_continue ();
554+ fastboot_continue = false;
555+ } else if (!fastboot_done || fastboot_repeat ) {
536556 request_fastboot_files ();
537- else
557+ } else {
538558 quit = true;
559+ }
539560 } else {
540561 fastboot_done = true;
541562 // printf("======================================== MSG_FASTBOOT_PRESENT(off)\n");
@@ -557,6 +578,9 @@ static int handle_message(struct circ_buf *buf)
557578 handle_board_info (msg -> data , msg -> len );
558579 return -1 ;
559580 break ;
581+ case MSG_FASTBOOT_CONTINUE :
582+ // printf("======================================== MSG_FASTBOOT_CONTINUE\n");
583+ break ;
560584 default :
561585 fprintf (stderr , "unk %d len %d\n" , msg -> type , msg -> len );
562586 return -1 ;
@@ -585,7 +609,7 @@ static void usage(void)
585609 extern const char * __progname ;
586610
587611 fprintf (stderr , "usage: %s -b <board> -h <host> [-t <timeout>] "
588- "[-T <inactivity-timeout>] boot.img\n" ,
612+ "[-T <inactivity-timeout>] < boot.img> \n" ,
589613 __progname );
590614 fprintf (stderr , "usage: %s -i -b <board> -h <host>\n" ,
591615 __progname );
@@ -673,13 +697,15 @@ int main(int argc, char **argv)
673697
674698 switch (verb ) {
675699 case CDBA_BOOT :
676- if (optind >= argc || !board )
700+ if (optind > argc || !board )
677701 usage ();
678702
679703 fastboot_file = argv [optind ];
680- if (lstat (fastboot_file , & sb ))
704+ if (!fastboot_file )
705+ fastboot_continue = true;
706+ else if (lstat (fastboot_file , & sb ))
681707 err (1 , "unable to read \"%s\"" , fastboot_file );
682- if (!S_ISREG (sb .st_mode ) && !S_ISLNK (sb .st_mode ))
708+ else if (!S_ISREG (sb .st_mode ) && !S_ISLNK (sb .st_mode ))
683709 errx (1 , "\"%s\" is not a regular file" , fastboot_file );
684710
685711 request_select_board (board );
0 commit comments