quality as a logarithm.



So, despite Dan's excellent efforts, most drivers do not seem to treat
quality as a linear percentage, but on a logarithmic scale (as signal
strengths are usually represented).

Consequently, it seems that signal values are much more accurate with
the attached patch.

Of course, this goes against Dan's laudable goal of having all drivers
export strength as a linear percentage.

But we must ask:  How many drivers actually do this?  In my testing,
nearly all output the strength as a logarithm.

Indeed, in Netapplet we scaled the quality via

	log (quality) / log (max)

as I do in the attached patch.

Any ideas on how to proceed?  If most drivers still export things
logarithmically, the current code is more wrong than right.

It would be nice if we could detect what machinations the driver applied
to the quality -- or, even better -- if the driver left well enough
alone, but the world, especially the world of wireless, is evil and
awful.

	Robert Love

Index: src/NetworkManagerWireless.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerWireless.c,v
retrieving revision 1.32
diff -u -r1.32 NetworkManagerWireless.c
--- src/NetworkManagerWireless.c	7 Oct 2005 17:24:56 -0000	1.32
+++ src/NetworkManagerWireless.c	31 Oct 2005 20:20:39 -0000
@@ -158,7 +158,7 @@
 	 * are free to use whatever they want to calculate "Link Quality".
 	 */
 	if ((max_qual->qual != 0) && !(max_qual->updated & IW_QUAL_QUAL_INVALID) && !(qual->updated & IW_QUAL_QUAL_INVALID))
-		percent = (int)(100 * ((double)qual->qual / (double)max_qual->qual));
+		percent = (int)(100 * (log (qual->qual) / log (max_qual->qual)));
 
 	/* If the driver doesn't specify a complete and valid quality, we have two options:
 	 *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]