summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-12-21 14:02:00 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-12-22 11:10:15 +0100
commit6726eb11c18d84d3e473af7b37648e2daf94fc0c (patch)
treee2fcc6049bdd7d2283acfff5b50cb38495ac29c6
parent67624abf962b634b743b8563232b1ee67b3aa77b (diff)
downloadconnman-6726eb11c18d84d3e473af7b37648e2daf94fc0c.tar.gz
connman-6726eb11c18d84d3e473af7b37648e2daf94fc0c.tar.bz2
connman-6726eb11c18d84d3e473af7b37648e2daf94fc0c.zip
ofono: Create device when powered up
Instead of directly online we let the core decide when to set the modem online therefore we have to create the connman_device a bit earlier at register it.
-rw-r--r--plugins/ofono.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 4efba0ce..0dd0fe00 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -1734,9 +1734,6 @@ static int cdma_cm_get_properties(struct modem_data *modem)
static connman_bool_t connection_manager_init(struct modem_data *modem)
{
if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) {
- if (ready_to_create_device(modem) == TRUE)
- create_device(modem);
-
if (modem->device != NULL) {
cm_get_properties(modem);
cm_get_contexts(modem);
@@ -1796,7 +1793,17 @@ static gboolean sim_changed(DBusConnection *connection, DBusMessage *message,
if (g_str_equal(key, "SubscriberIdentity") == TRUE) {
sim_update_imsi(modem, &value);
- connection_manager_init(modem);
+
+ if (ready_to_create_device(modem) == FALSE)
+ return TRUE;
+
+ /*
+ * This is a GSM modem. Create the device and
+ * register it at the core. Enabling (setting
+ * it online is done through the
+ * modem_enable() callback.
+ */
+ create_device(modem);
}
return TRUE;
@@ -1819,8 +1826,17 @@ static void sim_properties_reply(struct modem_data *modem,
if (g_str_equal(key, "SubscriberIdentity") == TRUE) {
sim_update_imsi(modem, &value);
- connection_manager_init(modem);
+ if (ready_to_create_device(modem) == FALSE)
+ return;
+
+ /*
+ * This is a GSM modem. Create the device and
+ * register it at the core. Enabling (setting
+ * it online is done through the
+ * modem_enable() callback.
+ */
+ create_device(modem);
return;
}
@@ -1868,11 +1884,6 @@ static gboolean modem_changed(DBusConnection *connection, DBusMessage *message,
dbus_message_iter_get_basic(&value, &modem->online);
DBG("%s Online %d", modem->path, modem->online);
-
- if (modem->online == FALSE)
- return TRUE;
-
- connection_manager_init(modem);
} else if (g_str_equal(key, "Interfaces") == TRUE) {
uint8_t interfaces;