Fixing the regulatory domain (CRDA) of Realtek’s RTL8192 linux wifi drivers

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

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:


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:

vim ./drivers/net/wireless/rtlwifi/regd.c

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.

About these ads
This entry was posted in Backtrack, Debian, Drivers, Howto, Linux, Wireless and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s