technology: Register a rfkilled technology in technology_add_rfkill
authorAlok Barsode <alok.barsode@linux.intel.com>
Tue, 27 Sep 2011 08:47:17 +0000 (11:47 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 29 Sep 2011 16:20:10 +0000 (18:20 +0200)
If a technology was rfkilled before connman ran, we need to register
it. If such tech was enabled, technology->device_list will be empty.
We save the state, rfkill unblock the type and exit. When the devices
get unblocked, they are automatically enabled since we saved the enable
state.

src/technology.c

index 8214617..2b1763a 100644 (file)
@@ -859,6 +859,13 @@ int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg
 
        __connman_rfkill_block(technology->type, FALSE);
 
+       /*
+        * An empty device list means that devices in the technology
+        * were rfkill blocked. The unblock above will enable the devs.
+        */
+       if (technology->device_list == NULL)
+               return 0;
+
        for (list = technology->device_list; list; list = list->next) {
                struct connman_device *device = list->data;
 
@@ -1031,6 +1038,8 @@ int __connman_technology_add_rfkill(unsigned int index,
        if (rfkill == NULL)
                return -ENOMEM;
 
+       __connman_notifier_register(type);
+
        rfkill->index = index;
        rfkill->type = type;
        rfkill->softblock = softblock;