technology: Enable tech if device is already powered
authorAlok Barsode <alok.barsode@linux.intel.com>
Fri, 24 Feb 2012 14:17:59 +0000 (16:17 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 1 Mar 2012 12:45:25 +0000 (13:45 +0100)
connman_technology_add_device() calls __connman_device_enable()
but since the device is already enabled, the calls does not propagate
through to __connman_technology_enabled via connman_device_set_powered.

src/technology.c

index 4a0f9f1..91308a1 100644 (file)
@@ -1044,8 +1044,17 @@ int __connman_technology_add_device(struct connman_device *device)
                return -ENXIO;
        }
 
-       if (technology->enable_persistent && !global_offlinemode)
-               __connman_device_enable(device);
+       if (technology->enable_persistent && !global_offlinemode) {
+               int err = __connman_device_enable(device);
+               /*
+                * connman_technology_add_device() calls __connman_device_enable()
+                * but since the device is already enabled, the calls does not
+                * propagate through to connman_technology_enabled via
+                * connman_device_set_powered.
+                */
+               if (err == -EALREADY)
+                       __connman_technology_enabled(type);
+       }
        /* if technology persistent state is offline */
        if (!technology->enable_persistent)
                __connman_device_disable(device);