From 127963e3512d737aecbb6622138f4facd315a112 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Tue, 12 Feb 2019 13:36:40 +0900 Subject: [PATCH] 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 --- src/dfu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- 2.7.4