Compliance Mode for Ubiquiti AirMax Radios

Sometime after “AirOS 5.3.3.9634.110726.1142” Ubiquiti took out what was called “Compliance Mode” that enabled frequencies outside of the Part 15 bands.  This was handy if you wanted to run these radios in Part 97 or Amateur or “Ham” Bands.   There was a simple way of doing this right after they took this out by just doing a …

 touch /etc/persistent/ct
 save
 reboot

Alas, this was taken out after a while.

After googling around and banging on this a bit, the “Country Code” for “Compliance Mode” that had an ID of 511 is now called “Licensed”.  You can find it in /var/etc/ccodes.inc.  The trick is to set the Atheros chipset on startup to the county code you want.   This would be done with a custom script that runs when the radio boots up.  You will need firmware that supports that that has “cs” in the file name.  Go to:

https://community.ui.com/questions/airOS-5-6-with-Custom-Script-Support-/4bd71c6b-7e9c-43ee-9d9d-666a7a9708fd#comment/e6d675ef-2e50-46f4-bf2a-7ef94dd12068

and find the firmware for your board (eg XM, XW or TI).  Upgrade the radio with this firmware.

After the upgrade and reboot, you can use this script that you should call “/etc/persistent/rc.poststart” with the following:

#!/bin/sh
# This is dependent on v6.3.0 of the firmware.  You may need 
# to point to the ubnt_spectral module someplace else if you
# have a different firmware version.
insmod /lib/modules/2.6.32.71/ubnt_spectral.ko
iwpriv wifi0 setCountry Ub
ifconfig ath0 down
ifconfig wifi0 down
sleep 5
rmmod /lib/modules/2.6.32.71/ubnt_spectral.ko
ifconfig ath0 up
ifconfig wifi0 up
echo "countrycode=511" > /var/etc/atheros.conf
# '840' is the Country Code for the US
sed -i 's/840/511/g' /tmp/system.cfg
echo "<option value="511">Compliance Test</option>" >> /var/etc/ccodes.inc

After creating this script, make sure you “chmod a+x /etc/persistent/rc.poststart” and the type “save” and “reboot”.

Once the radio has rebooted, you should be able to go to the “WIRELESS” tab and see that the Country Code is set for  Licensed.  If you select the “Frequency Scan List”, you should see a bunch of frequencies you can now select (see below).  Alas, the script does not survive the reboot, but that is fine as the change to “License” will survive reboots.  You can confirm this by ssh’ing into the radio and running the commands:

XM.v6.3.0# iwpriv wifi0 getCountry
wifi0     getCountry:UB 
XM.v6.3.0# iwpriv wifi0 getCountryID
wifi0     getCountryID:511 
XM.v6.3.0# 

I guess the Country “UB” is “Ubiquiti” 🙂