#define WLAN_DRIVER_SCRIPT "/usr/bin/wlan.sh"
+static gboolean power_in_progress = FALSE;
+static gboolean fm_waiting = FALSE;
static gboolean __netconfig_wifi_enable_technology(void)
{
if (device_state == WIFI_DIRECT_DEVICE_STATE_DEACTIVATED) {
if (__netconfig_wifi_try_to_load_driver() < 0) {
+ power_in_progress = FALSE;
/* TODO: error report */
return;
}
-
- netconfig_wifi_notify_power_completed(TRUE);
}
}
}
if (netconfig_is_wifi_direct_on() == TRUE) {
- if (__netconfig_wifi_direct_power_off() == TRUE)
+ if (__netconfig_wifi_direct_power_off() == TRUE) {
+ power_in_progress = TRUE;
return -EINPROGRESS;
- else
+ } else
return -EBUSY;
}
return -EIO;
}
- __netconfig_wifi_enable_technology();
+ if (__netconfig_wifi_enable_technology() != TRUE) {
+ netconfig_wifi_remove_driver();
+ return -EIO;
+ }
+
+ power_in_progress = TRUE;
return 0;
}
netconfig_wifi_statistics_update_powered_off();
- __netconfig_wifi_disable_technology();
+ if (__netconfig_wifi_disable_technology() != TRUE)
+ return FALSE;
+
+ power_in_progress = TRUE;
return TRUE;
}
int wifi_state = 0;
static gboolean powered_off_by_flightmode = FALSE;
+ if (power_in_progress) {
+ fm_waiting = TRUE;
+ return;
+ }
+
+ fm_waiting = FALSE;
+
vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &value);
vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
prev_state = value;
}
+void netconfig_set_power_in_progress(gboolean in_progress)
+{
+ power_in_progress = in_progress;
+}
+
+void netconfig_check_fm_waiting(void)
+{
+ if (fm_waiting)
+ __netconfig_wifi_airplane_mode(NULL, NULL);
+}
+
void netconfig_wifi_power_configuration(void)
{
int wifi_last_power_state = 0;
return FALSE;
}
+ if (power_in_progress) {
+ netconfig_error_wifi_driver_failed(error);
+ return FALSE;
+ }
+
err = __netconfig_wifi_try_to_load_driver();
if (err < 0) {
if (err == -EINPROGRESS)
g_return_val_if_fail(wifi != NULL, FALSE);
+ if (power_in_progress) {
+ netconfig_error_wifi_driver_failed(error);
+ return FALSE;
+ }
+
if (__netconfig_wifi_try_to_remove_driver() != TRUE) {
netconfig_error_wifi_driver_failed(error);