From: Dongwoo Lee Date: Tue, 12 Feb 2019 04:36:40 +0000 (+0900) Subject: Print out progress status X-Git-Tag: submit/tizen/20190222.054942~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F200103%2F3;p=platform%2Fcore%2Fsystem%2Finitrd-flash.git Print out progress status To print out the information about transfer progress and synchronization state, the additional messages will be added. Change-Id: I931700c5c9bc88267d656d2ac02b111f1275fa29 Signed-off-by: Dongwoo Lee --- diff --git a/src/dfu.c b/src/dfu.c index beb7aca..f761572 100644 --- a/src/dfu.c +++ b/src/dfu.c @@ -273,6 +273,7 @@ int dfu_start(struct tfm_context *ctx, const char *entity) } fprintf(stdout, "Start download: %s...", entity); + fflush(stdout); return 0; } @@ -325,12 +326,15 @@ static void *dfu_thread_main(void *ptr) ret = write(ctx->dfu_fd, frame->buf, frame->len); if (ret < frame->len) { - fprintf(stdout, "Error occurs while flashing\n"); + fprintf(stderr, "Error occurs while flashing\n"); state = DFU_THREAD_STATE_ERROR; } progress += frame->len; + fprintf(stdout, "#"); + fflush(stdout); + dfu_put_buffer(frame->buf); free(frame); @@ -339,6 +343,9 @@ static void *dfu_thread_main(void *ptr) progress = 0; ctx->transfer_done = 1; + fprintf(stdout, "\nTransfer completed. Please wait for sync..."); + fflush(stdout); + state = DFU_THREAD_STATE_IDLE; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);