diff mbox series

[u-boot-marvell,07/14] tools: kwboot: Show 'E' in progress output when error occurs

Message ID 20220125171313.14498-8-kabel@kernel.org
State Accepted
Commit 5d8aa4c92b86dcdbdb7c9fcf12e6c93c87e16555
Delegated to: Stefan Roese
Headers show
Series Another set of kwboot improvements | expand

Commit Message

Marek Behún Jan. 25, 2022, 5:13 p.m. UTC
From: Pali Rohár <pali@kernel.org>

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>
---
 tools/kwboot.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Stefan Roese Jan. 26, 2022, 3:39 p.m. UTC | #1
On 1/25/22 18:13, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> 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>

Thanks,
Stefan


> ---
>   tools/kwboot.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index dfac8aed7b..1dcec1969a 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -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)

Viele Grüße,
Stefan Roese
diff mbox series

Patch

diff --git a/tools/kwboot.c b/tools/kwboot.c
index dfac8aed7b..1dcec1969a 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -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)