diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2016-09-28 20:50:12 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-10-04 21:14:19 +0200 |
commit | 446ff0216e8df126b6bd5c284c1ba930fd8bb0ea (patch) | |
tree | 3aa158038bc38e8d45cc3c7a49b0e7392a1986c8 /scripts/kwboot.c | |
parent | 331391d686ad87915a69a686220f01a20a7fd8e1 (diff) | |
download | barebox-446ff0216e8df126b6bd5c284c1ba930fd8bb0ea.tar.gz barebox-446ff0216e8df126b6bd5c284c1ba930fd8bb0ea.tar.xz |
scripts: kwboot: flush input and output only once
When flushing input before sending of a boot message the acknowledging
reply for the previous message from the CPU might be discarded and so
missed.
So only flush once before sending boot messages in a loop.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/kwboot.c')
-rw-r--r-- | scripts/kwboot.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/kwboot.c b/scripts/kwboot.c index 9d680dc576..9dfaf4a8df 100644 --- a/scripts/kwboot.c +++ b/scripts/kwboot.c @@ -273,11 +273,11 @@ kwboot_bootmsg(int tty, void *msg) else kwboot_printv("Sending boot message. Please reboot the target..."); - do { - rc = tcflush(tty, TCIOFLUSH); - if (rc) - break; + rc = tcflush(tty, TCIOFLUSH); + if (rc) + return rc; + do { rc = kwboot_tty_send(tty, msg, 8); if (rc) { usleep(KWBOOT_MSG_REQ_DELAY * 1000); @@ -302,13 +302,13 @@ kwboot_debugmsg(int tty, void *msg) kwboot_printv("Sending debug message. Please reboot the target..."); + rc = tcflush(tty, TCIOFLUSH); + if (rc) + return rc; + do { char buf[16]; - rc = tcflush(tty, TCIOFLUSH); - if (rc) - break; - rc = kwboot_tty_send(tty, msg, 8); if (rc) { usleep(KWBOOT_MSG_REQ_DELAY * 1000); |