From 43e7b0260857b48f19aa4165699453dd6608bb3b Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Thu, 5 Aug 2010 16:38:12 +0200 Subject: [PATCH] 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. --- src/device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); + } } -- 2.7.4