Subject: Re: [PATCH] bcm43xx-softmac: Further improvement in wireless statistics

From: Larry Finger <[email-masked]>
Date: Fri, 14 Jul 2006 12:09:50 -0500

Jean,

Jean Tourrilhes wrote:
> 
> 	I must admit that the original definition was too clever (or
> too ambiguous, or too original, take your pick). range->max_qual.level
> is always supposed to have a meaningfull value. People that did not
> understand that original definition just put 0 there, as it was the
> easiest way to output dBm.
> 	If you want more details, check the comment in the function
> iw_print_stats() in iwlib.c.
> 	As I say, range->max_qual.level is always supposed to have
> something useful, so :
> 
> if(IW_QUAL_DBM == 0)
> 	rssi level in the range [0 ; range->max_qual.level]
> if(IW_QUAL_DBM == 1)
> 	(rssi level - 256) in the range [range->max_qual.level - 256 ; 0]

Thank you for your explanation and the reference to the comment from wireless_tools. I think it is 
safe to say that we all have learned a lot. As you say, 8-bit arithmetic is tricky.

> 	I think WE-19 is old enough (most distro seems to use 2.6.16)
> that we don't have to bother about earlier version going forward.

I'm going to rely on that, set IW_QUAL_DBM, and choose the max_qual at 152, which corresponds to a 
floor-value of -104 dBm. The KDE applet display is a little strange as it displays -65 dBm at 
approximately 2/3 height, rather than the 1/3 value that I would expect. So far, I have not found 
the source for that applet and cannot verify the calculation. In any case, the display is acceptable 
even if not what I would expect. At least, the values in /proc/net/wireless are correct.

Thanks again,

Larry