diff options
author | Mohamed Abbas <mabbas@linux.intel.com> | 2011-01-26 00:31:54 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-01-26 00:31:54 +0100 |
commit | 15a1cf2d279ff7a2e8bf85e8a52cfec1cde0e525 (patch) | |
tree | 755bf94740630a560d11dc20caeadbd1e3fa3aaa /plugins | |
parent | af54367c8b1fb235605071427c08ae688c386374 (diff) | |
download | connman-15a1cf2d279ff7a2e8bf85e8a52cfec1cde0e525.tar.gz connman-15a1cf2d279ff7a2e8bf85e8a52cfec1cde0e525.tar.bz2 connman-15a1cf2d279ff7a2e8bf85e8a52cfec1cde0e525.zip |
wifi: Balance scanning states
By setting the scan state to TRUE from wifi_scan() and setting it back
to FALSE in the callback, the wifi device scanning state is consistent.
Fixes BMC#12104
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/wifi.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 040d2f92..b7685eec 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -253,17 +253,25 @@ static void scan_callback(int result, GSupplicantInterface *interface, DBG("result %d", result); - connman_device_set_scanning(device, FALSE); + if (result < 0) + connman_device_reset_scanning(device); + else + connman_device_set_scanning(device, FALSE); } static int wifi_scan(struct connman_device *device) { struct wifi_data *wifi = connman_device_get_data(device); + int ret; DBG("device %p %p", device, wifi->interface); - return g_supplicant_interface_scan(wifi->interface, scan_callback, + 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 = { @@ -366,7 +374,6 @@ static void interface_state(GSupplicantInterface *interface) switch (state) { case G_SUPPLICANT_STATE_SCANNING: - connman_device_set_scanning(device, TRUE); break; case G_SUPPLICANT_STATE_AUTHENTICATING: @@ -440,9 +447,6 @@ static void scan_started(GSupplicantInterface *interface) if (wifi == NULL) return; - - if (wifi->device) - connman_device_set_scanning(wifi->device, TRUE); } static void scan_finished(GSupplicantInterface *interface) |