diff options
-rw-r--r-- | src/device.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 33ee896e..e3d4d04e 100644 --- a/src/device.c +++ b/src/device.c @@ -206,12 +206,14 @@ int __connman_device_enable(struct connman_device *device) if (device->powered_pending == TRUE) return -EALREADY; - device->powered_pending = TRUE; - err = device->driver->enable(device); - if (err < 0) + if (err < 0) { + if (err == -EINPROGRESS) + device->powered_pending = TRUE; return err; + } + device->powered_pending = TRUE; device->powered = TRUE; __connman_technology_enable_device(device); @@ -234,8 +236,6 @@ int __connman_device_disable(struct connman_device *device) if (device->powered_pending == FALSE) return -EALREADY; - device->powered_pending = FALSE; - device->reconnect = FALSE; clear_scan_trigger(device); @@ -243,9 +243,13 @@ 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) { + if (err == -EINPROGRESS) + device->powered_pending = FALSE; return err; + } + device->powered_pending = FALSE; device->powered = FALSE; __connman_technology_disable_device(device); |