[net-config] Suspend/Resume WLAN driver
[platform/core/connectivity/net-config.git] / src / wifi-state.c
index c29ac9d..237e2e0 100755 (executable)
@@ -541,12 +541,14 @@ void wifi_state_set_service_state(wifi_service_state_e new_state)
        DBG("Wi-Fi service state, old state[%s] ==> new state[%s]",
                _convert_wifi_service_state_to_string(old_state), _convert_wifi_service_state_to_string(new_state));
 
-       /* During DHCP, temporarily disable Wi-Fi power saving */
-       if ((old_state < NETCONFIG_WIFI_ASSOCIATION || old_state == NETCONFIG_WIFI_FAILURE) && new_state == NETCONFIG_WIFI_CONFIGURATION) {
+       /* From association, temporarily disable Wi-Fi power saving */
+       if ((old_state < NETCONFIG_WIFI_ASSOCIATION || old_state == NETCONFIG_WIFI_FAILURE) && new_state == NETCONFIG_WIFI_ASSOCIATION) {
                _set_power_lock(TRUE);
+               wifi_set_early_suspend(FALSE);
                dhcp_stage = TRUE;
-       } else if (dhcp_stage == TRUE) {
+       } else if (dhcp_stage == TRUE && new_state != NETCONFIG_WIFI_CONFIGURATION) {
                _set_power_lock(FALSE);
+               wifi_set_early_suspend(TRUE);
                dhcp_stage = FALSE;
        }
 
@@ -725,7 +727,7 @@ void wifi_state_get_connected_essid(gchar **essid)
  */
 gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context)
 {
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
        GVariant *param = NULL;
        wifi_tech_state_e tech_state = NETCONFIG_WIFI_TECH_UNKNOWN;
        wifi_service_state_e service_state = NETCONFIG_WIFI_UNKNOWN;