ofono: Add the CDMA network when the device is created
authorForest Bond <forest.bond@rapidrollout.com>
Fri, 29 Mar 2013 16:23:55 +0000 (12:23 -0400)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 3 Apr 2013 08:11:17 +0000 (11:11 +0300)
There is a race that causes the network not to be added if we get the
CDMA netreg changed signal before the CDMA connection manager added
signal.  In that case the network is not added because the device has
not been created yet.  So we fix this by trying to add the network
whenever the device is created.

plugins/ofono.c

index 09718a4..847f256 100644 (file)
@@ -2034,8 +2034,11 @@ static void modem_update_interfaces(struct modem_data *modem,
        }
 
        if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_CM) == TRUE) {
-               if (ready_to_create_device(modem) == TRUE)
+               if (ready_to_create_device(modem) == TRUE) {
                        create_device(modem);
+                       if (modem->registered == TRUE)
+                               add_cdma_network(modem);
+               }
 
                if (modem->device != NULL)
                        cdma_cm_get_properties(modem);
@@ -2131,8 +2134,11 @@ static gboolean modem_changed(DBusConnection *conn, DBusMessage *message,
 
                if (has_interface(modem->interfaces,
                                         OFONO_API_CDMA_CM) == TRUE) {
-                       if (ready_to_create_device(modem) == TRUE)
+                       if (ready_to_create_device(modem) == TRUE) {
                                create_device(modem);
+                               if (modem->registered == TRUE)
+                                       add_cdma_network(modem);
+                       }
                }
        }