I found that the current realtek linux driver series rtl8192** (in my case the Alfa AWUS036NHR high power USB wifi card using the RTL8188RU chipset) ignores the regulatory set by the CRDA service. Cause of that the card will only have channels 1 to 11 and runs at maximum 20 dBm. This is the world standard of CRDA.
If you try to change the CRDA to Bolivia (in that country are very low wireless regulatory) with the following command
iw reg set BO
you will not get any changes. So if you try to change the txpower (dBm) of your card to more than 20 you will get
iwconfig wlan0 txpower 30dBm Error for wireless request "Set Tx Power" (8B26) : SET failed on device wlan0 ; Invalid argument.
Also you still have only the first 11 channels available.
So let’s check out the latest wireless driver package (you should use a newer one. Can be found on the linuxwireless homepage at http://linuxwireless.org/download/compat-wireless-2.6/):
wget http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-04-11.tar.bz2 tar xf compat-wireless-2012-04-11.tar.bz2 cd compat-wireless-2012-04-11
Now we try to find some infos about regulatory options packed in the rtl driver packages:
find . -name '*reg*'|grep rtl
I got this output:
./drivers/net/wireless/rtlwifi/regd.c ./drivers/net/wireless/rtlwifi/rtl8192cu/reg.h ./drivers/net/wireless/rtlwifi/regd.h ./drivers/net/wireless/rtlwifi/rtl8192ce/reg.h ./drivers/net/wireless/rtlwifi/rtl8192se/reg.h ./drivers/net/wireless/rtlwifi/rtl8192de/reg.h
You see that all the rtl8192 drivers are affected by this bug.
It seems that the regulatory engine of the realtek driver package is in regd.c. So let’s edit it with your preferred editor. I use vim:
At line 53 and 54 you see something like that:
#define RTL819x_2GHZ_CH01_11 \ REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
This is a regulatory definition that CRDA uses too. I will only change the values of the RTL819x_2GHZ_CH01_11 definition and will pimp them to use all 14 channels available worldwide and to use a maximum dBm of 33 (what is about 2000 mW, the maximum of my card).
The REG_RULE function is defined as follow:
REG_RULE(min_freq, max_freq, kHz, max_dbm_with_antenna, max_dbm, flags)
Here is my pimped REG_RULE:
REG_RULE(2412-10, 2484+10, 40, 0, 33, 0)
Replace the old rule with this one and you will get the maximum out of your hardware.
Now unload already loaded realtek drivers, rebuild and install them:
modprobe -r `lsmod|grep ^rtl` make && make install
When you plug-in your wifi device iwconfig should output something like that:
wlan0 IEEE 802.11bgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry long limit:7 RTS thr=2347 B Fragment thr:off Encryption key:off Power Management:on
That’s it! I hope it helps.
NOTE: The frequencies and power rates used in this article are not legal in most country’s! Don’t use them if you have no special permissions for it or adjust the values to your country regulatory.