OpenWrt Forum Archive

Topic: ATH_USER_REGD not working, txpower still limited

The content of this topic has been archived on 18 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have an AWUS036NHA (AR9271 based, ath9k-htc driver). The EEPROM seems to have been set with the region set to GB which is limiting me to 20dBm txpower. The adapter supports up to 27dBm, which is also legal in my country.

I've compiled the latest trunk with ATH_USER_REGD=y, however it doesn't seem to have had any effect. The GB regulations still seem to apply.

Output from iw reg get:

root@openwrt:~# iw reg get
country NZ:
        (2402 - 2482 @ 40), (N/A, 30)
        (5170 - 5250 @ 20), (3, 23)
        (5250 - 5330 @ 20), (3, 23), DFS
        (5735 - 5835 @ 20), (3, 30)
root@openwrt:~#

Trying to change the txpower:

root@openwrt:~# iwconfig wlan1 txpower 21
Error for wireless request "Set Tx Power" (8B26) :
    SET failed on device wlan1 ; Invalid argument.
root@openwrt:~# iwconfig wlan1 txpower 20
root@openwrt:~#

Output from dmesg:

[   33.600000] usbcore: registered new interface driver ath9k_htc
[   33.630000] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
[   33.980000] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[   34.220000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33 credits
[   34.430000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[   34.440000] ath: EEPROM regdomain: 0x833a
[   34.440000] ath: EEPROM indicates we should expect a country code
[   34.440000] ath: doing EEPROM country->regdmn map search
[   34.440000] ath: country maps to regdmn code: 0x37
[   34.440000] ath: Country alpha2 being used: GB
[   34.440000] ath: Regpair used: 0x37
[   34.440000] ieee80211 phy1: Atheros AR9271 Rev:1
[   34.450000] cfg80211: Calling CRDA for country: GB
[   34.450000] cfg80211: Current regulatory domain intersected:
[   34.460000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   34.470000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   34.470000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 1700 mBm)
[   34.480000] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   34.490000] cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   34.500000] cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   34.510000] Registered led device: ath9k_htc-phy1
... other stuff ...
[   45.050000] cfg80211: Calling CRDA for country: NZ
[   45.050000] cfg80211: Regulatory domain changed to country: NZ
[   45.060000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   45.070000] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 3000 mBm)
[   45.070000] cfg80211:   (5170000 KHz - 5250000 KHz @ 20000 KHz), (300 mBi, 2300 mBm)
[   45.080000] cfg80211:   (5250000 KHz - 5330000 KHz @ 20000 KHz), (300 mBi, 2300 mBm)
[   45.090000] cfg80211:   (5735000 KHz - 5835000 KHz @ 20000 KHz), (300 mBi, 3000 mBm)

Does anyone have any suggestions? Why isn't ATH_USER_REGD letting me change the txpower?

I'm not 100% sure about the regulations and laws in your country but you could set your device to 00 (World); there shouldn't be any limitations afterwards and you can set the txpower accordingly.

You can run "iw phy0 info" to check what's the max power the hardware can transmit. Being able to break country regulation does not mean you can exceed the hardware tx limit.

Hmm, this is the output from iw phy1 info:

                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm)
                        * 2472 MHz [13] (20.0 dBm)

So this means that the hardware literally won't support anything over 20dBm, regardless of regulations? Apparently it's meant to support up to 27dBm.

vkins wrote:

I'm not 100% sure about the regulations and laws in your country but you could set your device to 00 (World); there shouldn't be any limitations afterwards and you can set the txpower accordingly.

How do I do that? I thought that the EEPROM being set to GB was hard-coded and there's no way I can change it within the device.

If I'm not mistaken, your choice on the wifi settings page (can't remember the name, it's a country code selection) decides which settings are being used.

I don't know what your adapter is able to do, though. A quick google search didn't throw back any useful information. And it's entirely possible that your adapters maximal power is 20dBm...you would be out of luck, then.

20dBm is your hardware max. All radio equipment must adhere to country specific regulation imposed by the telecommunication regulatory folks. If you bought your router in your country, 20dBm is what you've been approved to transmit without breaking any laws.

phuque99 wrote:

20dBm is your hardware max. All radio equipment must adhere to country specific regulation imposed by the telecommunication regulatory folks. If you bought your router in your country, 20dBm is what you've been approved to transmit without breaking any laws.

Well, not really. The reason this happens is because the hardware manufacturers (I think Atheros are one of the worst ones) are too cheap/lazy to make a different model for each country. They don't realise that most of the world is not the US or UK.

I don't live in the UK, and I didn't buy this hardware in the UK. Yet it's still imposing their laws on me. I can legally transmit more than 20dBm here.

The specs for the AWUS036NHA are:

Output Power
802.11b    29dBm ±2
802.11g    27dBm ±2
802.11n    27dBm ±2

So the adapter should be able to run at a higher txpower.

The discussion might have continued from here.