From: Mohamed Abbas <mohamed.ab...@intel.com>

Allow multi scan type for fast connect.

Scanning request removed from interface_added() because it is already
called in connman_device_set_powered() so no need to call it again
immediately (fix by Jukka Rissanen <jukka.rissa...@linux.intel.com>)
---
 include/device.h |    1 +
 plugins/wifi.c   |   21 +++++++++++++++++++--
 src/device.c     |    4 +++-
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/include/device.h b/include/device.h
index d4f54ec..3749a20 100644
--- a/include/device.h
+++ b/include/device.h
@@ -108,6 +108,7 @@ struct connman_device_driver {
        int (*enable) (struct connman_device *device);
        int (*disable) (struct connman_device *device);
        int (*scan) (struct connman_device *device);
+       int (*scan_fast) (struct connman_device *device);
 };
 
 int connman_device_driver_register(struct connman_device_driver *driver);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index e1aecab..03d94ee 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -298,6 +298,24 @@ static int wifi_scan(struct connman_device *device)
        return ret;
 }
 
+static int wifi_scan_fast(struct connman_device *device)
+{
+       struct wifi_data *wifi = connman_device_get_data(device);
+       int ret;
+
+       DBG("device %p %p", device, wifi->interface);
+
+       if (wifi->tethering == TRUE)
+               return 0;
+
+       ret = g_supplicant_interface_scan(wifi->interface, scan_callback,
+                                                                       device);
+       if (ret == 0)
+               connman_device_set_scanning(device, TRUE);
+
+       return ret;
+}
+
 static struct connman_device_driver wifi_ng_driver = {
        .name           = "wifi",
        .type           = CONNMAN_DEVICE_TYPE_WIFI,
@@ -307,6 +325,7 @@ static struct connman_device_driver wifi_ng_driver = {
        .enable         = wifi_enable,
        .disable        = wifi_disable,
        .scan           = wifi_scan,
+       .scan_fast      = wifi_scan_fast,
 };
 
 static void system_ready(void)
@@ -573,8 +592,6 @@ static void interface_added(GSupplicantInterface *interface)
 
        if (wifi->tethering == TRUE)
                return;
-
-       wifi_scan(wifi->device);
 }
 
 static connman_bool_t is_idle(struct wifi_data *wifi)
diff --git a/src/device.c b/src/device.c
index a5b815f..0504647 100644
--- a/src/device.c
+++ b/src/device.c
@@ -690,7 +690,9 @@ int connman_device_set_powered(struct connman_device 
*device,
 
        reset_scan_trigger(device);
 
-       if (device->driver && device->driver->scan)
+       if (device->driver && device->driver->scan_fast)
+               device->driver->scan_fast(device);
+       else if (device->driver && device->driver->scan)
                device->driver->scan(device);
 
        return 0;
-- 
1.7.1

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to