summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-02-16 04:42:42 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-02-16 04:42:42 +0100
commitf6290afb148261aa382d0db1d9c1a3d3f52a09f4 (patch)
tree9ce9b550e17d2d831a081f76522669de5f760220
parent27a8b509c9d703e676c45a00a06248823176d83f (diff)
downloadplan9front-f6290afb148261aa382d0db1d9c1a3d3f52a09f4.tar.xz
etheriwl: use first available antenna from eeprom txantmask instead of hardcode to antenna A
-rw-r--r--sys/src/9/pc/etheriwl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/src/9/pc/etheriwl.c b/sys/src/9/pc/etheriwl.c
index e80014deb..4d49450c6 100644
--- a/sys/src/9/pc/etheriwl.c
+++ b/sys/src/9/pc/etheriwl.c
@@ -1725,7 +1725,7 @@ enum {
static void
transmit(Wifi *wifi, Wnode *wn, Block *b)
{
- int flags, nodeid, rate;
+ int flags, nodeid, rate, ant;
uchar c[Tcmdsize], *p;
Ether *edev;
Ctlr *ctlr;
@@ -1773,6 +1773,11 @@ transmit(Wifi *wifi, Wnode *wn, Block *b)
}
qunlock(ctlr);
+ /* select first available antenna */
+ ant = ctlr->rfcfg.txantmask & 7;
+ ant |= (ant == 0);
+ ant = ((ant - 1) & ant) ^ ant;
+
memset(p = c, 0, sizeof(c));
put16(p, BLEN(b));
p += 2;
@@ -1783,7 +1788,7 @@ transmit(Wifi *wifi, Wnode *wn, Block *b)
p += 4; /* scratch */
*p++ = ratetab[rate].plcp;
- *p++ = ratetab[rate].flags | (1<<6);
+ *p++ = ratetab[rate].flags | (ant<<6);
p += 2; /* xflags */
*p++ = nodeid;