Ignore any scanning happen from supplicant, this usually happen
when supplicant start association steps which include scanning,
In this step we don't want to update network list or run
auto connect after scan since we are already in process of
connection.
---
include/device.h | 2 ++
plugins/wifi.c | 28 ++++++++++++++++++++++++++--
src/device.c | 6 ++++++
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/include/device.h b/include/device.h
index c5e005d..c166a46 100644
--- a/include/device.h
+++ b/include/device.h
@@ -73,6 +73,8 @@ int connman_device_set_powered(struct connman_device *device,
int connman_device_set_scanning(struct connman_device *device,
connman_bool_t scanning);
+void connman_device_reset_scanning(struct connman_device *device);
+
int connman_device_set_disconnected(struct connman_device *device,
connman_bool_t disconnected);
connman_bool_t connman_device_get_disconnected(struct connman_device *device);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 515dd15..4902b71 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -63,6 +63,7 @@ struct wifi_data {
GSupplicantInterface *interface;
connman_bool_t connected;
connman_bool_t disconnecting;
+ connman_bool_t scan_requested;
int index;
unsigned flags;
unsigned int watch;
@@ -165,6 +166,8 @@ static void wifi_remove(struct connman_device *device)
DBG("device %p", device);
+ wifi->scan_requested = FALSE;
+
if (wifi->pending_network != NULL) {
connman_network_unref(wifi->pending_network);
wifi->pending_network = NULL;
@@ -232,6 +235,7 @@ static int wifi_disable(struct connman_device *device)
wifi->connected = FALSE;
wifi->disconnecting = FALSE;
+ wifi->scan_requested = FALSE;
if (wifi->pending_network != NULL) {
connman_network_unref(wifi->pending_network);
@@ -247,20 +251,40 @@ static void scan_callback(int result,
GSupplicantInterface *interface,
void *user_data)
{
struct connman_device *device = user_data;
+ struct wifi_data *wifi = connman_device_get_data(device);
DBG("result %d", result);
- connman_device_set_scanning(device, FALSE);
+ if (wifi == NULL)
+ return;
+
+ if (result < 0) {
+ wifi->scan_requested = FALSE;
+ connman_device_reset_scanning(device);
+ return;
+ }
+
+ if (wifi->scan_requested == TRUE)
+ connman_device_set_scanning(device, FALSE);
+
+ wifi->scan_requested = FALSE;
}
static int wifi_scan(struct connman_device *device)
{
struct wifi_data *wifi = connman_device_get_data(device);
+ int err;
DBG("device %p %p", device, wifi->interface);
- return g_supplicant_interface_scan(wifi->interface, scan_callback,
+ wifi->scan_requested = TRUE;
+
+ err = g_supplicant_interface_scan(wifi->interface, scan_callback,
device);
+ if (err < 0)
+ wifi->scan_requested = FALSE;
+
+ return err;
}
static struct connman_device_driver wifi_ng_driver = {
diff --git a/src/device.c b/src/device.c
index c2a0c7b..5bb64d2 100644
--- a/src/device.c
+++ b/src/device.c
@@ -859,6 +859,12 @@ int connman_device_set_scanning(struct connman_device
*device,
return 0;
}
+void connman_device_reset_scanning(struct connman_device *device)
+{
+
+ device->scanning = FALSE;
+}
+
/**
* connman_device_set_disconnected:
* @device: device structure
--
1.7.3.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman