diff options
author | Leena Gunda <leena.gunda@wipro.com> | 2010-11-25 20:41:38 +0530 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-11-26 19:38:29 +0100 |
commit | 6d3811f1bd54475c0f14e05c48775c7387cded63 (patch) | |
tree | 538be520a20bb0947a73e3c6d1b165e542b97f37 /src/device.c | |
parent | 0c610386c0162ca909a98a66009c10ec65849140 (diff) | |
download | connman-6d3811f1bd54475c0f14e05c48775c7387cded63.tar.gz connman-6d3811f1bd54475c0f14e05c48775c7387cded63.tar.bz2 connman-6d3811f1bd54475c0f14e05c48775c7387cded63.zip |
device: Support already powered devices
When a device is already powered up, the enable hook will return -EALREADY.
In that case, ConnMan should just set it to powered and enable its
underlying technology.
Fixes BMC#10397
Diffstat (limited to 'src/device.c')
-rw-r--r-- | src/device.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/device.c b/src/device.c index 3fab97ca..91806b74 100644 --- a/src/device.c +++ b/src/device.c @@ -192,7 +192,7 @@ int __connman_device_enable(struct connman_device *device) return -ENOLINK; err = device->driver->enable(device); - if (err < 0) { + if (err < 0 && err != -EALREADY) { if (err == -EINPROGRESS) { device->powered_pending = TRUE; device->offlinemode = FALSE; @@ -235,7 +235,7 @@ int __connman_device_disable(struct connman_device *device) g_hash_table_remove_all(device->networks); err = device->driver->disable(device); - if (err < 0) { + if (err < 0 && err != -EALREADY) { if (err == -EINPROGRESS) device->powered_pending = FALSE; return err; @@ -618,6 +618,8 @@ const char *connman_device_get_ident(struct connman_device *device) int connman_device_set_powered(struct connman_device *device, connman_bool_t powered) { + int err; + DBG("driver %p powered %d", device, powered); if (device->powered == powered) { @@ -626,9 +628,12 @@ int connman_device_set_powered(struct connman_device *device, } if (powered == TRUE) - __connman_device_enable(device); + err = __connman_device_enable(device); else - __connman_device_disable(device); + err = __connman_device_disable(device); + + if (err < 0 && err != -EINPROGRESS) + return err; device->powered = powered; device->powered_pending = powered; |