From: Daniel Wagner <[email protected]>
---
plugins/ofono.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 1941e14..7155b7a 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -557,6 +557,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)
{
@@ -1679,6 +1692,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;
@@ -2065,6 +2087,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;
}
--
1.7.8.110.g4cb5d1
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman