From 0ba752cd651f972554f573534794b6e17c0e15fb Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Fri, 1 Mar 2013 13:17:58 +0200 Subject: wifi: Preliminary fix for autoscanning known hidden SSIDs Currently, it relies on max_ssids to know how many SSIDs it can provide as paremeters. However, patch 6af0579c434058536fb40480f40f5e9895cfe863, which fixes an issue about fast scanning, affects such feature. Therefore, as a default, it will fallback to 1 if given max_ssids is 0. There is still the issue that it will autoscan only max_ssid (1 or more) known hidden SSIDs. This need to be fixed. Reported by Sameer Naik --- plugins/wifi.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'plugins') diff --git a/plugins/wifi.c b/plugins/wifi.c index 4b097fca..dd79cd35 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -530,7 +530,8 @@ static void scan_callback_hidden(int result, { struct connman_device *device = user_data; struct wifi_data *wifi = connman_device_get_data(device); - int driver_max_ssids; + GSupplicantScanParams *scan_params; + int driver_max_ssids, ret; DBG("result %d wifi %p", result, wifi); @@ -539,32 +540,30 @@ static void scan_callback_hidden(int result, /* * Scan hidden networks so that we can autoconnect to them. + * We will assume 1 as a default number of ssid to scan. */ driver_max_ssids = g_supplicant_interface_get_max_scan_ssids( wifi->interface); - DBG("max ssids %d", driver_max_ssids); + if (driver_max_ssids == 0) + driver_max_ssids = 1; - if (driver_max_ssids > 0) { - GSupplicantScanParams *scan_params; - int ret; + DBG("max ssids %d", driver_max_ssids); - scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); - if (scan_params == NULL) - goto out; + scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); + if (scan_params == NULL) + goto out; - if (get_hidden_connections(driver_max_ssids, - scan_params) > 0) { - ret = g_supplicant_interface_scan(wifi->interface, + if (get_hidden_connections(driver_max_ssids, scan_params) > 0) { + ret = g_supplicant_interface_scan(wifi->interface, scan_params, scan_callback, device); - if (ret == 0) - return; - } - - g_supplicant_free_scan_params(scan_params); + if (ret == 0) + return; } + g_supplicant_free_scan_params(scan_params); + out: scan_callback(result, interface, user_data); } -- cgit v1.2.3