summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
authorEvlers <[email protected]>2024-03-24 12:39:36 +0800
committerMeco Man <[email protected]>2024-03-24 14:35:41 -0400
commitdca8a06471de99affce915f270b211f954035044 (patch)
treecea30b2b2951492cb51db1a15ca40066a63c4ff0 /components/drivers
parent3a65967a408a24cb46668895c958da20af3453a6 (diff)
[wlan][cmd] fixed a duplicate issue with the wifi scan command
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/wlan/wlan_cmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/components/drivers/wlan/wlan_cmd.c b/components/drivers/wlan/wlan_cmd.c
index fe5910b242..b50261d42a 100644
--- a/components/drivers/wlan/wlan_cmd.c
+++ b/components/drivers/wlan/wlan_cmd.c
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2018-08-13 tyx the first version
+ * 2024-03-24 Evlers fixed a duplicate issue with the wifi scan command
*/
#include <rtthread.h>
@@ -388,6 +389,7 @@ static void user_ap_info_callback(int event, struct rt_wlan_buff *buff, void *pa
struct rt_wlan_info *info = RT_NULL;
int index = 0;
int ret = RT_EOK;
+ rt_uint32_t last_num = scan_result.num;
RT_ASSERT(event == RT_WLAN_EVT_SCAN_REPORT);
RT_ASSERT(buff != RT_NULL);
@@ -404,8 +406,12 @@ static void user_ap_info_callback(int event, struct rt_wlan_buff *buff, void *pa
scan_filter->ssid.len == info->ssid.len &&
rt_memcmp(&scan_filter->ssid.val[0], &info->ssid.val[0], scan_filter->ssid.len) == 0))
{
- /*Print the info*/
- print_ap_info(info,index);
+ /*Check whether a new ap is added*/
+ if (last_num < scan_result.num)
+ {
+ /*Print the info*/
+ print_ap_info(info,index);
+ }
index++;
*((int *)(parameter)) = index;