]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_gui: Show entire list of networks
authorVictor Ananyev <vindex10@gmail.com>
Wed, 18 Sep 2019 22:12:23 +0000 (00:12 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Dec 2019 22:16:38 +0000 (00:16 +0200)
Use LAST_ID of LIST_NETWORKS to load all the network entries iteratively
if there is large enough number of networks to not fit in a single
response.

Signed-off-by: Victor Ananyev <vindex10@gmail.com>
wpa_supplicant/wpa_gui-qt4/wpagui.cpp

index a0aa05ed37362175b825e857e267ace4084133e7..9404ab4249b786c921841e29aaa897c11fe5edb0 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <cstdio>
 #include <unistd.h>
+#include <chrono>
+#include <thread>
 #include <QMessageBox>
 #include <QCloseEvent>
 #include <QImageReader>
@@ -713,9 +715,22 @@ void WpaGui::updateNetworks()
                           strstr(flags, "[DISABLED]") == NULL)
                        first_active = networkSelect->count() - 1;
 
-               if (last)
-                       break;
                start = end + 1;
+               if (*start && strchr(start, '\n'))
+                       continue;
+
+               /* avoid race conditions */
+               std::this_thread::sleep_for(std::chrono::milliseconds(200));
+               QString cmd("LIST_NETWORKS LAST_ID=");
+               cmd.append(id);
+               if (ctrlRequest(cmd.toLocal8Bit().constData(), buf, &len) < 0)
+                       break;
+
+               buf[len] = '\0';
+               start = strchr(buf, '\n');
+               if (!start)
+                       break;
+               start++;
        }
 
        if (networkSelect->count() > 1)