4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-18 19:19:18 +08:00

Revert "fix the bug that rx_notice out of sync when data received after last rt_device_read() is zero"

This commit is contained in:
Wayne 2021-02-04 22:53:58 +08:00 committed by GitHub
parent d514fea54a
commit a50d81827a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -434,20 +434,18 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo
{ {
rt_err_t result = RT_EOK; rt_err_t result = RT_EOK;
__retry: while (rt_device_read(client->device, 0, ch, 1) == 0)
result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout));
if (result != RT_EOK)
{ {
return result; rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL);
}
if(rt_device_read(client->device, 0, ch, 1) == 1) result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout));
{ if (result != RT_EOK)
return RT_EOK; {
} return result;
else }
{
goto __retry;
} }
return RT_EOK;
} }
/** /**