aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2011-11-23 14:21:15 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-24 20:46:38 (GMT)
commit7e6f5d1e0c881e0e1a1b608f6d211bc1bb496bbf (patch)
treed3963ea9ecb495e9b137abeba6674e3a6ded59e0
parent13f2221fc6f53e150c006fd768e989e7e38589bb (diff)
downloadhostap-7e6f5d1e0c881e0e1a1b608f6d211bc1bb496bbf.zip
hostap-7e6f5d1e0c881e0e1a1b608f6d211bc1bb496bbf.tar.gz
hostap-7e6f5d1e0c881e0e1a1b608f6d211bc1bb496bbf.tar.bz2
Android: Add private commands support for nl80211
Change-Id: If189933aaf6e629fe8ede0f4e0d0b527f3b47f2e Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--src/drivers/driver_nl80211.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index b9b5744..a8ff3a3 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10999,6 +10999,8 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct ifreq ifr;
+ android_wifi_priv_cmd priv_cmd;
int ret = 0;
if (os_strcasecmp(cmd, "STOP") == 0) {
@@ -11031,9 +11033,33 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
if (!ret && (state != -1))
ret = os_snprintf(buf, buf_len, "POWERMODE = %d\n",
state);
- } else {
- wpa_printf(MSG_ERROR, "Unsupported command: %s", cmd);
- ret = -1;
+ } else { /* Use private command */
+ memset(&ifr, 0, sizeof(ifr));
+ memset(&priv_cmd, 0, sizeof(priv_cmd));
+ os_memcpy(buf, cmd, strlen(cmd) + 1);
+ os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
+
+ priv_cmd.buf = buf;
+ priv_cmd.used_len = buf_len;
+ priv_cmd.total_len = buf_len;
+ ifr.ifr_data = &priv_cmd;
+
+ if ((ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1,
+ &ifr)) < 0) {
+ wpa_printf(MSG_ERROR, "%s: failed to issue private "
+ "commands\n", __func__);
+ wpa_driver_send_hang_msg(drv);
+ } else {
+ drv_errors = 0;
+ ret = 0;
+ if ((os_strcasecmp(cmd, "LINKSPEED") == 0) ||
+ (os_strcasecmp(cmd, "RSSI") == 0) ||
+ (os_strcasecmp(cmd, "GETBAND") == 0))
+ ret = strlen(buf);
+
+ wpa_printf(MSG_DEBUG, "%s %s len = %d, %d", __func__,
+ buf, ret, strlen(buf));
+ }
}
return ret;