diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2021-12-19 11:32:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review> | 2021-12-19 11:32:46 +0000 |
commit | d4fbe50ed65c256d0592cd61496eda3e0bac5389 (patch) | |
tree | 355651287cb32a1421e020565d3ed452cf3e3683 /plugins | |
parent | cbc442527ed68fe86c882fd66aa1815124ec27dc (diff) | |
parent | 4e445f017dd2c5aaa204002db74584fec457f9d8 (diff) | |
download | connman-d4fbe50ed65c256d0592cd61496eda3e0bac5389.tar.gz connman-d4fbe50ed65c256d0592cd61496eda3e0bac5389.tar.bz2 connman-d4fbe50ed65c256d0592cd61496eda3e0bac5389.zip |
Merge "Start scan for wifi roaming when SNR and signal are weakened" into tizen
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/wifi.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 53bcc8b7..6294a413 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) |