summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-08-05 14:38:12 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2010-08-06 13:14:45 (GMT)
commit43e7b0260857b48f19aa4165699453dd6608bb3b (patch)
treed2343aec3980db770c2c12505d4aea6eb5707581
parentd676d2dcc2ab9062bf3c252b67c6e756248c83b9 (diff)
downloadconnman-43e7b0260857b48f19aa4165699453dd6608bb3b.zip
connman-43e7b0260857b48f19aa4165699453dd6608bb3b.tar.gz
connman-43e7b0260857b48f19aa4165699453dd6608bb3b.tar.bz2
Disable offline devices upon device_set_connected(TRUE) calls
Some devices are powered up asynchronously, and one can potentially enable offline mode while the device is not powered up yet. The device thus needs to be turned back off when it's finally reported to be on.
-rw-r--r--src/device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index c1d74b6..39d86b5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1007,6 +1007,11 @@ int connman_device_set_powered(struct connman_device *device,
else
__connman_technology_disable_device(device);
+ if (device->offlinemode == TRUE && powered == TRUE) {
+ powered_changed(device);
+ return connman_device_set_powered(device, FALSE);
+ }
+
if (device->registered == FALSE)
return 0;
@@ -1070,8 +1075,10 @@ int __connman_device_enable_persistent(struct connman_device *device)
err = __connman_device_enable(device);
if (err == 0 || err == -EINPROGRESS) {
- if (__connman_profile_get_offlinemode() == TRUE)
+ if (__connman_profile_get_offlinemode() == TRUE) {
+ device->offlinemode = FALSE;
__connman_profile_set_offlinemode(FALSE, FALSE);
+ }
}