diff options
author | Sascha Wessel <sascha.wessel@aisec.fraunhofer.de> | 2019-10-21 08:48:50 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2019-10-21 08:48:50 +0200 |
commit | 3d6b1b576b3c1acd6d2932da454171cfd8e22821 (patch) | |
tree | dd4c1111c077eebb4d1812a984736ff2eb6ae262 | |
parent | 807b72a8b1b8a4f092a5683fb00586755ee3944e (diff) |
wireless: update %signal and %quality based on station info on Linux (#368)
Use station info instead of bss info to update %signal and %quality.
Bss info is based on scan info and doesn't get updated often. Station
info get's updated with every beacon. Bss info still used as fallback.
-rw-r--r-- | src/print_wireless_info.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 6215704..c6df4cb 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -189,6 +189,16 @@ static int gwi_sta_cb(struct nl_msg *msg, void *data) { // used to specify bit/s, so we convert to use the same code path. info->bitrate = (int)nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]) * 100 * 1000; + if (sinfo[NL80211_STA_INFO_SIGNAL] != NULL) { + info->flags |= WIRELESS_INFO_FLAG_HAS_SIGNAL; + info->signal_level = (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]); + + info->flags |= WIRELESS_INFO_FLAG_HAS_QUALITY; + info->quality = nl80211_xbm_to_percent(info->signal_level, 1); + info->quality_max = 100; + info->quality_average = 50; + } + return NL_SKIP; } |