summaryrefslogtreecommitdiff
path: root/plugins/ofono.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-11-22 13:54:30 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-12-12 17:33:58 +0100
commit4ccccee21fae749ce7bdcdc154ba79c45317e93f (patch)
tree3f43d13cc1f642f9b50a98c7c9e2a588ee1b7b33 /plugins/ofono.c
parent549f551c8480e74b4a816fe874bce2a2f2778f50 (diff)
downloadconnman-4ccccee21fae749ce7bdcdc154ba79c45317e93f.tar.gz
connman-4ccccee21fae749ce7bdcdc154ba79c45317e93f.tar.bz2
connman-4ccccee21fae749ce7bdcdc154ba79c45317e93f.zip
ofono: Power down modem when ConnMan shutsdown
Diffstat (limited to 'plugins/ofono.c')
-rw-r--r--plugins/ofono.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 3f0d8a9b..0e26d40e 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -559,6 +559,19 @@ static int modem_set_powered(struct modem_data *modem)
NULL);
}
+static int modem_set_unpowered(struct modem_data *modem)
+{
+ DBG("%s", modem->path);
+
+ modem->set_powered = FALSE;
+
+ return set_property(modem, modem->path,
+ OFONO_MODEM_INTERFACE,
+ "Powered", DBUS_TYPE_BOOLEAN,
+ &modem->set_powered,
+ NULL);
+}
+
static connman_bool_t has_interface(uint8_t interfaces,
enum ofono_api api)
{
@@ -1681,6 +1694,15 @@ static void add_modem(const char *path, DBusMessageIter *prop)
}
}
+static void modem_power_down(gpointer key, gpointer value, gpointer user_data)
+{
+ struct modem_data *modem = value;
+
+ DBG("%s", modem->path);
+
+ modem_set_unpowered(modem);
+}
+
static void remove_modem(gpointer data)
{
struct modem_data *modem = data;
@@ -2067,6 +2089,15 @@ static void ofono_exit(void)
DBG("");
if (modem_hash != NULL) {
+ /*
+ * We should propably wait for the SetProperty() reply
+ * message, because ...
+ */
+ g_hash_table_foreach(modem_hash, modem_power_down, NULL);
+
+ /*
+ * ... here we will cancel the call.
+ */
g_hash_table_destroy(modem_hash);
modem_hash = NULL;
}