diff options
author | hyunuktak <hyunuk.tak@samsung.com> | 2015-08-07 17:11:34 +0900 |
---|---|---|
committer | hyunuktak <hyunuk.tak@samsung.com> | 2015-08-07 17:11:56 +0900 |
commit | 6aa4055ef0544ae85457c25c510fe3db04949c43 (patch) | |
tree | 94018be3cef92c33b60650c488dc15536c8f978a /src/technology.c | |
parent | bc55a3df0d4d2d97964ce2fadc9fe3ffc4953f4e (diff) | |
download | connman-6aa4055ef0544ae85457c25c510fe3db04949c43.tar.gz connman-6aa4055ef0544ae85457c25c510fe3db04949c43.tar.bz2 connman-6aa4055ef0544ae85457c25c510fe3db04949c43.zip |
Base Code merged to SPIN 2.4submit/tizen/20150810.034432
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: I84a42375b5c59739e4caca1f726699ea7647ef17
Diffstat (limited to 'src/technology.c')
-rwxr-xr-x[-rw-r--r--] | src/technology.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/src/technology.c b/src/technology.c index 15bb395d..9e00a293 100644..100755 --- a/src/technology.c +++ b/src/technology.c @@ -85,6 +85,9 @@ struct connman_technology { static GSList *driver_list = NULL; +static int technology_enabled(struct connman_technology *technology); +static int technology_disabled(struct connman_technology *technology); + static gint compare_priority(gconstpointer a, gconstpointer b) { const struct connman_technology_driver *driver1 = a; @@ -625,19 +628,27 @@ static gboolean technology_pending_reply(gpointer user_data) static int technology_affect_devices(struct connman_technology *technology, bool enable_device) { + int err = 0, err_dev; GSList *list; - int err = -ENXIO; - if (technology->type == CONNMAN_SERVICE_TYPE_P2P) + if (technology->type == CONNMAN_SERVICE_TYPE_P2P) { + if (enable_device) + __connman_technology_enabled(technology->type); + else + __connman_technology_disabled(technology->type); return 0; + } for (list = technology->device_list; list; list = list->next) { struct connman_device *device = list->data; if (enable_device) - err = __connman_device_enable(device); + err_dev = __connman_device_enable(device); else - err = __connman_device_disable(device); + err_dev = __connman_device_disable(device); + + if (err_dev < 0 && err_dev != -EALREADY) + err = err_dev; } return err; @@ -1252,13 +1263,6 @@ static struct connman_technology *technology_get(enum connman_service_type type) technology->tethering_hidden = FALSE; technology->path = g_strdup_printf("%s/technology/%s", CONNMAN_PATH, str); - if (type == CONNMAN_SERVICE_TYPE_P2P) { - struct connman_technology *wifi; - - wifi = technology_find(CONNMAN_SERVICE_TYPE_WIFI); - if (wifi) - technology->enabled = wifi->enabled; - } technology_load(technology); technology_list = g_slist_prepend(technology_list, technology); @@ -1277,7 +1281,20 @@ static struct connman_technology *technology_get(enum connman_service_type type) return NULL; } - DBG("technology %p", technology); + if (type == CONNMAN_SERVICE_TYPE_P2P) { + struct connman_technology *wifi; + bool enable; + + enable = technology->enable_persistent; + + wifi = technology_find(CONNMAN_SERVICE_TYPE_WIFI); + if (enable && wifi) + enable = wifi->enabled; + + technology_affect_devices(technology, enable); + } + + DBG("technology %p %s", technology, get_name(technology->type)); return technology; } @@ -1865,6 +1882,12 @@ void __connman_technology_cleanup(void) { DBG(""); + while (technology_list) { + struct connman_technology *technology = technology_list->data; + technology_list = g_slist_remove(technology_list, technology); + technology_put(technology); + } + g_hash_table_destroy(rfkill_list); dbus_connection_unref(connection); |