ref: b4f9ca6c976ea61512d872924824c924af903aa4
parent: 266057f0da23b5db7d8072fa4d9fad6fff5a7dc1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jul 10 22:33:16 EDT 2015
etherwpi: dont enable transmit power for invalid channels, add multicast stub
--- a/sys/src/9/pc/etherwpi.c
+++ b/sys/src/9/pc/etherwpi.c
@@ -273,7 +273,7 @@
Powergrp pwrgrps[5];
} eeprom;
- char maxpwr[255];
+ char maxpwr[256];
Shared *shared;
@@ -535,6 +535,7 @@
goto Err;
memmove(edev->ea, b, Eaddrlen);
+ memset(ctlr->maxpwr, 0, sizeof(ctlr->maxpwr));
for(i = 0; i < nelem(bands); i++){
if((err = eepromread(ctlr, b, 2*bands[i].nchan, bands[i].addr)) != nil)
goto Err;
@@ -1348,19 +1349,21 @@
return;
}
- /* tx power */
- memset(p = c, 0, sizeof(c));
- *p++ = 1; /* band (0 = 5ghz) */
- p++; /* reserved */
- put16(p, ctlr->channel), p += 2;
- for(rate = 0; rate < nelem(ratetab); rate++){
- idx = pwridx(ctlr, &ctlr->eeprom.pwrgrps[0], ctlr->channel, rate);
- *p++ = ratetab[rate].plcp;
- *p++ = rfgain_2ghz[idx]; /* rf_gain */
- *p++ = dspgain_2ghz[idx]; /* dsp_gain */
- p++; /* reservd */
+ if(ctlr->maxpwr[ctlr->channel] != 0){
+ /* tx power */
+ memset(p = c, 0, sizeof(c));
+ *p++ = 1; /* band (0 = 5ghz) */
+ p++; /* reserved */
+ put16(p, ctlr->channel), p += 2;
+ for(rate = 0; rate < nelem(ratetab); rate++){
+ idx = pwridx(ctlr, &ctlr->eeprom.pwrgrps[0], ctlr->channel, rate);
+ *p++ = ratetab[rate].plcp;
+ *p++ = rfgain_2ghz[idx]; /* rf_gain */
+ *p++ = dspgain_2ghz[idx]; /* dsp_gain */
+ p++; /* reservd */
+ }
+ cmd(ctlr, 151, c, p - c);
}
- cmd(ctlr, 151, c, p - c);
if(ctlr->bcastnodeid == -1){
ctlr->bcastnodeid = 24;
@@ -1526,6 +1529,11 @@
}
static void
+wpimulticast(void *, uchar*, int)
+{
+}
+
+static void
wpirecover(void *arg)
{
Ether *edev;
@@ -1846,7 +1854,7 @@
edev->ctl = wpictl;
edev->shutdown = wpishutdown;
edev->promiscuous = wpipromiscuous;
- edev->multicast = nil;
+ edev->multicast = wpimulticast;
edev->mbps = 54;
if(wpiinit(edev) < 0){