Fix BMC#13547 unable to enable/disable 3G after plug in 3G modem again
Fix as samuel's comment to add remove_rfkill to fix missing rfkill
event issue when remove_device, remove all rfkill indexes for a technology
---
 src/technology.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/technology.c b/src/technology.c
index 96d64af..ab41c82 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -707,12 +707,16 @@ void __connman_technology_remove_interface(enum 
connman_service_type type,
 
        technology = technology_find(type);
 
-       if (technology == NULL || technology->driver == NULL)
+       if (technology == NULL)
                return;
 
+       if (technology->driver == NULL)
+               goto done;
+
        if (technology->driver->remove_interface)
                technology->driver->remove_interface(technology, index);
 
+done:
        technology_put(technology);
 }
 
@@ -742,6 +746,14 @@ int __connman_technology_add_device(struct connman_device 
*device)
        return 0;
 }
 
+static void remove_rfkill(gpointer key, gpointer value, gpointer user_data)
+{
+       enum connman_service_type *type = user_data;
+
+       __connman_technology_remove_rfkill(*(unsigned int *)key, *type);
+
+}
+
 int __connman_technology_remove_device(struct connman_device *device)
 {
        struct connman_technology *technology;
@@ -750,6 +762,7 @@ int __connman_technology_remove_device(struct 
connman_device *device)
        DBG("device %p", device);
 
        type = __connman_device_get_service_type(device);
+       __connman_notifier_disable(type);
        __connman_notifier_unregister(type);
 
        technology = technology_find(type);
@@ -759,8 +772,9 @@ int __connman_technology_remove_device(struct 
connman_device *device)
        technology->device_list = g_slist_remove(technology->device_list,
                                                                device);
        if (technology->device_list == NULL) {
-               technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
-               state_changed(technology);
+               g_hash_table_foreach(technology->rfkill_list, remove_rfkill,
+                                                               &type);
+               technology_put(technology);
        }
 
        return 0;
-- 
1.7.2.2

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to