Antenna selection

Discuss the technical details of Gargoyle and ongoing development

Moderator: Moderators

Post Reply
microshift
Posts: 2
Joined: Mon May 25, 2009 6:19 pm

Antenna selection

Post by microshift »

Hi there

First of all I give my congrats for this great firmware. It looks very promiser!

I'm willing to choose this firmware among the others OpenWrt's X-rt and Luci because this is much more user friendly and I like it :)

Of course this is a work in progress and there's stuff missing, like the new features from madwifi's hall for Atheros. The new OpenWrt's 809 has them. Like XR (Extended Range) Etc. You can see them on X-rt or Luci.

Any way I wanted to have antenna selection besides all other things so I'm taking a peek into the source code so I can try to add that.

I like how the code is written, its seems easy to read but I'm not able to create code it like it should. I can do Copy-Paste and that's almost all I can do :P

Any way, I'm looking at txpower field all over www/basic.sh and www/js/basic.js trying do figure where could I insert a check box for Antenna 1 and 2.
Then the command for madwifi would be like:
sysctl -w dev.wifi0.txantenna=1

Oh and I was forgetting Diversity wich is very requested in these days:
sysctl -w dev.wifi0.diversity=1
But diversity should be turned off so antenna selection can works.

Here's some docs about it http://madwifi-project.org/wiki/UserDoc ... aDiversity

Well, I'll keep dig in my search and if someone could drop a hand I would be very thankful :D

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: Antenna selection

Post by Eric »

I find it amusing that you're looking at basic.sh and js/basic.js and saying the code seems easy to read. Those are the oldest parts of Gargoyle, first created when I was still figuring out how I wanted to do a lot of things, so they are, by far, the ugliest code in there.

You'll probably want to do this by setting uci options. Look at the uci object defined in js/common.js -- that's where all uci data is loaded into when the page is loaded. In particular it's loaded into an object named uciOriginal (the original uci settings, before changes are made).

The actual control should probably be placed in basic.sh. You'll need to set the value for it in the resetData() function, and the saveChanges() function specifies how the data should be set when the data is saved. The basic section is barticularly ugly because you also have to deal with all the visibility settings -- a lot of controls are invisible to begin with, or become invisible when certain options are selected. You'll probably want to put the control in the wifi section so the proper visibility function will be setWifiVisibility.

Adding controls to the basic section is a real pain... that code is just UGLY, but it's sufficiently complex that re-writing it would be more trouble than it's worth.

Post Reply