gluon icon indicating copy to clipboard operation
gluon copied to clipboard

gluon-web-wifi-config: TX power offset is not being respected

Open CodeFetch opened this issue 5 years ago • 5 comments

In wifi-config.lua the txpower_list-function uses the phy-names (e.g. phy0) which it derives from the gluon-util.

Currently libiwinfo only handles the name of the VIF properly.

Thus the TX-Offset is not being respected at all.

You can see the same behavior by executing iwinfo phy0 info which shows "unknown" in nearly all fields compared to e.g. iwinfo client0 info which shows the correct HWID, TX power offset etc.

This should be fixed upstream.

Edit: I'll investigate it further as there seem to be more bugs (e.g. iwinfo phyz info shows this data, too)...

CodeFetch avatar Jun 17 '19 19:06 CodeFetch

i am not sure if i understand the working of this script correct. Are the radios initialized to the final country and HT-mode turned on and settled (seconds!) before making the query for available txpowerlist? If radio is turned off there will probably no valid list.

and if you like dig deeper into the upstream-problems: Often there are lists to enourmous values (like up to "30" on old NSM2, but on some units with such long lists (WR4900) you may set the parameter to 30, but you never get the "*" in the list beyound 23 (just as an example).

And off course we have the complex topic of offsets of antenna gains.

in other words: The hole topic of setting txpowers is flawed on many levels that i personally would consider this as "beyound repair" and would drop this function, at least in the Web-based-config mode. (Whoever want's to touch the topic should please do so via cli)

Adorfer avatar Jun 29 '19 01:06 Adorfer

i would probably agree on removing it from config mode...

rotanid avatar Jun 29 '19 12:06 rotanid

@rotanid Ubiquiti devices sometimes have an external power amplifier chip. The Ubiquiti firmware thus sets an offset depending on the subvendor device-ID. You can find the offsets here: https://git.openwrt.org/?p=project/iwinfo.git;a=blob_plain;f=hardware.txt;hb=HEAD

This means that Ubiquiti devices sometimes send with a far higher transmit power than iw shows.

The subvendor device ID can be read from flash on Ubiquiti devices. This is also how the model detection in OpenWrt works. I've tried to add a patch for adding the missing model declarations to OpenWrt, but it was declined as ar71xx is out-of-life. https://github.com/openwrt/openwrt/pull/2144/files

But it is possible, that I add such a script to Gluon. This script could set the antenna gain depending on the model and the TX power offset which it both derives from the subvendor device ID.

My suggestion is: I remove the iwinfo script as long as it does not work and introduce a script for retrieving the antenna gain and power offset from Ubiquiti devices in Gluon.

@Adorfer I just need the measurement as we discussed on the Forum from you. Then I know whether the antenna gain is included in ART. It does not even need to be super-accurate. I already have a script with the correct antenna gains. After that we have full knowledge about the real transmission power of these devices.

CodeFetch avatar Jun 29 '19 13:06 CodeFetch

@CodeFetch How do we proceed with this issue? Having some way to determine the antenna gain / power offset more accurately would also help with #94.

neocturne avatar May 29 '20 22:05 neocturne

@NeoRaider I've a Gluon package somewhere on my desktop which can set the correct power offsets for Ubiquiti devices, but the result of my discussion with some OpenWrt devs was that the correct way is to fix it in mac80211 and introduce a DTS parameter for the antenna gain, PA gain, and something else I forgot about. There is still an out-of-tree patch for iw from Felix Fietkau which needs to be upstreamed and was blocked, because nobody from the regdb team felt responsible. https://patchwork.kernel.org/patch/2854533/

CodeFetch avatar May 30 '20 09:05 CodeFetch