summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wicontrol
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-11-25 20:45:49 +0000
committerwpaul <wpaul@FreeBSD.org>1999-11-25 20:45:49 +0000
commitd0da4e010d8ed65bf5f7db99a1b113baee7bf5fa (patch)
treed01702dbf8687a701f67068bb061e5aaf01cb2c1 /usr.sbin/wicontrol
parent7f96711685a7ad2d836d4782c997fa98f82cf736 (diff)
downloadFreeBSD-src-d0da4e010d8ed65bf5f7db99a1b113baee7bf5fa.zip
FreeBSD-src-d0da4e010d8ed65bf5f7db99a1b113baee7bf5fa.tar.gz
Update the WaveLAN/IEEE driver:
- Convert to new bus attachment scheme. Thanks to Blaz Zupan for doing the initial work here. One thing I changed was to have the attach and detach routines work like the PCI drivers, which means that in theory you should be able to load and unload the driver like the PCI NIC drivers, however the pccard support for this hasn't settled down yet so it doesn't quite work. Once the pccard work is done, I'll have to revisit this. - Add device wi0 to PCCARD. If we're lucky, people should be able to install via their WaveLAN cards now. - Add support for signal strength caching. The wicontrol utility has also been updated to allow zeroing and displaying the signal strength cache. - Add a /sys/modules/wi directory and fix a Makefile to builf if_wi.ko. Currently this module is only built for the i386 platform, though once the pccard stuff is done it should be able to work on the alpha too. (Theoretically you should be able to plug one of the WaveLAN/IEEE ISA cards into an alpha with an ISA slot, but we'll see how that turns out. - Update LINT to use only device wi0. There is no true ISA version of the WaveLAN/IEEE so we'll never use an ISA attachment. - Update files.i386 so that if_wi is dependent on card.
Diffstat (limited to 'usr.sbin/wicontrol')
-rw-r--r--usr.sbin/wicontrol/Makefile2
-rw-r--r--usr.sbin/wicontrol/wicontrol.817
-rw-r--r--usr.sbin/wicontrol/wicontrol.c88
3 files changed, 105 insertions, 2 deletions
diff --git a/usr.sbin/wicontrol/Makefile b/usr.sbin/wicontrol/Makefile
index 47ea6f8..f68ae34 100644
--- a/usr.sbin/wicontrol/Makefile
+++ b/usr.sbin/wicontrol/Makefile
@@ -2,7 +2,7 @@
PROG= wicontrol
SRCS= wicontrol.c
-CFLAGS+= -Wall
+CFLAGS+= -Wall -DWICACHE
MAN8= wicontrol.8
diff --git a/usr.sbin/wicontrol/wicontrol.8 b/usr.sbin/wicontrol/wicontrol.8
index ad7d03c..c0b363e 100644
--- a/usr.sbin/wicontrol/wicontrol.8
+++ b/usr.sbin/wicontrol/wicontrol.8
@@ -65,6 +65,10 @@
.Fl i Ar iface Fl P Ar 0|1
.Nm wicontrol
.Fl i Ar iface Fl S Ar max_sleep_duration
+.Nm wicontrol
+.Fl i Ar iface Fl Z (zero signal cache)
+.Nm wicontrol
+.Fl i Ar iface Fl C (display signal cache)
.Sh DESCRIPTION
The
.Nm
@@ -238,6 +242,19 @@ Specify the sleep interval to use when power management is enabled.
The
.Are max sleep interval
is specified in milliseconds. The default is 100.
+.It Fl i Ar iface Fl Z
+Clear the signal strength cache maintained internally by the
+.Nm wi
+driver.
+.It Fl i Ar iface Fl C
+Display the cached signal strength information maintained by the
+.Nm wi
+driver. The driver retains information about signal strength and
+noise level for packets received from different hosts. The signal
+strength and noise level values are displayed in units of dBms.
+The signal quality values is produced by subtracting the noise level
+from the signal strength (i.e. less noise and better signal yields
+better signal quality).
.El
.Sh SEE ALSO
.Xr wi 4 ,
diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c
index bdb9e20..ef62368 100644
--- a/usr.sbin/wicontrol/wicontrol.c
+++ b/usr.sbin/wicontrol/wicontrol.c
@@ -431,10 +431,77 @@ static void usage(p)
fprintf(stderr, "\t%s -i iface -f frequency\n", p);
fprintf(stderr, "\t%s -i iface -P 0|1t\n", p);
fprintf(stderr, "\t%s -i iface -S max sleep duration\n", p);
+#ifdef WICACHE
+ fprintf(stderr, "\t%s -i iface -Z zero out signal cache\n", p);
+ fprintf(stderr, "\t%s -i iface -C print signal cache\n", p);
+#endif
exit(1);
}
+#ifdef WICACHE
+static void wi_zerocache(iface)
+ char *iface;
+{
+ struct wi_req wreq;
+
+ if (iface == NULL)
+ errx(1, "must specify interface name");
+
+ bzero((char *)&wreq, sizeof(wreq));
+ wreq.wi_len = 0;
+ wreq.wi_type = WI_RID_ZERO_CACHE;
+
+ wi_getval(iface, &wreq);
+}
+
+static void wi_readcache(iface)
+ char *iface;
+{
+ struct wi_req wreq;
+ int *wi_sigitems;
+ struct wi_sigcache *sc;
+ char * pt;
+ int i;
+
+ if (iface == NULL)
+ errx(1, "must specify interface name");
+
+ bzero((char *)&wreq, sizeof(wreq));
+ wreq.wi_len = WI_MAX_DATALEN;
+ wreq.wi_type = WI_RID_READ_CACHE;
+
+ wi_getval(iface, &wreq);
+
+ wi_sigitems = (int *) &wreq.wi_val;
+ pt = ((char *) &wreq.wi_val);
+ pt += sizeof(int);
+ sc = (struct wi_sigcache *) pt;
+
+ for (i = 0; i < *wi_sigitems; i++) {
+ printf("[%d/%d]:", i+1, *wi_sigitems);
+ printf(" %02x:%02x:%02x:%02x:%02x:%02x,",
+ sc->macsrc[0]&0xff,
+ sc->macsrc[1]&0xff,
+ sc->macsrc[2]&0xff,
+ sc->macsrc[3]&0xff,
+ sc->macsrc[4]&0xff,
+ sc->macsrc[5]&0xff);
+ printf(" %d.%d.%d.%d,",((sc->ipsrc >> 0) & 0xff),
+ ((sc->ipsrc >> 8) & 0xff),
+ ((sc->ipsrc >> 16) & 0xff),
+ ((sc->ipsrc >> 24) & 0xff));
+ printf(" sig: %d, noise: %d, qual: %d\n",
+ sc->signal,
+ sc->noise,
+ sc->quality);
+ sc++;
+ }
+
+ return;
+}
+#endif
+
int main(argc, argv)
int argc;
char *argv[];
@@ -444,8 +511,24 @@ int main(argc, argv)
char *p = argv[0];
while((ch = getopt(argc, argv,
- "hoc:d:f:i:p:r:q:t:n:s:m:P:S:")) != -1) {
+ "hoc:d:f:i:p:r:q:t:n:s:m:P:S:ZC")) != -1) {
switch(ch) {
+ case 'Z':
+#ifdef WICACHE
+ wi_zerocache(iface);
+ exit(0);
+#else
+ printf("WICACHE not available\n");
+#endif
+ break;
+ case 'C':
+#ifdef WICACHE
+ wi_readcache(iface);
+#else
+ printf("WICACHE not available\n");
+#endif
+ exit(0);
+ break;
case 'o':
wi_dumpstats(iface);
exit(0);
@@ -515,3 +598,6 @@ int main(argc, argv)
exit(0);
}
+
+
+
OpenPOWER on IntegriCloud