diff options
-rw-r--r-- | plugins/wifi.c | 117 | ||||
-rwxr-xr-x | src/connman.service.in | 1 | ||||
-rw-r--r-- | src/connman_tv.service.in | 1 | ||||
-rw-r--r-- | src/main.c | 16 | ||||
-rwxr-xr-x | src/main.conf | 4 | ||||
-rwxr-xr-x | src/main_disable_eth.conf | 4 | ||||
-rwxr-xr-x | src/main_ivi.conf | 4 | ||||
-rwxr-xr-x | src/main_tv.conf | 4 | ||||
-rw-r--r-- | src/service.c | 4 | ||||
-rwxr-xr-x | src/timeserver.c | 7 | ||||
-rwxr-xr-x | vpn/connman-vpn.service.in | 2 |
11 files changed, 128 insertions, 36 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 4204c927..8da1da56 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -1529,6 +1529,35 @@ static void check_p2p_technology(void) } } +struct last_connected { + GTimeVal modified; + gchar *ssid; + int freq; +}; + +static gint sort_entry(gconstpointer a, gconstpointer b, gpointer user_data) +{ + GTimeVal *aval = (GTimeVal *)a; + GTimeVal *bval = (GTimeVal *)b; + + /* Note that the sort order is descending */ + if (aval->tv_sec < bval->tv_sec) + return 1; + + if (aval->tv_sec > bval->tv_sec) + return -1; + + return 0; +} + +static void free_entry(gpointer data) +{ + struct last_connected *entry = data; + + g_free(entry->ssid); + g_free(entry); +} + static void wifi_remove(struct connman_device *device) { struct wifi_data *wifi = connman_device_get_data(device); @@ -1721,7 +1750,16 @@ static int get_hidden_connections(GSupplicantScanParams *scan_data) int i, ret; bool value; int num_ssids = 0, add_param_failed = 0; +#if defined TIZEN_EXT + GSequenceIter *iter; + GSequence *latest_list; + struct last_connected *entry; + GTimeVal modified; + latest_list = g_sequence_new(free_entry); + if (!latest_list) + goto out; +#endif services = connman_storage_get_services(); for (i = 0; services && services[i]; i++) { if (strncmp(services[i], "wifi_", 5) != 0) @@ -1752,6 +1790,15 @@ static int get_hidden_connections(GSupplicantScanParams *scan_data) g_key_file_free(keyfile); continue; } + + gchar *str = g_key_file_get_string(keyfile, + services[i], "Modified", NULL); + if (!str) { + g_key_file_free(keyfile); + continue; + } + g_time_val_from_iso8601(str, &modified); + g_free(str); #endif ssid = g_key_file_get_string(keyfile, @@ -1760,6 +1807,22 @@ static int get_hidden_connections(GSupplicantScanParams *scan_data) name = g_key_file_get_string(keyfile, services[i], "Name", NULL); +#if defined TIZEN_EXT + entry = g_try_new(struct last_connected, 1); + if (!entry) { + g_sequence_free(latest_list); + g_free(ssid); + g_free(name); + g_key_file_free(keyfile); + goto out; + } + + entry->modified = modified; + entry->ssid = ssid; + + g_sequence_insert_sorted(latest_list, entry, + sort_entry, NULL); +#else ret = add_scan_param(ssid, NULL, 0, 0, scan_data, 0, name); if (ret < 0) add_param_failed++; @@ -1767,10 +1830,30 @@ static int get_hidden_connections(GSupplicantScanParams *scan_data) num_ssids++; g_free(ssid); +#endif g_free(name); g_key_file_free(keyfile); } +#if defined TIZEN_EXT + gint length = g_sequence_get_length(latest_list); + iter = g_sequence_get_begin_iter(latest_list); + + for (i = 0; i < length; i++) { + entry = g_sequence_get(iter); + + ret = add_scan_param(entry->ssid, NULL, 0, 0, scan_data, 0, entry->ssid); + if (ret < 0) + add_param_failed++; + else if (ret > 0) + num_ssids++; + + iter = g_sequence_iter_next(iter); + } + + g_sequence_free(latest_list); +out: +#endif /* * Check if there are any hidden AP that needs to be provisioned. */ @@ -1989,6 +2072,9 @@ static void service_state_changed(struct connman_service *service, break; } } + +static void scan_callback_hidden(int result, + GSupplicantInterface *interface, void *user_data); #endif static void scan_callback(int result, GSupplicantInterface *interface, @@ -2050,7 +2136,7 @@ static void scan_callback(int result, GSupplicantInterface *interface, wifi->allow_full_scan = FALSE; ret = g_supplicant_interface_scan(wifi->interface, NULL, - scan_callback, device); + scan_callback_hidden, device); if (ret == 0) return; @@ -2378,35 +2464,6 @@ static int wifi_disable(struct connman_device *device) return -EINPROGRESS; } -struct last_connected { - GTimeVal modified; - gchar *ssid; - int freq; -}; - -static gint sort_entry(gconstpointer a, gconstpointer b, gpointer user_data) -{ - GTimeVal *aval = (GTimeVal *)a; - GTimeVal *bval = (GTimeVal *)b; - - /* Note that the sort order is descending */ - if (aval->tv_sec < bval->tv_sec) - return 1; - - if (aval->tv_sec > bval->tv_sec) - return -1; - - return 0; -} - -static void free_entry(gpointer data) -{ - struct last_connected *entry = data; - - g_free(entry->ssid); - g_free(entry); -} - static int get_latest_connections(int max_ssids, GSupplicantScanParams *scan_data) { diff --git a/src/connman.service.in b/src/connman.service.in index f0bf5c3f..31febbde 100755 --- a/src/connman.service.in +++ b/src/connman.service.in @@ -1,7 +1,6 @@ [Unit] Description=Connection service After=net-config.service -DefaultDependencies=no [Service] Type=dbus diff --git a/src/connman_tv.service.in b/src/connman_tv.service.in index 9eb75b24..e5faac27 100644 --- a/src/connman_tv.service.in +++ b/src/connman_tv.service.in @@ -1,7 +1,6 @@ [Unit] Description=Connection service After=net-config.service -DefaultDependencies=no [Service] Type=dbus @@ -84,6 +84,7 @@ static struct { #if defined TIZEN_EXT char **cellular_interfaces; bool tizen_tv_extension; + bool use_gateway_timeserver; #endif } connman_settings = { .bg_scan = true, @@ -105,6 +106,7 @@ static struct { #if defined TIZEN_EXT .cellular_interfaces = NULL, .tizen_tv_extension = false, + .use_gateway_timeserver = false, #endif }; @@ -127,6 +129,7 @@ static struct { #if defined TIZEN_EXT #define CONF_CELLULAR_INTERFACE "NetworkCellularInterfaceList" #define CONF_TIZEN_TV_EXT "TizenTVExtension" +#define CONF_USE_GATEWAY_TIMESERVER "UseGatewayTimeserver" #endif static const char *supported_options[] = { @@ -148,6 +151,7 @@ static const char *supported_options[] = { #if defined TIZEN_EXT CONF_CELLULAR_INTERFACE, CONF_TIZEN_TV_EXT, + CONF_USE_GATEWAY_TIMESERVER, #endif NULL }; @@ -285,6 +289,13 @@ static void check_Tizen_configuration(GKeyFile *config) connman_settings.tizen_tv_extension = boolean; g_clear_error(&error); + + boolean = __connman_config_get_bool(config, "General", + CONF_USE_GATEWAY_TIMESERVER, &error); + if (!error) + connman_settings.use_gateway_timeserver = boolean; + + g_clear_error(&error); } static void set_nofile_inc(void) @@ -679,6 +690,11 @@ bool connman_setting_get_bool(const char *key) if (g_str_equal(key, CONF_ENABLE_ONLINE_CHECK)) return connman_settings.enable_online_check; +#if defined TIZEN_EXT + if (g_str_equal(key, CONF_USE_GATEWAY_TIMESERVER)) + return connman_settings.use_gateway_timeserver; +#endif + return false; } diff --git a/src/main.conf b/src/main.conf index a2cc1e20..80724d52 100755 --- a/src/main.conf +++ b/src/main.conf @@ -124,3 +124,7 @@ SingleConnectedTechnology = true # AlwaysConnectedTechnologies = NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w + +# Allow connman to add service gateway to the time server list. +# Default value is false. +# UseGatewayTimeserver = false diff --git a/src/main_disable_eth.conf b/src/main_disable_eth.conf index c4ec3e38..ea4a9ddb 100755 --- a/src/main_disable_eth.conf +++ b/src/main_disable_eth.conf @@ -108,3 +108,7 @@ SingleConnectedTechnology = true # Enable6to4 = false NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w + +# Allow connman to add service gateway to the time server list. +# Default value is false. +# UseGatewayTimeserver = false diff --git a/src/main_ivi.conf b/src/main_ivi.conf index 627bd061..c7e65c48 100755 --- a/src/main_ivi.conf +++ b/src/main_ivi.conf @@ -108,3 +108,7 @@ SingleConnectedTechnology = true # Enable6to4 = false NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w + +# Allow connman to add service gateway to the time server list. +# Default value is false. +# UseGatewayTimeserver = false diff --git a/src/main_tv.conf b/src/main_tv.conf index fd3afc90..44d1b025 100755 --- a/src/main_tv.conf +++ b/src/main_tv.conf @@ -109,7 +109,9 @@ SingleConnectedTechnology = true NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w - +# Allow connman to add service gateway to the time server list. +# Default value is false. +# UseGatewayTimeserver = false # Enable Tizen TV Profile Features TizenTVExtension = true diff --git a/src/service.c b/src/service.c index 85bcc318..d72316db 100644 --- a/src/service.c +++ b/src/service.c @@ -7955,6 +7955,10 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service, connman_warn("ipconfig state %d ipconfig method %d", new_state, method); +#if defined TIZEN_EXT + if (old_state != CONNMAN_SERVICE_STATE_READY && + old_state != CONNMAN_SERVICE_STATE_ONLINE) +#endif new_state = CONNMAN_SERVICE_STATE_IDLE; break; diff --git a/src/timeserver.c b/src/timeserver.c index 6325eceb..e4cfc062 100755 --- a/src/timeserver.c +++ b/src/timeserver.c @@ -218,6 +218,9 @@ GSList *__connman_timeserver_get_all(struct connman_service *service) for (i = 0; service_ts && service_ts[i]; i++) list = __connman_timeserver_add_list(list, service_ts[i]); +#if defined TIZEN_EXT + if (connman_setting_get_bool("UseGatewayTimeserver")) { +#endif network = __connman_service_get_network(service); if (network) { index = connman_network_get_index(network); @@ -228,7 +231,9 @@ GSList *__connman_timeserver_get_all(struct connman_service *service) if (service_gw) list = __connman_timeserver_add_list(list, service_gw); } - +#if defined TIZEN_EXT + } +#endif /* Then add Global Timeservers to the list */ timeservers = load_timeservers(); diff --git a/vpn/connman-vpn.service.in b/vpn/connman-vpn.service.in index a8f2948f..9399eb96 100755 --- a/vpn/connman-vpn.service.in +++ b/vpn/connman-vpn.service.in @@ -1,7 +1,5 @@ [Unit] Description=ConnMan VPN service -Requires=dbus.socket -After=dbus.socket [Service] Type=dbus |