ports/54511: patch: net/wmwave: more portable data gathering

Hendrik Scholz hendrik at scholz.net
Tue Jul 15 19:10:17 UTC 2003


>Number:         54511
>Category:       ports
>Synopsis:       patch: net/wmwave: more portable data gathering
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 15 12:10:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hendrik Scholz
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD goanna.lan.raisdorf.net 5.1-RELEASE FreeBSD 5.1-RELEASE #4: Sat Jun 7 12:12:29 CEST 2003 hscholz at goanna.lan.raisdorf.net:/usr/src/sys/i386/compile/GOANNA i386


	
>Description:
wmwave works on Prism cards but not on Lucent ones (minipci and PCMCIA tested)
since wireq.wi_val is empty.
I've patched it to use a more portable way for data acquisition known
from gkrellm and other tools.
I've tested this with my Lucent mini PCI card and a PCMCIA Prism card.
Please DO TEST this before commiting.

The attached file is a diff between the file after 'make patch' has been
executed (and already patches by the port!).
A complete diff against the distribution source can be found here:
http://www.raisdorf.net/files/FreeBSD/wmwave-diff.patch

diff against already patch file:
http://www.raisdorf.net/files/FreeBSD/wmwave-patched-diff.patch

Additionally I renamed the three values to more common names.

>How-To-Repeat:
Try to use wmwave with an Orinoco based card.

>Fix:

	

--- wmwave-patched-diff.patch begins here ---
--- wmwave.c	Tue Jul 15 20:39:20 2003
+++ /home/hscholz/note/wmwave.c	Mon Jul  7 09:43:55 2003
@@ -1,11 +1,13 @@
 /*
  * $Id$
  * 
- * wmtop.c -- WindowMaker process view dock app
+ * wmwave.c -- WindowMaker IEEE802.11 status dock app
+ *             based on wmtop.c from Dan Piponi
  * 
  * This software is licensed through the GNU General Public License.
  * 
  * Authors (in reverse chronological order):
+ * Hendrik Scholz <hscholz at raisdorf.net>
  * Bruce M. Simpson <bms at spc.org>
  * Carsten Schuermann <carsten at schuermann.org>
  * Dan Piponi <dan at tanelorn.demon.co.uk>
@@ -66,11 +68,11 @@
 int             wmwave_mask_height = 64;
 
 #define WMWAVE_DEFAULT_INTERFACE	"wi0"
-#define WMWAVE_VERSION			"0.4_FreeBSD"
+#define WMWAVE_VERSION			"0.4_FreeBSD-2"
 
 int             update_rate = 100000;
 char            *ProgName;
-char		*iface = WMWAVE_DEFAULT_INTERFACE;
+char			*iface = WMWAVE_DEFAULT_INTERFACE;
 time_t          curtime;
 time_t          prevtime;
 int             mode = 0;	/* default: no card detected */
@@ -165,32 +167,27 @@
 		MODE_HAVE_CARD = 1
 	};
 
-        s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-        if (s == -1) 
-                errx(errno, "socket");
-        bzero(&ifr, sizeof(ifr));
-        strncpy(ifr.ifr_name, iface, strlen(iface));
-        bzero(&wireq, sizeof(wireq));
-        wireq.wi_type = WI_RID_READ_CACHE;
-        wireq.wi_len = WI_MAX_DATALEN;
-        ifr.ifr_data = (void *) &wireq;
+    s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+    if (s == -1) 
+    	errx(errno, "socket");
+    bzero(&ifr, sizeof(ifr));
+    strncpy(ifr.ifr_name, iface, strlen(iface));
+    bzero(&wireq, sizeof(wireq));
+    wireq.wi_type = WI_RID_COMMS_QUALITY;
+    wireq.wi_len = WI_MAX_DATALEN;
+    ifr.ifr_data = (void *) &wireq;
 
-        err = ioctl(s, SIOCGWAVELAN, (caddr_t)&ifr);
-        if (err < 0) {
+    err = ioctl(s, SIOCGWAVELAN, (caddr_t)&ifr);
+    if (err < 0) {
 		mode = MODE_NO_CARD;
 		goto draw;
-        }
-        wisigsnp = (int *) &wireq.wi_val;
-	if (*wisigsnp < 1) {
-		mode = MODE_NO_CARD;
-		goto draw;
-	}
+    }
 
 	mode = MODE_HAVE_CARD;
-        wisigsp = (struct wi_sigcache *) (wisigsnp+1);
-	link  = wisigsp->quality * 1.0;
-	level = wisigsp->signal  * -1.0;
-	noise = wisigsp->noise   * -1.0;
+	link = wireq.wi_val[0];
+	level = wireq.wi_val[1];
+	noise = wireq.wi_val[2];
+
 draw:
 	/*
 	 * Print channel information, and signal ratio
@@ -205,9 +202,9 @@
 		} else {
 			DrawGreenDot();
 		};
-		BlitString("Link     ", 4, 18);
+		BlitString("Quality  ", 4, 18);
 		DrawBar(_fmin((int)(link * 1.8), 100.0), 4, 27);
-		BlitString("Level    ", 4, 32);
+		BlitString("Signal   ", 4, 32);
 		DrawGreenBar(_fmin((int)(level * 0.3), 100.0), 4, 41);
 		BlitString("Noise    ", 4, 46);
 		DrawGreenBar(_fmin((int)(noise * 0.3), 100.0), 4, 55);
--- wmwave-patched-diff.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list