From 0c610386c0162ca909a98a66009c10ec65849140 Mon Sep 17 00:00:00 2001 From: "Gustavo F. Padovan" Date: Thu, 25 Nov 2010 17:09:10 -0200 Subject: [PATCH] ofono: Parse the new Lockdown property ConnMan should not try power up the modem if some is holding the modem lock. If it does an error will be returned in that case so this is just an optimization. Connman will re-power the modem if the lock is released. --- plugins/ofono.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/ofono.c b/plugins/ofono.c index 8e3ee4b..92e5438 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1001,6 +1001,7 @@ static void add_modem(const char *path, DBusMessageIter *prop) dbus_bool_t powered = FALSE; dbus_bool_t online = FALSE; dbus_bool_t has_online = FALSE; + dbus_bool_t locked = FALSE; gboolean has_sim = FALSE; gboolean has_reg = FALSE; gboolean has_gprs = FALSE; @@ -1032,6 +1033,8 @@ static void add_modem(const char *path, DBusMessageIter *prop) if (g_str_equal(key, "Powered") == TRUE) dbus_message_iter_get_basic(&value, &powered); + else if (g_str_equal(key, "Lockdown") == TRUE) + dbus_message_iter_get_basic(&value, &locked); else if (g_str_equal(key, "Online") == TRUE) { has_online = TRUE; dbus_message_iter_get_basic(&value, &online); @@ -1044,6 +1047,9 @@ static void add_modem(const char *path, DBusMessageIter *prop) dbus_message_iter_next(prop); } + if (locked) + return; + if (!powered) modem_change_powered(path, TRUE); @@ -1173,6 +1179,14 @@ static gboolean modem_changed(DBusConnection *connection, DBusMessage *message, dbus_message_iter_get_basic(&value, &online); update_modem_online(modem, online); + } else if (g_str_equal(key, "Lockdown") == TRUE) { + dbus_bool_t locked; + + dbus_message_iter_get_basic(&value, &locked); + + if (!locked) + modem_change_powered(path, TRUE); + } else if (g_str_equal(key, "Interfaces") == TRUE) { gboolean has_sim = modem_has_sim(&value); gboolean has_reg = modem_has_reg(&value); -- 2.7.4