]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add AVG_RSSI report in signal_poll
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Sat, 22 Jun 2013 08:59:29 +0000 (11:59 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 22 Jun 2013 09:01:05 +0000 (12:01 +0300)
Add AVG_RSSI report to the signal_poll command if it is reported by
the kernel.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-hostap: Ilan Peer <ilan.peer@intel.com>

src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/ctrl_iface.c

index 8da99e64c3bb44dd242f6fc4c497ccc9d487e85e..2dde0528c0e33f0d060712cbe9e9d705d2c5b94b 100644 (file)
@@ -1108,6 +1108,7 @@ struct wpa_signal_info {
        u32 frequency;
        int above_threshold;
        int current_signal;
+       int avg_signal;
        int current_noise;
        int current_txrate;
        enum chan_width chanwidth;
index 5a4f4a94f6b48c7cdcd5bd65b2a6c0e38e93f1c3..f705a0c4704f3d8facdee576781190c423b36c90 100644 (file)
@@ -1880,6 +1880,7 @@ static int get_link_signal(struct nl_msg *msg, void *arg)
        struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1];
        static struct nla_policy policy[NL80211_STA_INFO_MAX + 1] = {
                [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 },
+               [NL80211_STA_INFO_SIGNAL_AVG] = { .type = NLA_U8 },
        };
        struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
        static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
@@ -1902,6 +1903,12 @@ static int get_link_signal(struct nl_msg *msg, void *arg)
        sig_change->current_signal =
                (s8) nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]);
 
+       if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+               sig_change->avg_signal =
+                       (s8) nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]);
+       else
+               sig_change->avg_signal = 0;
+
        if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
                if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
                                     sinfo[NL80211_STA_INFO_TX_BITRATE],
index 0c81ed3b96bdd188007586e9b9f4e44bbb48edea..a9c771546e22373c9bde56da282100c80ce95911 100644 (file)
@@ -5060,6 +5060,14 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
                pos += ret;
        }
 
+       if (si.avg_signal) {
+               ret = os_snprintf(pos, end - pos,
+                                 "AVG_RSSI=%d\n", si.avg_signal);
+               if (ret < 0 || ret >= end - pos)
+                       return -1;
+               pos += ret;
+       }
+
        return pos - buf;
 }