ofono: Remove network if GPRS context is removed
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 15 Nov 2012 09:50:15 +0000 (10:50 +0100)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 15 Nov 2012 13:42:28 +0000 (15:42 +0200)
Whenever the GPRS contextext is removed we need also to remove
the network object. Following sequence was observed:

  cm_update_attached() /huawei_1 Attached 1
  modem_changed() /huawei_1 Interfaces 0x07

Plugin creates network object and registers it at core

   cm_update_attached() /huawei_1 Attached 0
   service.c:run_auto_connect()
   set_property() /huawei_1 path /huawei_1/context1 org.ofono.ConnectionContext.Active

Obviously, the context is not attached at this point so we get an

   Failed to change property: /huawei_1/context1 org.ofono.ConnectionContext.Active: org.ofono.Error.NotAttached GPRS is not
attached

Fixes BMC#25725

plugins/ofono.c

index 2122b85..41954e4 100644 (file)
@@ -1698,8 +1698,10 @@ static void cm_update_attached(struct modem_data *modem,
 
        DBG("%s Attached %d", modem->path, modem->attached);
 
-       if (modem->attached == FALSE)
+       if (modem->attached == FALSE) {
+               remove_network(modem);
                return;
+       }
 
        if (has_interface(modem->interfaces,
                                OFONO_API_NETREG) == FALSE) {