ofono: Check for CM attached before registering network
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 7 May 2012 13:22:59 +0000 (15:22 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 8 May 2012 09:19:13 +0000 (12:19 +0300)
We need to check the ConnectionManager attached signal before
we are allowed to connect to the gprs context:

connmand[592]: plugins/ofono.c:cm_update_attached() /zte_0 Attached 0

[...]

connmand[592]: plugins/ofono.c:context_set_active() /zte_0 active 1
connmand[592]: plugins/ofono.c:set_property() /zte_0 path /zte_0/context1
org.ofono.ConnectionContext.Active

[...]

connmand[592]: plugins/ofono.c:cm_update_attached() /zte_0 Attached 1

Fixes BMC#25112

plugins/ofono.c

index ac874ea..0dfadb8 100644 (file)
@@ -1131,7 +1131,7 @@ static int add_cm_context(struct modem_data *modem, const char *context_path,
 
        g_hash_table_replace(context_hash, g_strdup(context_path), modem);
 
-       if (modem->valid_apn == TRUE &&
+       if (modem->valid_apn == TRUE && modem->attached == TRUE &&
                        has_interface(modem->interfaces,
                                OFONO_API_NETREG) == TRUE) {
                add_network(modem);
@@ -1218,6 +1218,9 @@ static gboolean context_changed(DBusConnection *connection,
                        if (modem->network != NULL)
                                return TRUE;
 
+                       if (modem->attached == FALSE)
+                               return TRUE;
+
                        if (has_interface(modem->interfaces,
                                        OFONO_API_NETREG) == FALSE) {
                                return TRUE;