Print out progress status 03/200103/3
authorDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 12 Feb 2019 04:36:40 +0000 (13:36 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 20 Feb 2019 00:52:00 +0000 (00:52 +0000)
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 <dwoo08.lee@samsung.com>
src/dfu.c

index beb7aca..f761572 100644 (file)
--- 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);