Enable/Disable device when toggling the powered state
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 24 Mar 2010 12:04:54 +0000 (13:04 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 24 Mar 2010 14:10:44 +0000 (15:10 +0100)
When devices are brought up and down externally (e.g. with ifconfig),
connman_device_set_powered() needs to enable or disable them. If it doesnt,
the device associated networks are kept alive and we're still showing them
while the device is actually down.

src/device.c

index 6aeed01..2a8e7da 100644 (file)
@@ -967,6 +967,11 @@ int connman_device_set_powered(struct connman_device *device,
        if (device->powered == powered)
                return -EALREADY;
 
+       if (powered == TRUE)
+               __connman_device_enable(device);
+       else
+               __connman_device_disable(device);
+
        device->powered = powered;
        device->powered_pending = powered;