commit 08de8186c6f2d8e1b2f53c391f9778d1d8a7f1b7
parent cf17d42972519f4fa3220f827784f5ffacc7a302
Author: James Prestwood <prestwoj@gmail.com>
Date: Tue, 12 Jan 2021 09:17:22 -0800
netdev: update RSSI polling to use station info parser
Diffstat:
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -408,6 +408,7 @@ static void netdev_rssi_poll_cb(struct l_genl_msg *msg, void *user_data)
uint16_t type, len;
const void *data;
bool found;
+ struct netdev_station_info info;
uint8_t prev_rssi_level_idx = netdev->cur_rssi_level_idx;
netdev->rssi_poll_cmd_id = 0;
@@ -420,29 +421,21 @@ static void netdev_rssi_poll_cb(struct l_genl_msg *msg, void *user_data)
if (type != NL80211_ATTR_STA_INFO)
continue;
- found = true;
- break;
- }
-
- if (!found || !l_genl_attr_recurse(&attr, &nested))
- goto done;
-
- found = false;
- while (l_genl_attr_next(&nested, &type, &len, &data)) {
- if (type != NL80211_STA_INFO_SIGNAL_AVG)
- continue;
+ if (!l_genl_attr_recurse(&attr, &nested))
+ goto done;
- if (len != 1)
- continue;
+ if (!netdev_parse_sta_info(&nested, &info))
+ goto done;
found = true;
- netdev->cur_rssi = *(const int8_t *) data;
break;
}
- if (!found)
+ if (!found || !info.have_cur_rssi)
goto done;
+ netdev->cur_rssi = info.cur_rssi;
+
/*
* Note we don't have to handle LOW_SIGNAL_THRESHOLD here. The
* CQM single threshold RSSI monitoring should work even if the