From f5d9276434c1ab7d16bab8e22d5908a126477240 Mon Sep 17 00:00:00 2001 From: chenyong <1521761801@qq.com> Date: Fri, 3 Aug 2018 16:11:31 +0800 Subject: [PATCH 1/2] [net][at] Add AT serial device receive data length judgment. --- components/net/at/src/at_client.c | 6 +++++- components/net/at/src/at_server.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index c2002d8094..dd866fdcb0 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -577,7 +577,11 @@ static void client_parser(at_client_t client) static rt_err_t at_client_rx_ind(rt_device_t dev, rt_size_t size) { - rt_sem_release(at_client_local->rx_notice); + if (size > 0) + { + rt_sem_release(at_client_local->rx_notice); + } + return RT_EOK; } diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index 639739d9c2..a148a20ab0 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -433,7 +433,10 @@ __retry: static rt_err_t at_rx_ind(rt_device_t dev, rt_size_t size) { - rt_sem_release(at_server_local->rx_notice); + if (size > 0) + { + rt_sem_release(at_server_local->rx_notice); + } return RT_EOK; } From 2e8d994485552ae143841569c3444bb65db55cdf Mon Sep 17 00:00:00 2001 From: chenyong <1521761801@qq.com> Date: Fri, 3 Aug 2018 19:07:28 +0800 Subject: [PATCH 2/2] [net][at] Modify the AT commands response ERROR judgment method. --- components/net/at/include/at.h | 2 +- components/net/at/src/at_client.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 76e952944f..782cb0c400 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -27,7 +27,7 @@ #include -#define AT_SW_VERSION "0.2.2" +#define AT_SW_VERSION "0.2.3" #define DBG_ENABLE #define DBG_SECTION_NAME "AT" diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index dd866fdcb0..90fd3291c3 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -547,7 +547,7 @@ static void client_parser(at_client_t client) /* get the end data by response result, return response state END_OK. */ client->resp_status = AT_RESP_OK; } - else if ((memcmp(client->recv_buffer, AT_RESP_END_ERROR, strlen(AT_RESP_END_ERROR)) == 0) + else if (strstr(client->recv_buffer, AT_RESP_END_ERROR) || (memcmp(client->recv_buffer, AT_RESP_END_FAIL, strlen(AT_RESP_END_FAIL)) == 0)) { client->resp_status = AT_RESP_ERROR;