From: Pali Rohár <pali@kernel.org>
Date: Tue, 25 Jan 2022 17:13:01 +0000 (+0100)
Subject: tools: kwboot: Wait blk_rsp_timeo when flushing
X-Git-Tag: v2025.01-rc5-pxa1908~1557^2~13
X-Git-Url: http://git.dujemihanovic.xyz/posts?a=commitdiff_plain;h=8bd15fd1146e13bba4b6d0166e5db4ce10ecf59d;p=u-boot.git

tools: kwboot: Wait blk_rsp_timeo when flushing

Use the blk_rsp_timeo variable when sleeping before flushing tty.

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>
---

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 82cfd9a827..1477c0f078 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1081,8 +1081,8 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate)
 	 */
 	hdrsz += (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) % KWBOOT_XM_BLKSZ;
 
-	kwboot_printv("Waiting 2s and flushing tty\n");
-	sleep(2); /* flush isn't effective without it */
+	kwboot_printv("Waiting %d ms and flushing tty\n", blk_rsp_timeo);
+	usleep(blk_rsp_timeo * 1000);
 	tcflush(tty, TCIOFLUSH);
 
 	pnum = 1;