Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-wpa_supplicant_6: Commit

external/wpa_supplicant_6


Commit MetaInfo

Révisioneee21e1de8514a43f3e9089c136e7e27cc27a9fc (tree)
l'heure2011-03-23 01:55:48
AuteurDmitry Shmidt <dimitrysh@goog...>
CommiterDmitry Shmidt

Message de Log

Add SCAN_INTERVAL command and remove system property access

Change-Id: Ia6fcdc44cf65b861d978f851bbe79b09b015d3c2
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

Change Summary

Modification

--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -424,6 +424,17 @@ static int wpa_supplicant_ctrl_iface_bssid(struct wpa_supplicant *wpa_s,
424424 }
425425
426426 #ifdef ANDROID
427+static int wpa_supplicant_ctrl_iface_scan_interval(
428+ struct wpa_supplicant *wpa_s, char *cmd)
429+{
430+ int scan_int = atoi(cmd);
431+ if (scan_int < 0)
432+ return -1;
433+ wpa_s->scan_interval = scan_int;
434+ return 0;
435+}
436+
437+
427438 static int wpa_supplicant_ctrl_iface_blacklist(
428439 struct wpa_supplicant *wpa_s, char *cmd, char *buf, size_t buflen)
429440 {
@@ -1737,6 +1748,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
17371748 if (wpa_supplicant_ctrl_iface_bssid(wpa_s, buf + 6))
17381749 reply_len = -1;
17391750 #ifdef ANDROID
1751+ } else if (os_strncmp(buf, "SCAN_INTERVAL ", 14) == 0) {
1752+ reply_len = wpa_supplicant_ctrl_iface_scan_interval(
1753+ wpa_s, buf + 14);
17401754 } else if (os_strncmp(buf, "BLACKLIST", 9) == 0) {
17411755 reply_len = wpa_supplicant_ctrl_iface_blacklist(
17421756 wpa_s, buf + 9, reply, reply_size);
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -748,6 +748,26 @@ static int wpa_cli_cmd_bssid(struct wpa_ctrl *ctrl, int argc, char *argv[])
748748
749749
750750 #ifdef ANDROID
751+static int wpa_cli_cmd_scan_interval(struct wpa_ctrl *ctrl, int argc,
752+ char *argv[])
753+{
754+ char cmd[256];
755+ int res;
756+
757+ if (argc != 1) {
758+ printf("Invalid SCAN_INTERVAL command: needs one argument "
759+ "scan_interval value)\n");
760+ return -1;
761+ }
762+ res = os_snprintf(cmd, sizeof(cmd), "SCAN_INTERVAL %s", argv[0]);
763+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
764+ printf("Too long SCAN_INTERVAL command.\n");
765+ return -1;
766+ }
767+ return wpa_ctrl_command(ctrl, cmd);
768+}
769+
770+
751771 static int wpa_cli_cmd_blacklist(struct wpa_ctrl *ctrl, int argc, char *argv[])
752772 {
753773 char cmd[256], *pos, *end;
@@ -1262,6 +1282,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
12621282 cli_cmd_flag_none,
12631283 "<network id> <BSSID> = set preferred BSSID for an SSID" },
12641284 #ifdef ANDROID
1285+ { "scan_interval", wpa_cli_cmd_scan_interval,
1286+ cli_cmd_flag_none,
1287+ "<value> = set scan_interval parameter" },
12651288 { "blacklist", wpa_cli_cmd_blacklist,
12661289 cli_cmd_flag_none,
12671290 "<BSSID> = add a BSSID to the blacklist\n"
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -39,9 +39,6 @@
3939 #include "blacklist.h"
4040 #include "wpas_glue.h"
4141 #include "wps_supplicant.h"
42-#ifdef ANDROID
43-#include <cutils/properties.h>
44-#endif
4542
4643 const char *wpa_supplicant_version =
4744 "wpa_supplicant v" VERSION_STR "\n"
@@ -1733,7 +1730,9 @@ static struct wpa_supplicant * wpa_supplicant_alloc(void)
17331730 if (wpa_s == NULL)
17341731 return NULL;
17351732 wpa_s->scan_req = 1;
1736-
1733+#ifdef ANDROID
1734+ wpa_s->scan_interval = 5;
1735+#endif
17371736 return wpa_s;
17381737 }
17391738
@@ -2005,16 +2004,6 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
20052004 return NULL;
20062005 }
20072006
2008-#ifdef ANDROID
2009- char scan_prop[PROPERTY_VALUE_MAX];
2010- char *endp;
2011- if (property_get("wifi.supplicant_scan_interval", scan_prop, "6") != 0) {
2012- wpa_s->scan_interval = (int)strtol(scan_prop, &endp, 0);
2013- if (endp == scan_prop) {
2014- wpa_s->scan_interval = 6;
2015- }
2016- }
2017-#endif
20182007 wpa_s->next = global->ifaces;
20192008 global->ifaces = wpa_s;
20202009
Afficher sur ancien navigateur de dépôt.