diff options
author | Yotam Rubin <yotam@wizery.com> | 2011-12-26 18:39:16 +0200 |
---|---|---|
committer | Arik Nemtsov <arik@wizery.com> | 2012-08-02 13:04:00 +0300 |
commit | ec19d050266d8aba9c19ea09dd9661b2d7de2bd0 (patch) | |
tree | ce88d4f4e894cd2d24e48a6aa1d5d43e36b37bf9 /src/drivers | |
parent | 14b5eb2853e92bea7af21d2c05b251bef0880c88 (diff) | |
download | external_wpa_supplicant_8_ti-ec19d050266d8aba9c19ea09dd9661b2d7de2bd0.zip external_wpa_supplicant_8_ti-ec19d050266d8aba9c19ea09dd9661b2d7de2bd0.tar.gz external_wpa_supplicant_8_ti-ec19d050266d8aba9c19ea09dd9661b2d7de2bd0.tar.bz2 |
nl80211: Implement some private cmds
Implement the LINKSPEED and RSSI/RSSI-APPROX private commands.
Upstream implementation sends the HANGED state event on
private command failure. Unimplemented commands were
sent to the driver as-is, causing the HANGED event to be sent
and cause a recovery. Private command handling was modified so
that only implemented commands are sent to the driver and
the sending of the HANGED event was removed.
[Arik - The "linkspeed" driver command incorrectly reported the
rate in kbps. Fix this]
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Yotam Rubin <yotam@wizery.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/driver_nl80211.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 28a9a6d..5c197f5 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9687,34 +9687,36 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, return nl80211_set_wowlan_triggers(bss, 1); } else if( os_strcasecmp(cmd, "RXFILTER-STOP") == 0 ) { return nl80211_set_wowlan_triggers(bss, 0); - } else { /* Use private command */ - memset(&ifr, 0, sizeof(ifr)); - memset(&priv_cmd, 0, sizeof(priv_cmd)); - os_memcpy(buf, cmd, strlen(cmd) + 1); - os_strncpy(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) || - (os_strcasecmp(cmd, "P2P_GET_NOA") == 0)) - ret = strlen(buf); - - wpa_printf(MSG_DEBUG, "%s %s len = %d, %d", __func__, - buf, ret, strlen(buf)); + } else if( os_strcasecmp(cmd, "LINKSPEED") == 0 ) { + struct wpa_signal_info sig; + int linkspeed; + + if (!drv->associated) + return -1; + + ret = nl80211_get_link_signal(drv, &sig); + if (ret == 0) { + linkspeed = sig.current_txrate / 1000; + ret = os_snprintf(buf, buf_len, "LinkSpeed %d\n", + linkspeed); + } + } else if (os_strcasecmp(cmd, "RSSI") == 0 || + os_strcasecmp(cmd, "RSSI-APPROX") == 0) { + struct wpa_signal_info sig; + int rssi; + + if (!drv->associated) + return -1; + + ret = nl80211_get_link_signal(drv, &sig); + if (ret == 0) { + rssi = sig.current_signal; + ret = os_snprintf(buf, buf_len, "%s rssi %d\n", + drv->ssid, rssi); } + } else { + wpa_printf(MSG_ERROR, "Unsupported command: %s", cmd); + ret = -1; } return ret; |