}
static int
-kwboot_xm_recv_reply(int fd, char *c, int allow_non_xm, int *non_xm_print,
+kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm,
+ int allow_non_xm, int *non_xm_print,
int baudrate, int *baud_changed)
{
int timeout = allow_non_xm ? KWBOOT_HDR_RSP_TIMEO : blk_rsp_timeo;
*non_xm_print = 1;
}
} else {
+ if (nak_on_non_xm) {
+ *c = NAK;
+ break;
+ }
timeout = recv_until - _now();
if (timeout < 0) {
errno = ETIMEDOUT;
*done_print = 1;
}
- rc = kwboot_xm_recv_reply(fd, &c, allow_non_xm, &non_xm_print,
+ rc = kwboot_xm_recv_reply(fd, &c, retries < 3,
+ allow_non_xm, &non_xm_print,
baudrate, &baud_changed);
if (rc)
goto can;
if (rc)
return rc;
- rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL);
+ rc = kwboot_xm_recv_reply(fd, &c, retries < 3,
+ 0, NULL, 0, NULL);
if (rc)
return rc;
} while (c == NAK && retries++ < 16);