tools: kwboot: Show 'E' in progress output when error occurs
authorPali Rohár <pali@kernel.org>
Tue, 25 Jan 2022 17:13:06 +0000 (18:13 +0100)
committerStefan Roese <sr@denx.de>
Mon, 31 Jan 2022 09:23:38 +0000 (10:23 +0100)
When kwboot is unable to resend current xmodem packet, show an 'E' in the
progress output instead of a '+'. This allows to distinguish between the
state when kwboot is retrying sending the packet and when retry is not
possible.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c

index dfac8ae..1dcec19 100644 (file)
@@ -975,8 +975,12 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
                if (rc)
                        goto err;
 
-               if (!allow_non_xm && c != ACK)
-                       kwboot_progress(-1, '+');
+               if (!allow_non_xm && c != ACK) {
+                       if (c == NAK && allow_retries && retries + 1 < 16)
+                               kwboot_progress(-1, '+');
+                       else
+                               kwboot_progress(-1, 'E');
+               }
        } while (c == NAK && allow_retries && retries++ < 16);
 
        if (non_xm_print)