From 27b7e0d929642b883c1ed7884162f822f359c9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=85=89=E4=BC=9F?= Date: Thu, 26 Dec 2019 00:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9C=A8=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=AD=97=E8=8A=82=E4=B8=BA0=E4=B8=8ERESET?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E9=87=8F=E4=B9=8B=E9=97=B4=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=AD=A4=E6=AC=A1=E6=95=B0=E6=8D=AE=E6=97=A0=E6=B3=95=E8=A2=AB?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RGW --- components/net/at/src/at_client.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index ba4009738d..9dd731535a 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -434,18 +434,20 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo { rt_err_t result = RT_EOK; - while (rt_device_read(client->device, 0, ch, 1) == 0) +__retry: + result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); + if (result != RT_EOK) { - rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL); - - result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); - if (result != RT_EOK) - { - return result; - } + return result; + } + if(rt_device_read(client->device, 0, ch, 1) == 1) + { + return RT_EOK; + } + else + { + goto __retry; } - - return RT_EOK; } /**