From: Samuel Ortiz Date: Thu, 5 Aug 2010 14:38:12 +0000 (+0200) Subject: Disable offline devices upon device_set_connected(TRUE) calls X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~2504 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e7b0260857b48f19aa4165699453dd6608bb3b;p=profile%2Fivi%2Fconnman.git 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. --- 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); + } }