From hscholz@phobos.raisdorf.net  Tue Jul 15 12:03:07 2003
Return-Path: <hscholz@phobos.raisdorf.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E8A7F37B40A
	for <freebsd-gnats-submit@freebsd.org>; Tue, 15 Jul 2003 12:03:07 -0700 (PDT)
Received: from phobos.raisdorf.net (phobos.raisdorf.net [195.244.235.251])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 00DBC43F3F
	for <freebsd-gnats-submit@freebsd.org>; Tue, 15 Jul 2003 12:03:06 -0700 (PDT)
	(envelope-from hscholz@phobos.raisdorf.net)
Received: by phobos.raisdorf.net (Postfix, from userid 66)
	id 1567023853; Tue, 15 Jul 2003 21:03:04 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
	by pandemonium.lan.raisdorf.net (Postfix) with ESMTP
	id BF65F698DB; Tue, 15 Jul 2003 20:52:36 +0200 (CEST)
Received: from pandemonium.lan.raisdorf.net ([127.0.0.1])
 by localhost (pandemonium.lan.raisdorf.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 75630-03; Tue, 15 Jul 2003 20:52:22 +0200 (CEST)
Received: from goanna.lan.raisdorf.net (goanna.lan.raisdorf.net [10.10.1.2])
	by pandemonium.lan.raisdorf.net (Postfix) with ESMTP
	id 3FC95697FF; Tue, 15 Jul 2003 20:52:22 +0200 (CEST)
Received: from goanna.lan.raisdorf.net (localhost [127.0.0.1])
	by goanna.lan.raisdorf.net (8.12.9/8.12.9) with ESMTP id h6FIrPnO052277;
	Tue, 15 Jul 2003 20:53:25 +0200 (CEST)
	(envelope-from hscholz@goanna.lan.raisdorf.net)
Received: (from hscholz@localhost)
	by goanna.lan.raisdorf.net (8.12.9/8.12.9/Submit) id h6FIr0kt052243;
	Tue, 15 Jul 2003 20:53:00 +0200 (CEST)
Message-Id: <200307151853.h6FIr0kt052243@goanna.lan.raisdorf.net>
Date: Tue, 15 Jul 2003 20:53:00 +0200 (CEST)
From: Hendrik Scholz <hendrik@scholz.net>
Reply-To: Hendrik Scholz <hendrik@scholz.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: bms@spc.org
Subject: patch: net/wmwave: more portable data gathering
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         54511
>Category:       ports
>Synopsis:       patch: net/wmwave: more portable data gathering
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 15 12:10:14 PDT 2003
>Closed-Date:    Fri Aug 29 23:55:26 PDT 2003
>Last-Modified:  Fri Aug 29 23:55:26 PDT 2003
>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@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@raisdorf.net>
  * Bruce M. Simpson <bms@spc.org>
  * Carsten Schuermann <carsten@schuermann.org>
  * Dan Piponi <dan@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:

From: Oliver Lehmann <lehmann@ans-netz.de>
To: freebsd-gnats-submit@FreeBSD.org, hendrik@scholz.net
Cc:  
Subject: Re: ports/54511: patch: net/wmwave: more portable data gathering
Date: Sat, 2 Aug 2003 15:48:53 +0200

 Followups:
 	ports/54523
State-Changed-From-To: open->closed 
State-Changed-By: edwin 
State-Changed-When: Fri Aug 29 23:55:21 PDT 2003 
State-Changed-Why:  
Commited, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54511 
>Unformatted:
