#define WLAN_DRIVER_SCRIPT "/usr/bin/wlan.sh"
+#define WLAN_SUPPLICANT_SCRIPT "/usr/sbin/wpa_supp.sh"
static gboolean power_in_progress = FALSE;
static gboolean fm_waiting = FALSE;
return reply;
}
+static int __netconfig_wifi_supplicant(gboolean enable)
+{
+ int rv = 0;
+ const char *path = WLAN_SUPPLICANT_SCRIPT;
+ char *const args_enable[] = { "/usr/sbin/wpa_supp.sh", "start", NULL };
+ char *const args_disable[] = { "/usr/sbin/wpa_supp.sh", "stop", NULL };
+ char *const envs[] = { NULL };
+ static gboolean enabled = FALSE;
+
+ if (enabled == enable)
+ return -EALREADY;
+
+ if (enable == TRUE)
+ rv = netconfig_execute_file(path, args_enable, envs);
+ else
+ rv = netconfig_execute_file(path, args_disable, envs);
+ if (rv < 0)
+ return -EIO;
+
+ DBG("wpa_supplicant %s", enable == TRUE ? "started" : "stopped");
+
+ enabled = enable;
+
+ return 0;
+}
+
+
static gboolean __netconfig_wifi_load_driver(void)
{
gboolean rv = FALSE;
DBG("Failed to load wireless device driver");
return FALSE;
}
+#else
+ /*start the Supplicant Daemon*/
+ int err = 0;
+ err = __netconfig_wifi_supplicant(TRUE);
+ if (err < 0 && err != -EALREADY)
+ return err;
+
#endif
+
DBG("Successfully loaded wireless device driver");
return TRUE;
}
DBG("Failed to remove wireless device driver");
return FALSE;
}
+#else
+ /*Stop the Supplicant Daemon*/
+ int err = 0;
+ err = __netconfig_wifi_supplicant(FALSE);
+ if (err < 0 && err != -EALREADY)
+ return err;
+
#endif
+
DBG("Successfully removed wireless device driver");
return TRUE;
}
static int __netconfig_wifi_try_to_load_driver(void)
{
+
if (netconfig_is_wifi_allowed() != TRUE)
return -EPERM;