diff options
author | Yu A Wang <yu.a.wang@intel.com> | 2011-09-06 05:06:34 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-09-12 20:23:21 +0200 |
commit | c3d4dfaee40b0c8817c38117ae08a47c4ec7f1f2 (patch) | |
tree | 0f2586d0574a90a761479810e18011e4d1076148 /plugins | |
parent | 558b0e7b7488a4db6d195bcfd78129eac1e9525e (diff) | |
download | connman-c3d4dfaee40b0c8817c38117ae08a47c4ec7f1f2.tar.gz connman-c3d4dfaee40b0c8817c38117ae08a47c4ec7f1f2.tar.bz2 connman-c3d4dfaee40b0c8817c38117ae08a47c4ec7f1f2.zip |
ofono: Remove 3G network after disabled 3G modem
Fixes BMC#22745
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ofono.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c index 060cd8ef..66520772 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -253,6 +253,36 @@ static void update_modem_online(struct modem_data *modem, connman_device_set_powered(modem->device, online); } +static void remove_device_networks(struct connman_device *device) +{ + GHashTableIter iter; + gpointer key, value; + GSList *info_list = NULL; + GSList *list; + + if (network_hash == NULL) + return; + + g_hash_table_iter_init(&iter, network_hash); + + while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { + struct network_info *info = value; + + if (connman_network_get_device(info->network) != device) + continue; + + info_list = g_slist_append(info_list, info); + } + + for (list = info_list; list != NULL; list = list->next) { + struct network_info *info = list->data; + + connman_device_remove_network(device, info->network); + } + + g_slist_free(info_list); +} + static void set_online_reply(DBusPendingCall *call, void *user_data) { struct modem_data *modem; @@ -285,6 +315,9 @@ static void set_online_reply(DBusPendingCall *call, void *user_data) if (modem->pending_online) update_modem_online(modem, result); + if (result == FALSE) + remove_device_networks(modem->device); + dbus_message_unref(reply); dbus_pending_call_unref(call); @@ -335,36 +368,6 @@ static struct connman_device_driver modem_driver = { .disable = modem_disable, }; -static void remove_device_networks(struct connman_device *device) -{ - GHashTableIter iter; - gpointer key, value; - GSList *info_list = NULL; - GSList *list; - - if (network_hash == NULL) - return; - - g_hash_table_iter_init(&iter, network_hash); - - while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { - struct network_info *info = value; - - if (connman_network_get_device(info->network) != device) - continue; - - info_list = g_slist_append(info_list, info); - } - - for (list = info_list; list != NULL; list = list->next) { - struct network_info *info = list->data; - - connman_device_remove_network(device, info->network); - } - - g_slist_free(info_list); -} - static void modem_remove_device(struct modem_data *modem) { DBG("modem %p path %s device %p", modem, modem->path, modem->device); |