aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/scan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-18 18:27:22 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:40 -0500
commita77b855245541823b49999a27245ad7428879096 (patch)
tree29e80ea3f90a22309b55ea1823eda5700ebc4b49 /net/wireless/scan.c
parentcfg80211: age scan results on resume (diff)
downloadlinux-dev-a77b855245541823b49999a27245ad7428879096.tar.xz
linux-dev-a77b855245541823b49999a27245ad7428879096.zip
cfg80211/mac80211: fill qual.qual value/adjust max_qual.qual
Due to various bugs in the software stack we end up having to fill qual.qual; level should be used, but wpa_supplicant doesn't properly ignore qual.qual, NM should use qual.level regardless of that because qual.qual is 0 but doesn't handle IW_QUAL_DBM right now. So fill qual.qual with the qual.level value clamped to -110..-40 dBm or just the regular 'unspecified' signal level. This requires a mac80211 change to properly announce the max_qual.qual and avg_qual.qual values. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/scan.c')
-rw-r--r--net/wireless/scan.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 9fad1631d6cb..01c136d98c5b 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -614,7 +614,7 @@ ieee80211_bss(struct iw_request_info *info,
struct iw_event iwe;
u8 *buf, *cfg, *p;
u8 *ie = bss->pub.information_elements;
- int rem = bss->pub.len_information_elements, i;
+ int rem = bss->pub.len_information_elements, i, sig;
bool ismesh = false;
memset(&iwe, 0, sizeof(iwe));
@@ -643,14 +643,23 @@ ieee80211_bss(struct iw_request_info *info,
iwe.cmd = IWEVQUAL;
iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED |
IW_QUAL_NOISE_INVALID |
- IW_QUAL_QUAL_INVALID;
+ IW_QUAL_QUAL_UPDATED;
switch (bss->pub.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
- iwe.u.qual.level = bss->pub.signal / 100;
+ sig = bss->pub.signal / 100;
+ iwe.u.qual.level = sig;
iwe.u.qual.updated |= IW_QUAL_DBM;
+ if (sig < -110) /* rather bad */
+ sig = -110;
+ else if (sig > -40) /* perfect */
+ sig = -40;
+ /* will give a range of 0 .. 70 */
+ iwe.u.qual.qual = sig + 110;
break;
case CFG80211_SIGNAL_TYPE_UNSPEC:
iwe.u.qual.level = bss->pub.signal;
+ /* will give range 0 .. 100 */
+ iwe.u.qual.qual = bss->pub.signal;
break;
default:
/* not reached */