mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
Update wlconfig to match new Wavelan (wl) driver.
Submitted by: Jim Binkley <jrb@cs.pdx.edu>
This commit is contained in:
parent
10731762e6
commit
e7b89905f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27818
@ -16,7 +16,8 @@ radio LAN card. Various parameters stored in the nonvolatile Parameter
|
||||
Storage Area (PSA) on the card can be modified with this program, which
|
||||
obviates the need for the DOS-based
|
||||
.Nm instconf.exe
|
||||
program.
|
||||
program. It can also be used to interrogate the optional signal
|
||||
strength cache which may have been compiled into the driver.
|
||||
.Pp
|
||||
The
|
||||
.Ar ifname
|
||||
@ -29,7 +30,7 @@ The
|
||||
.Ar param
|
||||
and
|
||||
.Ar value
|
||||
arguments can be used to change the value of several of the parameters.
|
||||
arguments can be used to change the value of several parameters.
|
||||
Any number of
|
||||
.Ar param value
|
||||
pairs may be supplied.
|
||||
@ -59,6 +60,25 @@ initialized. This sets the default NWID loaded at startup.
|
||||
.It curnwid
|
||||
This sets the current operating NWID (but does not save it to the
|
||||
PSA).
|
||||
.It cache
|
||||
The driver may maintain a per interface fixed size cache of signal strength,
|
||||
silence, and quality levels, which are indexed by sender MAC addresses.
|
||||
Input packets are stored in the cache, and when received, the values
|
||||
stored in the radio modem are interrogated and stored.
|
||||
There are also two sysctl values (iponly and multicast only) which
|
||||
can be used for filtering out some input packets. By default, the
|
||||
cache mechanism stores only non-unicast IP packets, but this can
|
||||
be changed with sysctl(8). Each non-filtered
|
||||
input packet causes a cache update, hence one can monitor
|
||||
the antennae signal strength to a remote system.
|
||||
There are three commands that can be given as values:
|
||||
.Sq raw ,
|
||||
which prints out the raw signal strength data as found in the radio
|
||||
modem hardware value,
|
||||
.Sq scale ,
|
||||
which scales the raw hardware values to 0..100%, and
|
||||
.Sq zero
|
||||
which clears out the cache in case you want to store new samples.
|
||||
.El
|
||||
.Pp
|
||||
Note that if the IRQ on the Wavelan card is incorrect, the interface
|
||||
@ -96,8 +116,16 @@ Databus width : 16 (variable)
|
||||
Configuration state : unconfigured
|
||||
CRC-16 : 0x3c26
|
||||
CRC status : OK
|
||||
.Pp
|
||||
Print a scaled version of the signal strength cache :
|
||||
.Bd -literal -offset
|
||||
# wlconfig wl0 cache scale
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr wl 4,
|
||||
.Xr sysctl 8 .
|
||||
.Sh HISTORY
|
||||
This implementation of the
|
||||
.Nm wlconfig
|
||||
command is completely new, written for Hilink Internet by Michael Smith.
|
||||
command is completely new, written for Hilink Internet by Michael Smith,
|
||||
and updated by Jim Binkley &c.
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wlconfig.c,v 1.1.1.1 1997/05/22 08:58:18 msmith Exp $
|
||||
* $Id: wlconfig.c,v 1.2 1997/05/23 21:46:50 trost Exp $
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@ -82,6 +82,10 @@ static int irqvals[16] = {
|
||||
0, 0, 0, 0x01, 0x02, 0x04, 0, 0x08, 0, 0, 0x10, 0x20, 0x40, 0, 0, 0x80
|
||||
};
|
||||
|
||||
/* cache */
|
||||
static int w_sigitems; /* count of valid items */
|
||||
static struct w_sigcache wsc[MAXCACHEITEMS];
|
||||
|
||||
int
|
||||
wlirq(int irqval)
|
||||
{
|
||||
@ -211,9 +215,87 @@ syntax(char *pname)
|
||||
fprintf(stderr," macsel soft or default\n");
|
||||
fprintf(stderr," nwid default NWID (0x0-0xffff)\n");
|
||||
fprintf(stderr," currnwid current NWID (0x0-0xffff) or 'get'\n");
|
||||
fprintf(stderr," cache signal strength cache\n");
|
||||
fprintf(stderr," cache values = { raw, scale, zero }\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_cache(int sd, struct ifreq *ifr)
|
||||
{
|
||||
/* get the cache count */
|
||||
if (ioctl(sd, SIOCGWLCITEM, (caddr_t)ifr)) {
|
||||
perror("SIOCGWLCITEM - get cache count");
|
||||
exit(1);
|
||||
}
|
||||
w_sigitems = (int) ifr->ifr_data;
|
||||
|
||||
ifr->ifr_data = (caddr_t) &wsc;
|
||||
/* get the cache */
|
||||
if (ioctl(sd, SIOCGWLCACHE, (caddr_t)ifr)) {
|
||||
perror("SIOCGWLCACHE - get cache count");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
scale_value(int value, int max)
|
||||
{
|
||||
double dmax = (double) max;
|
||||
if (value > max)
|
||||
return(100);
|
||||
return((value/dmax) * 100);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_cache(int rawFlag)
|
||||
{
|
||||
int i;
|
||||
int signal, silence, quality;
|
||||
|
||||
if (rawFlag)
|
||||
printf("signal range 0..63: silence 0..63: quality 0..15\n");
|
||||
else
|
||||
printf("signal range 0..100: silence 0..100: quality 0..100\n");
|
||||
|
||||
/* after you read it, loop through structure,i.e. wsc
|
||||
* print each item:
|
||||
*/
|
||||
for(i = 0; i < w_sigitems; i++) {
|
||||
printf("[%d:%d]>\n", i+1, w_sigitems);
|
||||
printf("\tip: %d.%d.%d.%d,",((wsc[i].ipsrc >> 0) & 0xff),
|
||||
((wsc[i].ipsrc >> 8) & 0xff),
|
||||
((wsc[i].ipsrc >> 16) & 0xff),
|
||||
((wsc[i].ipsrc >> 24) & 0xff));
|
||||
printf(" mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
wsc[i].macsrc[0]&0xff,
|
||||
wsc[i].macsrc[1]&0xff,
|
||||
wsc[i].macsrc[2]&0xff,
|
||||
wsc[i].macsrc[3]&0xff,
|
||||
wsc[i].macsrc[4]&0xff,
|
||||
wsc[i].macsrc[5]&0xff);
|
||||
if (rawFlag) {
|
||||
signal = wsc[i].signal;
|
||||
silence = wsc[i].silence;
|
||||
quality = wsc[i].quality;
|
||||
}
|
||||
else {
|
||||
signal = scale_value(wsc[i].signal, 63);
|
||||
silence = scale_value(wsc[i].silence, 63);
|
||||
quality = scale_value(wsc[i].quality, 15);
|
||||
}
|
||||
printf("\tsignal: %d, silence: %d, quality: %d, ",
|
||||
signal,
|
||||
silence,
|
||||
quality);
|
||||
printf("snr: %d\n", signal - silence);
|
||||
}
|
||||
}
|
||||
|
||||
#define raw_cache() dump_cache(1)
|
||||
#define scale_cache() dump_cache(0)
|
||||
|
||||
void
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@ -313,6 +395,31 @@ main(int argc, char *argv[])
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcasecmp(param,"cache")) {
|
||||
|
||||
/* raw cache dump
|
||||
*/
|
||||
if (!strcasecmp(value,"raw")) {
|
||||
get_cache(sd, &ifr);
|
||||
raw_cache();
|
||||
continue;
|
||||
}
|
||||
/* scaled cache dump
|
||||
*/
|
||||
else if (!strcasecmp(value,"scale")) {
|
||||
get_cache(sd, &ifr);
|
||||
scale_cache();
|
||||
continue;
|
||||
}
|
||||
/* zero out cache
|
||||
*/
|
||||
else if (!strcasecmp(value,"zero")) {
|
||||
if (ioctl(sd, SIOCDWLCACHE, (caddr_t)&ifr))
|
||||
err(1,"Zero cache");
|
||||
continue;
|
||||
}
|
||||
errx(1,"Unknown value '%s'", value);
|
||||
}
|
||||
errx(1,"Unknown parameter '%s'",param);
|
||||
}
|
||||
if (work) {
|
||||
@ -321,7 +428,3 @@ main(int argc, char *argv[])
|
||||
err(1,"Set PSA");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user