tools: kwboot: Resend first 3 xmodem retry packets immediately
authorPali Rohár <pali@kernel.org>
Mon, 25 Oct 2021 13:13:04 +0000 (15:13 +0200)
committerStefan Roese <sr@denx.de>
Wed, 3 Nov 2021 05:45:27 +0000 (06:45 +0100)
commita6fcac274a99c9675f4b6841321e085c79326429
tree60146f484fccfef7fffe97b0d08a3a38ee8f73c4
parentd14a342073ca7ed108ca1c2477e102da431a527c
tools: kwboot: Resend first 3 xmodem retry packets immediately

Currently when kwboot receive some garbage reply which does not understand,
it waits 1s before it tries to resend packet again.

The most common error on UART is that receiver sees some bit flipped which
results in invalid reply.

This behavior slows down xmodem transfer over UART as basically on every
error kwboot is waiting one second.

To fix this, try to resend xmodem packet for first 3 attempts immediately
without any delay. If broken reply is received also after the 3 attempts,
continue retrying with 1s delay like it was before.

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