mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-27 12:20:54 +00:00
ymodem:fix bug,When sending a retransmission, HEAD is overwritten.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
7dd4b28950
commit
95368deae2
1 changed files with 5 additions and 4 deletions
|
|
@ -307,24 +307,25 @@ cancel:
|
|||
|
||||
static int ymodem_recv_cmd(FAR struct ymodem_ctx_s *ctx, uint8_t cmd)
|
||||
{
|
||||
uint8_t recv;
|
||||
int ret;
|
||||
|
||||
ret = ymodem_recv_buffer(ctx, ctx->header, 1);
|
||||
ret = ymodem_recv_buffer(ctx, &recv, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
ymodem_debug("recv cmd error\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ctx->header[0] == NAK)
|
||||
if (recv == NAK)
|
||||
{
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (ctx->header[0] != cmd)
|
||||
if (recv != cmd)
|
||||
{
|
||||
ymodem_debug("recv cmd error, must 0x%x, but receive 0x%x\n",
|
||||
cmd, ctx->header[0]);
|
||||
cmd, recv);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue