summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-11-25 17:09:10 -0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-11-26 17:02:00 +0100
commit0c610386c0162ca909a98a66009c10ec65849140 (patch)
tree67d486c441434e1987cc084ba5522671765a9576 /plugins
parent79f0c73afe7f11dd8216add0e0ef28eec956ebb5 (diff)
downloadconnman-0c610386c0162ca909a98a66009c10ec65849140.tar.gz
connman-0c610386c0162ca909a98a66009c10ec65849140.tar.bz2
connman-0c610386c0162ca909a98a66009c10ec65849140.zip
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.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ofono.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 8e3ee4be..92e54387 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);