[LEDE-DEV] [PATCH] iwinfo get scan results from wpa_supplicant in station mode. wpa_supplicant return some other info before return results. Loop recv until get real scan results.

Adams ycsunjane at gmail.com
Thu May 11 22:40:20 PDT 2017


---
 .../utils/iwinfo/patches/002-wds-scan.patch        |   26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 package/network/utils/iwinfo/patches/002-wds-scan.patch

diff --git a/package/network/utils/iwinfo/patches/002-wds-scan.patch b/package/network/utils/iwinfo/patches/002-wds-scan.patch
new file mode 100644
index 0000000..46d7a61
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/002-wds-scan.patch
@@ -0,0 +1,26 @@
+Index: libiwinfo-2016-09-21-fd9e17be/iwinfo_nl80211.c
+===================================================================
+--- libiwinfo-2016-09-21-fd9e17be.orig/iwinfo_nl80211.c	2017-05-12 09:15:36.572930342 +0800
++++ libiwinfo-2016-09-21-fd9e17be/iwinfo_nl80211.c	2017-05-12 09:19:58.311845210 +0800
+@@ -2241,6 +2241,12 @@
+ 	/* receive and parse scan results if the wait above didn't time out */
+ 	if (ready && nl80211_wpactl_recv(sock, reply, sizeof(reply)) > 0)
+ 	{
++
++		while(!strstr(reply, "bssid")) {
++			if(nl80211_wpactl_recv(sock, reply, sizeof(reply)) <= 0)
++				goto end;
++		}
++
+ 		nl80211_get_quality_max(ifname, &qmax);
+ 
+ 		for (line = strtok_r(reply, "\n", &pos);
+@@ -2319,7 +2325,7 @@
+ 
+ 		*len = count * sizeof(struct iwinfo_scanlist_entry);
+ 	}
+-
++end:
+ 	close(sock);
+ 	unlink(local.sun_path);
+ 
-- 
1.7.9.5




More information about the Lede-dev mailing list