Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134874
b: refs/heads/master
c: a77b855
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 27, 2009
1 parent fd099ce commit 5d0a3e4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb3a8eec0e66edfe8db7d3b3bf19d25745bae3c3
refs/heads/master: a77b855245541823b49999a27245ad7428879096
18 changes: 16 additions & 2 deletions trunk/net/mac80211/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,24 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
else
range->max_qual.noise = 0;

range->max_qual.qual = 100;
range->max_qual.updated = ieee80211_get_wstats_flags(local);

range->avg_qual.qual = 50;
if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
/*
* cfg80211 assumes -110 to -40 dBm and clamps to that range
* for qual.qual, so tell userspace this is what we give it
* but take into account that we have to start from 0.
*/
range->max_qual.qual = 70;
range->avg_qual.qual = 35;
} else {
/*
* cfg80211 just uses the level value for qual too, and it
* requires the level value to be 0 .. 100.
*/
range->max_qual.qual = 100;
range->avg_qual.qual = 50;
}
/* not always true but better than nothing */
range->avg_qual.level = range->max_qual.level / 2;
range->avg_qual.noise = range->max_qual.noise / 2;
Expand Down
15 changes: 12 additions & 3 deletions trunk/net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 5d0a3e4

Please sign in to comment.