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.
This commit is contained in:
Sascha Wessel 2019-10-21 08:48:50 +02:00 committed by Michael Stapelberg
parent 807b72a8b1
commit 3d6b1b576b
1 changed files with 10 additions and 0 deletions

View File

@ -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;
}