aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2011-05-24 15:31:25 -0700
committerDmitry Shmidt <dimitrysh@google.com>2011-05-24 15:31:25 -0700
commit886c3ff164ee2c0e281f4b1f31ce2b00f045f9de (patch)
treeb8dc9a28021766ade4c69ea797a136c25e961d23 /src
parent405b5aff6d655ee9a28652b5cbce47b320573ec5 (diff)
downloadwpa_supplicant_8-886c3ff164ee2c0e281f4b1f31ce2b00f045f9de.tar.gz
WEXT: Add accumulative Android patch
Change-Id: I167f3a5e8513645a4693672f44b6df369a3f97fe Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_wext.c48
-rw-r--r--src/drivers/driver_wext.h11
2 files changed, 57 insertions, 2 deletions
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index e7311017..01394783 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -43,7 +43,12 @@ static int wpa_driver_wext_get_range(void *priv);
static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv);
static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv);
static int wpa_driver_wext_set_auth_alg(void *priv, int auth_alg);
-
+#ifdef ANDROID
+extern int wpa_driver_wext_driver_cmd(void *priv, char *cmd, char *buf,
+ size_t buf_len);
+extern int wpa_driver_wext_combo_scan(void *priv,
+ struct wpa_driver_scan_params *params);
+#endif
int wpa_driver_wext_set_auth_param(struct wpa_driver_wext_data *drv,
int idx, u32 value)
@@ -302,6 +307,14 @@ wpa_driver_wext_event_wireless_custom(void *ctx, char *custom)
}
wpa_supplicant_event(ctx, EVENT_STKSTART, &data);
#endif /* CONFIG_PEERKEY */
+#ifdef ANDROID
+ } else if (os_strncmp(custom, "STOP", 4) == 0) {
+ wpa_msg(ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STOPPED");
+ } else if (os_strncmp(custom, "START", 5) == 0) {
+ wpa_msg(ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STARTED");
+ } else if (os_strncmp(custom, "HANG", 4) == 0) {
+ wpa_msg(ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
+#endif /* ANDROID */
}
}
@@ -819,6 +832,12 @@ void * wpa_driver_wext_init(void *ctx, const char *ifname)
}
drv->mlme_sock = -1;
+#ifdef ANDROID
+ drv->errors = 0;
+ drv->driver_is_started = TRUE;
+ drv->skip_disconnect = 0;
+ drv->bgscan_enabled = 0;
+#endif
if (wpa_driver_wext_finish_drv_init(drv) < 0)
goto err3;
@@ -980,6 +999,13 @@ int wpa_driver_wext_scan(void *priv, struct wpa_driver_scan_params *params)
const u8 *ssid = params->ssids[0].ssid;
size_t ssid_len = params->ssids[0].ssid_len;
+#ifdef ANDROID
+ if (drv->capa.max_scan_ssids > 1) {
+ ret = wpa_driver_wext_combo_scan(priv, params);
+ goto scan_out;
+ }
+#endif
+
if (ssid_len > IW_ESSID_MAX_SIZE) {
wpa_printf(MSG_DEBUG, "%s: too long SSID (%lu)",
__FUNCTION__, (unsigned long) ssid_len);
@@ -1005,9 +1031,12 @@ int wpa_driver_wext_scan(void *priv, struct wpa_driver_scan_params *params)
ret = -1;
}
+#ifdef ANDROID
+scan_out:
+#endif
/* Not all drivers generate "scan completed" wireless event, so try to
* read results after a timeout. */
- timeout = 5;
+ timeout = 10;
if (drv->scan_complete_events) {
/*
* The driver seems to deliver SIOCGIWSCAN events to notify
@@ -1539,7 +1568,11 @@ static int wpa_driver_wext_get_range(void *priv)
drv->capa.auth = WPA_DRIVER_AUTH_OPEN |
WPA_DRIVER_AUTH_SHARED |
WPA_DRIVER_AUTH_LEAP;
+#ifdef ANDROID
+ drv->capa.max_scan_ssids = WEXT_CSCAN_AMOUNT;
+#else
drv->capa.max_scan_ssids = 1;
+#endif
wpa_printf(MSG_DEBUG, " capabilities: key_mgmt 0x%x enc 0x%x "
"flags 0x%x",
@@ -1848,7 +1881,11 @@ static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
* BSSID and SSID.
*/
if (wpa_driver_wext_set_bssid(drv, null_bssid) < 0 ||
+#ifdef ANDROID
+ 0) {
+#else
wpa_driver_wext_set_ssid(drv, (u8 *) "", 0) < 0) {
+#endif
wpa_printf(MSG_DEBUG, "WEXT: Failed to clear "
"to disconnect");
}
@@ -1863,7 +1900,11 @@ static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
for (i = 0; i < 32; i++)
ssid[i] = rand() & 0xFF;
if (wpa_driver_wext_set_bssid(drv, null_bssid) < 0 ||
+#ifdef ANDROID
+ 0) {
+#else
wpa_driver_wext_set_ssid(drv, ssid, 32) < 0) {
+#endif
wpa_printf(MSG_DEBUG, "WEXT: Failed to set bogus "
"BSSID/SSID to disconnect");
}
@@ -2317,4 +2358,7 @@ const struct wpa_driver_ops wpa_driver_wext_ops = {
.get_capa = wpa_driver_wext_get_capa,
.set_operstate = wpa_driver_wext_set_operstate,
.get_radio_name = wext_get_radio_name,
+#ifdef ANDROID
+ .driver_cmd = wpa_driver_wext_driver_cmd,
+#endif
};
diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h
index 89c13eb7..51e4d98a 100644
--- a/src/drivers/driver_wext.h
+++ b/src/drivers/driver_wext.h
@@ -50,6 +50,12 @@ struct wpa_driver_wext_data {
int cfg80211; /* whether driver is using cfg80211 */
u8 max_level;
+#ifdef ANDROID
+ int errors;
+ int driver_is_started;
+ int skip_disconnect;
+ int bgscan_enabled;
+#endif
};
int wpa_driver_wext_get_bssid(void *priv, u8 *bssid);
@@ -84,4 +90,9 @@ int wpa_driver_wext_set_auth_param(struct wpa_driver_wext_data *drv,
int wpa_driver_wext_cipher2wext(int cipher);
int wpa_driver_wext_keymgmt2wext(int keymgmt);
+#ifdef ANDROID
+#define WPA_EVENT_DRIVER_STATE "CTRL-EVENT-DRIVER-STATE "
+#define WEXT_CSCAN_AMOUNT 9
+#endif
+
#endif /* DRIVER_WEXT_H */