summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wicontrol/wicontrol.c
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/wicontrol.c
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/wicontrol.c')
-rw-r--r--usr.sbin/wicontrol/wicontrol.c88
1 files changed, 87 insertions, 1 deletions
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