summaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-10-27 20:56:58 +0200
committerStefan Roese <sr@denx.de>2021-11-03 06:45:27 +0100
commit455c0d22fb084550ecc6aaf810a9c7b684b2dee0 (patch)
tree6b1586a3d021aa897e859180bad37c14ca813826 /tools/kwboot.c
parenta6fcac274a99c9675f4b6841321e085c79326429 (diff)
downloadu-boot-455c0d22fb084550ecc6aaf810a9c7b684b2dee0.tar.gz
u-boot-455c0d22fb084550ecc6aaf810a9c7b684b2dee0.tar.bz2
u-boot-455c0d22fb084550ecc6aaf810a9c7b684b2dee0.zip
tools: kwboot: Fix sending retry of last header packet
After the trasfer of last header packet, it is possible that baudrate change pattern is received, and also that NAK byte is received so that the packet should be sent again. Thus we should not clear the baudrate change state when sending retry of that packet. Move code for initializing state variables from kwboot_xm_recv_reply() to kwboot_xm_sendblock(). 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>
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index bb7cae9f05..b2c48812c3 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -859,11 +859,6 @@ kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm,
uint64_t recv_until = _now() + timeout;
int rc;
- if (non_xm_print)
- *non_xm_print = 0;
- if (baud_changed)
- *baud_changed = 0;
-
while (1) {
rc = kwboot_tty_recv(fd, c, 1, timeout);
if (rc) {
@@ -929,6 +924,8 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
char c;
*done_print = 0;
+ non_xm_print = 0;
+ baud_changed = 0;
retries = 0;
do {