9
0
Fork 0

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>
This commit is contained in:
Uwe Kleine-König 2016-09-28 20:50:12 +02:00 committed by Sascha Hauer
parent 331391d686
commit 446ff0216e
1 changed files with 8 additions and 8 deletions

View File

@ -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);