Add AVG_BEACON_RSSI to SIGNAL_POLL output
authorJouni Malinen <j@w1.fi>
Sun, 15 Mar 2015 18:45:20 +0000 (20:45 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 15 Mar 2015 18:45:20 +0000 (20:45 +0200)
If the driver reports separate signal strength average for Beacon
frames, report that in SIGNAL_POLL output.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/ctrl_iface.c

index 03bd1a7..4074b87 100644 (file)
@@ -1477,6 +1477,7 @@ struct wpa_signal_info {
        int above_threshold;
        int current_signal;
        int avg_signal;
+       int avg_beacon_signal;
        int current_noise;
        int current_txrate;
        enum chan_width chanwidth;
index d743868..aaff9ab 100644 (file)
@@ -1187,6 +1187,7 @@ static int get_link_signal(struct nl_msg *msg, void *arg)
        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 },
+               [NL80211_STA_INFO_BEACON_SIGNAL_AVG] = { .type = NLA_U8 },
        };
        struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
        static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
@@ -1215,6 +1216,13 @@ static int get_link_signal(struct nl_msg *msg, void *arg)
        else
                sig_change->avg_signal = 0;
 
+       if (sinfo[NL80211_STA_INFO_BEACON_SIGNAL_AVG])
+               sig_change->avg_beacon_signal =
+                       (s8)
+                       nla_get_u8(sinfo[NL80211_STA_INFO_BEACON_SIGNAL_AVG]);
+       else
+               sig_change->avg_beacon_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 b4aefb6..4ebc3a1 100644 (file)
@@ -6476,6 +6476,14 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
                pos += ret;
        }
 
+       if (si.avg_beacon_signal) {
+               ret = os_snprintf(pos, end - pos,
+                                 "AVG_BEACON_RSSI=%d\n", si.avg_beacon_signal);
+               if (os_snprintf_error(end - pos, ret))
+                       return -1;
+               pos += ret;
+       }
+
        return pos - buf;
 }