net: wireless: bcmdhd: Add setband/getband private commands

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt
2011-07-08 15:33:58 -07:00
parent 2d7bb94169
commit 8c3bcb4285
3 changed files with 46 additions and 0 deletions

View File

@@ -66,6 +66,8 @@
#define CMD_BTCOEXMODE "BTCOEXMODE"
#define CMD_SETSUSPENDOPT "SETSUSPENDOPT"
#define CMD_SETFWPATH "SETFWPATH"
#define CMD_SETBAND "SETBAND"
#define CMD_GETBAND "GETBAND"
typedef struct android_wifi_priv_cmd {
char *buf;
@@ -161,6 +163,19 @@ static int wl_android_set_suspendopt(struct net_device *dev, char *command, int
return ret;
}
static int wl_android_get_band(struct net_device *dev, char *command, int total_len)
{
uint band;
int bytes_written;
int error;
error = wldev_get_band(dev, &band);
if (error)
return -1;
bytes_written = snprintf(command, total_len, "Band %d", band);
return bytes_written;
}
/**
* Global function definitions (declared in wl_android.h)
*/
@@ -313,6 +328,13 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
}
else if (strnicmp(command, CMD_SETSUSPENDOPT, strlen(CMD_SETSUSPENDOPT)) == 0) {
bytes_written = wl_android_set_suspendopt(net, command, priv_cmd->total_len);
}
else if (strnicmp(command, CMD_SETBAND, strlen(CMD_SETBAND)) == 0) {
uint band = *(command + strlen(CMD_SETBAND) + 1) - '0';
bytes_written = wldev_set_band(net, band);
}
else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
bytes_written = wl_android_get_band(net, command, priv_cmd->total_len);
} else {
DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
snprintf(command, 3, "OK");

View File

@@ -288,3 +288,23 @@ int wldev_get_ssid(
pssid->SSID_len = dtoh32(pssid->SSID_len);
return error;
}
int wldev_get_band(
struct net_device *dev, uint *pband)
{
int error;
error = wldev_ioctl(dev, WLC_GET_BAND, pband, sizeof(uint), 0);
return error;
}
int wldev_set_band(
struct net_device *dev, uint band)
{
int error = -1;
if ((band == WLC_BAND_AUTO) || (band == WLC_BAND_5G) || (band == WLC_BAND_2G)) {
error = wldev_ioctl(dev, WLC_SET_BAND, &band, sizeof(band), 1);
}
return error;
}

View File

@@ -90,4 +90,8 @@ int wldev_get_rssi(struct net_device *dev, int *prssi);
int wldev_get_ssid(struct net_device *dev, wlc_ssid_t *pssid);
int wldev_get_band(struct net_device *dev, uint *pband);
int wldev_set_band(struct net_device *dev, uint band);
#endif /* __WLDEV_COMMON_H__ */