diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2023-09-18 12:05:16 +0900 |
---|---|---|
committer | Jaehyun Kim <jeik01.kim@samsung.com> | 2023-11-13 20:54:07 +0900 |
commit | 99d33b96b244243cc514f3571dd2060234d9a338 (patch) | |
tree | 0dd70febbc8ba89d0005b2e91f156d91514f53d3 | |
parent | 3cd9a4b59e5f33ed4cb05ccfa28969777977c99e (diff) | |
download | connman-99d33b96b244243cc514f3571dd2060234d9a338.tar.gz connman-99d33b96b244243cc514f3571dd2060234d9a338.tar.bz2 connman-99d33b96b244243cc514f3571dd2060234d9a338.zip |
Add some options in main.conf for wifi roamingaccepted/tizen/7.0/unified/20231114.180329
1. An option to change the roaming scan interval is added.
2. An option to do a full scan every time
when try to auto-connect is added.
3. Remove the network added to wpa_supplicant
when the driver disconnects current network
if the wifi roaming option is enabled.
Change-Id: Ib4399284ad50b3fd86aeb6d34b1c620a806c8897
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-x | gsupplicant/supplicant.c | 3 | ||||
-rwxr-xr-x | plugins/wifi.c | 19 | ||||
-rwxr-xr-x | src/main.c | 28 | ||||
-rwxr-xr-x | src/main.conf | 18 | ||||
-rwxr-xr-x | src/main_robot.conf | 21 | ||||
-rwxr-xr-x | src/service.c | 19 |
6 files changed, 90 insertions, 18 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index ab5729c7..072edac9 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -7549,9 +7549,10 @@ static void interface_add_network_params(DBusMessageIter *iter, void *user_data) SUPPLICANT_DBG("bssid [" MACSTR "]", MAC2STR(interface->add_network_bssid)); supplicant_dbus_dict_append_basic(&dict, "bssid", - DBUS_TYPE_STRING, &bssid); + DBUS_TYPE_STRING, &bssid); g_free(bssid); } + #endif supplicant_dbus_dict_close(iter, &dict); diff --git a/plugins/wifi.c b/plugins/wifi.c index a967d8bf..13ea9a39 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -107,8 +107,8 @@ #define RSSI_LEVEL_2_2_4G -75 #define RSSI_LEVEL_3_5G -68 #define RSSI_LEVEL_3_2_4G -64 -#define ROAM_SCAN_INTERVAL 30 /* 30 seconds */ +static int roam_scan_interval = 30; /* Default: 30 seconds */ static int min_snr = 0; static int min_rssi_2_4GHz = 0; static int min_rssi_5GHz = 0; @@ -4401,7 +4401,7 @@ static void signalpoll_callback(int result, int maxspeed, int strength, clock_gettime(CLOCK_MONOTONIC, &curr_time); roam_scan_time = connman_network_get_roam_scan_time(network); - if (curr_time.tv_sec <= roam_scan_time + ROAM_SCAN_INTERVAL) + if (curr_time.tv_sec <= roam_scan_time + roam_scan_interval) goto done; if (device && need_bss_transition(freq, snr, strength)) { @@ -5005,7 +5005,8 @@ static void interface_state(GSupplicantInterface *interface) bssid_length = g_slist_length(bssid_list); if (bssid_length > 1 && bssid_length > g_hash_table_size(failed_bssids)) { - network_connect(network); + int conn_ret = network_connect(network); + DBG("conn_ret = %d", conn_ret); break; } @@ -5055,6 +5056,13 @@ static void interface_state(GSupplicantInterface *interface) DBG("Set disconnect reason code(%d)", wifi->disconnect_code); connman_network_set_disconnect_reason(network, wifi->disconnect_code); } + + if (wifi->connected && + !wifi->pending_network && + connman_setting_get_bool("WifiRoaming")) { + network_disconnect(network); + break; + } #endif if (network != wifi->pending_network) { @@ -6793,6 +6801,7 @@ static int wifi_init(void) #if defined TIZEN_EXT failed_bssids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + roam_scan_interval = connman_setting_get_int("WifiRoamingScanInterval"); min_snr = connman_setting_get_int("WifiRoamingMinSNR"); min_rssi_2_4GHz = connman_setting_get_int("WifiRoamingMinRSSI_2_4GHz"); @@ -6803,8 +6812,8 @@ static int wifi_init(void) if (min_rssi_5GHz >= 0) min_rssi_5GHz = RSSI_LEVEL_2_5G; - DBG("Min SNR: %d, Min RSSI: %d(2.4GHz), %d(5GHz)", - min_snr, min_rssi_2_4GHz, min_rssi_5GHz); + DBG("RoamScan Int: %d, Min SNR: %d, Min RSSI: %d(2.4GHz), %d(5GHz)", + roam_scan_interval, min_snr, min_rssi_2_4GHz, min_rssi_5GHz); #endif @@ -120,10 +120,12 @@ static struct { bool dlog_log; bool simple_log; bool wifi_roam_scan; + int wifi_roam_scan_interval; bool wifi_roam; int wifi_roam_min_snr; int wifi_roam_min_rssi_2_4GHz; int wifi_roam_min_rssi_5GHz; + bool auto_connection_scan; #endif } connman_settings = { .bg_scan = true, @@ -161,10 +163,12 @@ static struct { .dlog_log = true, .simple_log = true, .wifi_roam_scan = false, + .wifi_roam_scan_interval = 30, .wifi_roam = false, .wifi_roam_min_snr = 0, .wifi_roam_min_rssi_2_4GHz = 0, .wifi_roam_min_rssi_5GHz = 0, + .auto_connection_scan = false, #endif }; @@ -259,10 +263,12 @@ static struct { #define CONF_DLOG_LOG "DlogLogging" #define CONF_SIMPLIFIED_LOG "SimplifiedLog" #define CONF_WIFI_ROAM_SCAN "WifiRoamingScan" +#define CONF_WIFI_ROAM_SCAN_INTERVAL "WifiRoamingScanInterval" #define CONF_WIFI_ROAM "WifiRoaming" #define CONF_WIFI_ROAM_MIN_SNR "WifiRoamingMinSNR" #define CONF_WIFI_ROAM_MIN_RSSI_2_4 "WifiRoamingMinRSSI_2_4GHz" #define CONF_WIFI_ROAM_MIN_RSSI_5 "WifiRoamingMinRSSI_5GHz" +#define CONF_WIFI_AUTO_CONNECTION_SCAN "AutoConnectionScan" #endif #if defined TIZEN_EXT @@ -329,10 +335,12 @@ static const char *supported_options[] = { CONF_DLOG_LOG, CONF_SIMPLIFIED_LOG, CONF_WIFI_ROAM_SCAN, + CONF_WIFI_ROAM_SCAN_INTERVAL, CONF_WIFI_ROAM, CONF_WIFI_ROAM_MIN_SNR, CONF_WIFI_ROAM_MIN_RSSI_2_4, CONF_WIFI_ROAM_MIN_RSSI_5, + CONF_WIFI_AUTO_CONNECTION_SCAN, #endif NULL }; @@ -749,6 +757,13 @@ static void check_tizen_configuration(GKeyFile *config) g_clear_error(&error); + integer = g_key_file_get_integer(config, "General", + CONF_WIFI_ROAM_SCAN_INTERVAL, &error); + if (!error && integer >= 0) + connman_settings.wifi_roam_scan_interval = integer; + + g_clear_error(&error); + boolean = __connman_config_get_bool(config, "General", CONF_WIFI_ROAM, &error); if (!error) @@ -777,6 +792,13 @@ static void check_tizen_configuration(GKeyFile *config) g_clear_error(&error); + boolean = __connman_config_get_bool(config, "General", + CONF_WIFI_AUTO_CONNECTION_SCAN, &error); + if (!error) + connman_settings.auto_connection_scan = boolean; + + g_clear_error(&error); + check_tizen_ins_configuration(config); } @@ -1305,6 +1327,9 @@ bool connman_setting_get_bool(const char *key) if (g_str_equal(key, CONF_WIFI_ROAM)) return connman_settings.wifi_roam; + if (g_str_equal(key, CONF_WIFI_AUTO_CONNECTION_SCAN)) + return connman_settings.auto_connection_scan; + if (g_str_equal(key, CONF_INS_LAST_CONNECTED_BSSID)) return connman_ins_settings.ins_last_connected_bssid; @@ -1390,6 +1415,9 @@ int connman_setting_get_int(const char *key) if (g_str_equal(key, CONF_WIFI_ROAM_MIN_RSSI_5)) return connman_settings.wifi_roam_min_rssi_5GHz; + if (g_str_equal(key, CONF_WIFI_ROAM_SCAN_INTERVAL)) + return connman_settings.wifi_roam_scan_interval; + return 0; } #endif diff --git a/src/main.conf b/src/main.conf index 09eab2cf..e0ad97d7 100755 --- a/src/main.conf +++ b/src/main.conf @@ -210,7 +210,11 @@ DefaultWifiInterface = wlan0 # Default value is false. # WifiRoamingScan = true -# Allow ConnMan to start wifi roaming when SNR and signal are weakened +# Interval between roaming scans. +# Default value is 30. +# WifiRoamingScanInterval = 20 + +# Allow ConnMan to start wifi roaming when SNR and signal are weakened. # and there is another BSS in better condition. # Default value is false. # WifiRoaming = true @@ -220,9 +224,15 @@ DefaultWifiInterface = wlan0 # - SNR is less than WifiRoamingMinSNR or RSSI is less than # WifiRoamingMinRSSI_2_4GHz or WifiRoamingMinRSSI_5GHz. # - If the WifiRoamingMinSNR value is 0, the SNR check will be skipped. -WifiRoamingMinSNR = 20 -WifiRoamingMinRSSI_2_4GHz = -75 -WifiRoamingMinRSSI_5GHz = -77 +# WifiRoamingMinSNR = 20 +# WifiRoamingMinRSSI_2_4GHz = -75 +# WifiRoamingMinRSSI_5GHz = -77 + +# This value determines whether to always perform a full scan +# before starting auto connection. +# This may be necessary if the status of nearby APs changes frequently. +# Default value is false. +# AutoConnectionScan = true [INS] # INS(Intelligent Network Selection) configuration: BSSID Selection. diff --git a/src/main_robot.conf b/src/main_robot.conf index cc364d88..0896e89f 100755 --- a/src/main_robot.conf +++ b/src/main_robot.conf @@ -210,18 +210,29 @@ DefaultWifiInterface = wlan0 # Default value is false. # WifiRoamingScan = true -# Allow ConnMan to start wifi roaming when SNR and signal are weakened +# Interval between roaming scans. +# Default value is 30. +# WifiRoamingScanInterval = 20 + +# Allow ConnMan to start wifi roaming when SNR and signal are weakened. # and there is another BSS in better condition. # Default value is false. # WifiRoaming = true # Determine if the SNR and signal have weakened # based on the following conditions. -# - SNR is less than WifiRoamingMinSNR or RSSI level is less than +# - SNR is less than WifiRoamingMinSNR or RSSI is less than # WifiRoamingMinRSSI_2_4GHz or WifiRoamingMinRSSI_5GHz. -WifiRoamingMinSNR = 20 -WifiRoamingMinRSSI_2_4GHz = -75 -WifiRoamingMinRSSI_5GHz = -77 +# - If the WifiRoamingMinSNR value is 0, the SNR check will be skipped. +# WifiRoamingMinSNR = 20 +# WifiRoamingMinRSSI_2_4GHz = -75 +# WifiRoamingMinRSSI_5GHz = -77 + +# This value determines whether to always perform a full scan +# before starting auto connection. +# This may be necessary if the status of nearby APs changes frequently. +# Default value is false. +# AutoConnectionScan = true [INS] # INS(Intelligent Network Selection) configuration: BSSID Selection. diff --git a/src/service.c b/src/service.c index 04c0708b..b5351422 100755 --- a/src/service.c +++ b/src/service.c @@ -2941,9 +2941,10 @@ struct connman_service *connman_service_get_default_connection(void) for (list = service_list; list; list = list->next) { service = list->data; - DBG("service: %p %s %s %s", service, service->name, - state2string(service->state), - __connman_service_type2string(service->type)); + if (!simplified_log) + DBG("service: %p %s %s %s", service, service->name, + state2string(service->state), + __connman_service_type2string(service->type)); #if defined TIZEN_MAINTAIN_ONLINE if (service->type == CONNMAN_SERVICE_TYPE_WIFI && @@ -5836,6 +5837,18 @@ static void do_auto_connect(struct connman_service *service, if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_NATIVE) return; +#if defined TIZEN_EXT + /* + * Always perform a full scan before starting auto connection. + * This may be necessary if the status of nearby APs changes frequently. + */ + if (service->type == CONNMAN_SERVICE_TYPE_WIFI && + connman_setting_get_bool("AutoConnectionScan") == true) { + DBG("Start full scan before auto connection"); + __connman_device_request_scan_full(CONNMAN_SERVICE_TYPE_WIFI); + return; + } +#endif /* * Run service auto connect for other than VPN services. Afterwards * start also VPN auto connect process. |