summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgsupplicant/gsupplicant.h2
-rwxr-xr-xgsupplicant/supplicant.c7
-rwxr-xr-xplugins/wifi.c28
-rwxr-xr-xsrc/main.c12
-rwxr-xr-xsrc/main.conf4
5 files changed, 48 insertions, 5 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 05af5de1..6f4dca4a 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -305,7 +305,7 @@ typedef void (*GSupplicantInterfaceCallback) (int result,
#if defined TIZEN_EXT
typedef void (*GSupplicantMaxSpeedCallback) (int result, int maxspeed,
- int strength, void *user_data);
+ int strength, int snr, void *user_data);
#endif
void g_supplicant_interface_cancel(GSupplicantInterface *interface);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 906f0ea7..17ea4502 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -6425,6 +6425,7 @@ static void interface_signalpoll_result(const char *error,
int err = 0;
dbus_int32_t maxspeed = 0;
dbus_int32_t strength = 0;
+ dbus_int32_t snr = 0;
DBusMessageIter sub_iter, dict;
if (error) {
@@ -6461,6 +6462,10 @@ static void interface_signalpoll_result(const char *error,
dbus_message_iter_get_basic(&value, &strength);
SUPPLICANT_DBG("Strength = %d", strength);
break;
+ } else if (g_strcmp0(key, "SNR") == 0) {
+ dbus_message_iter_get_basic(&value, &snr);
+ SUPPLICANT_DBG("SNR = %d", snr);
+ break;
}
}
dbus_message_iter_next(&dict);
@@ -6468,7 +6473,7 @@ static void interface_signalpoll_result(const char *error,
out:
if(data->callback)
- data->callback(err, maxspeed, strength, data->user_data);
+ data->callback(err, maxspeed, strength, snr, data->user_data);
g_free(data->path);
dbus_free(data);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 82168162..11f7007e 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -83,6 +83,8 @@
#if defined TIZEN_EXT
#define WIFI_EAP_FAST_PAC_FILE "/var/lib/wifi/wifi.pac" /* path of Pac file for EAP-FAST */
+#define RSSI_LEVEL_2_5G -77
+#define RSSI_LEVEL_2_24G -75
#endif
static struct connman_technology *wifi_technology = NULL;
@@ -2178,7 +2180,8 @@ static void scan_callback(int result, GSupplicantInterface *interface,
/* On error, let's recall scan_callback, which will cleanup */
return scan_callback(ret, interface, user_data);
}
- }
+ } else
+ wifi->allow_full_scan = false;
#endif
scanning = connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_WIFI);
@@ -3964,9 +3967,10 @@ static void set_connection_mode(struct connman_network *network,
}
static void signalpoll_callback(int result, int maxspeed, int strength,
- void *user_data)
+ int snr, void *user_data)
{
struct connman_network *network = user_data;
+ uint16_t freq = connman_network_get_frequency(network);
if (result != 0) {
DBG("Failed to get maxspeed from signalpoll !");
@@ -3978,13 +3982,31 @@ static void signalpoll_callback(int result, int maxspeed, int strength,
if (strength > 100)
strength = 100;
- DBG("maxspeed = %d, strength = %d", maxspeed, strength);
+ DBG("maxspeed = %d, strength = %d, snr = %d", maxspeed, strength, snr);
connman_network_set_strength(network, (uint8_t)strength);
connman_network_set_maxspeed(network, maxspeed);
set_connection_mode(network, maxspeed);
connman_network_unref(network);
+
+ /* If SNR is less than 20 or RSSI level is less than 3,
+ * scan for BSS transition is started.
+ * */
+ if (connman_setting_get_bool("WifiRoamingScan") == false)
+ return;
+
+ if (snr < 20 && snr != 0)
+ goto scan;
+ else if (freq > 4900 && strength <= RSSI_LEVEL_2_5G)
+ goto scan;
+ else if (freq <= 4900 && strength <= RSSI_LEVEL_2_24G)
+ goto scan;
+
+ return;
+
+scan:
+ throw_wifi_scan(connman_network_get_device(network), scan_callback);
}
static int network_signalpoll(struct wifi_data *wifi)
diff --git a/src/main.c b/src/main.c
index cc104d50..7b73a0b8 100755
--- a/src/main.c
+++ b/src/main.c
@@ -107,6 +107,7 @@ static struct {
bool file_log;
bool dlog_log;
bool simple_log;
+ bool wifi_roam_scan;
#endif
} connman_settings = {
.bg_scan = true,
@@ -140,6 +141,7 @@ static struct {
.file_log = true,
.dlog_log = true,
.simple_log = true,
+ .wifi_roam_scan = true,
#endif
};
@@ -230,6 +232,7 @@ static struct {
#define CONF_CONNMAN_FILE_LOG "FileLogging"
#define CONF_CONNMAN_DLOG_LOG "DlogLogging"
#define CONF_CONNMAN_SIMPLIFIED_LOG "SimplifiedLog"
+#define CONF_CONNMAN_WIFI_ROAM_SCAN "WifiRoamingScan"
#endif
#if defined TIZEN_EXT
@@ -291,6 +294,7 @@ static const char *supported_options[] = {
CONF_CONNMAN_FILE_LOG,
CONF_CONNMAN_DLOG_LOG,
CONF_CONNMAN_SIMPLIFIED_LOG,
+ CONF_CONNMAN_WIFI_ROAM_SCAN,
#endif
NULL
};
@@ -697,6 +701,11 @@ static void check_Tizen_configuration(GKeyFile *config)
if (!error)
connman_settings.simple_log = boolean;
+ boolean = __connman_config_get_bool(config, "General",
+ CONF_CONNMAN_WIFI_ROAM_SCAN, &error);
+ if (!error)
+ connman_settings.wifi_roam_scan = boolean;
+
g_clear_error(&error);
check_Tizen_INS_configuration(config);
@@ -1183,6 +1192,9 @@ bool connman_setting_get_bool(const char *key)
if (g_str_equal(key, CONF_CONNMAN_SIMPLIFIED_LOG))
return connman_settings.simple_log;
+
+ if (g_str_equal(key, CONF_CONNMAN_WIFI_ROAM_SCAN))
+ return connman_settings.wifi_roam_scan;
#endif
#if defined TIZEN_EXT
diff --git a/src/main.conf b/src/main.conf
index 555225f0..6763d71b 100755
--- a/src/main.conf
+++ b/src/main.conf
@@ -185,6 +185,10 @@ SimplifiedLog = true
# Default value is wlan0.
DefaultWifiInterface = wlan0
+# Allow ConnMan to start scan for wifi roaming when SNR and signal are weakened
+# Default value is true.
+WifiRoamingScan = true
+
[INS]
# INS(Intelligent Network Selection) configuration: BSSID Selection.
INSPreferredFreqBSSID = 5GHz