Skip to content

Commit

Permalink
am 4b3af3f: Add scan-channels command support (http://b/2213691)
Browse files Browse the repository at this point in the history
Merge commit '4b3af3f6ce0edf38a393c9a55e68a8d94725d810' into eclair-plus-aosp

* commit '4b3af3f6ce0edf38a393c9a55e68a8d94725d810':
  Add scan-channels command support (http://b/2213691)
  • Loading branch information
Dmitry Shmidt authored and Android Git Automerger committed Nov 3, 2009
2 parents 1c9049e + 4b3af3f commit 7b447c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
19 changes: 18 additions & 1 deletion driver_wext.c
Expand Up @@ -2498,7 +2498,18 @@ int wpa_driver_wext_get_version(struct wpa_driver_wext_data *drv)
}

#ifdef ANDROID
int wpa_driver_priv_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_len )
static char *wpa_driver_get_country_code(int channels)
{
char *country = "US"; /* WEXT_NUMBER_SCAN_CHANNELS_FCC */

if (channels == WEXT_NUMBER_SCAN_CHANNELS_ETSI)
country = "EU";
else if( channels == WEXT_NUMBER_SCAN_CHANNELS_MKK1)
country = "JP";
return country;
}

static int wpa_driver_priv_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_len )
{
struct wpa_driver_wext_data *drv = priv;
struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx);
Expand All @@ -2518,7 +2529,13 @@ int wpa_driver_priv_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_len
ret = -1;
return ret;
}
else if( os_strncasecmp(cmd, "SCAN-CHANNELS", 13) == 0 ) {
int no_of_chan;

no_of_chan = atoi(cmd + 13);
os_snprintf(cmd, MAX_DRV_CMD_SIZE, "COUNTRY %s",
wpa_driver_get_country_code(no_of_chan));
}
os_memset(&iwr, 0, sizeof(iwr));
os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
os_memcpy(buf, cmd, strlen(cmd) + 1);
Expand Down
5 changes: 5 additions & 0 deletions driver_wext.h
Expand Up @@ -46,7 +46,12 @@ int wpa_driver_wext_set_operstate(void *priv, int state);
int wpa_driver_wext_get_version(struct wpa_driver_wext_data *drv);

#ifdef ANDROID
#define WEXT_NUMBER_SCAN_CHANNELS_FCC 11
#define WEXT_NUMBER_SCAN_CHANNELS_ETSI 13
#define WEXT_NUMBER_SCAN_CHANNELS_MKK1 14

#define WPA_DRIVER_WEXT_WAIT_US 400000
#define MAX_DRV_CMD_SIZE 248
#endif

#endif /* DRIVER_WEXT_H */

0 comments on commit 7b447c3

Please sign in to comment.