PDA

View Full Version : For those having trouble setting tx power and/or country for crda



destreza
2015-06-15, 07:37
I have made a script that fixed it for me and maybe others. For some reason crda needs to be woken up first before country is actually set (which is odd) even if it outputs an error.

this fixes error -22 for me and can possibly fix other issues people may be having.

I assume in the script your device is wlan0 and your target tx power is 30, as for the country it is US

So say you have your country set first and then start crda, it wont listen and outputs error as well as for setting tx power from iwconfig but I found out that starting it without a country set then after error setting country and then starting it again only with no error.

only then would it read from iw reg set

apt-get update
apt-get install python-m2crypto libgcrypt11 libgcrypt11-dev libnl-dev rfkill



echo " !!WARNING!!"
echo "MAKE SURE YOU HAVE COMPILED AND INSTALLED LATEST crda-x.xx.tar.xz AND wireless-regdb-xxxx.xx.xx.tar.xz"
echo "needs python-m2crypto, libgcrypt11, libgcrypt11-dev, libnl-dev and rfkill"
echo "This can be found here https://www.kernel.org/pub/software/network/"
echo "Be sure to use these instructions: http://pastebin.com/pY3i5f8h"
echo "Hit ^C to stop now if you wish. Also, it is prefered to do this on a fresh boot/reboot"
echo "-----------------------------------------------------------------------------------------------"
sleep 2
echo "To change this script to work for a specfic device and/or country do something like this: e.g."
sleep 1
echo "# sed -i ‘s/wlan0/wlan1/’ path/to/this/script"
echo "# sed -i ‘s/US/BO/’ path/to/this/script"
echo "Starting in 10 seconds"
sleep 11
echo "Stopping Possible Conflicting Services"
service NetworkManager stop &> /dev/null
service wicd stop &> /dev/null
service networking stop &> /dev/null
systemctl stop NetworkManager wicd networking &> /dev/null
sleep 2
rfkill unblock wlan &> /dev/null
echo "" > /etc/default/crda &> /dev/null
echo "Starting crda"
crda &> /dev/null
sleep 2
export COUNTRY=00
crda
iw reg set US
iw reg get
echo "Taking down wlan0"
ifconfig wlan0 down
sleep 3
echo "Setting Region to United States"
iw reg set US
sleep 3
echo "Setting TxPower to 30"
iwconfig wlan0 txpower 30
sleep 2
echo "Starting wlan0"
ifconfig wlan0 up
echo "Putting wlan0 interface up"
echo "------------------"
echo " Max tx Power Set "
echo "------------------"
sleep 3
echo "Turning Power Management off..."
ifconfig wlan0 down
sleep 1
iwconfig wlan0 power off
sleep 1
ifconfig wlan0 up
sleep 1
echo "-------------------"
echo " Power Managment "
echo " is now OFF "
echo "-------------------"
sleep 3
echo "==================================="
echo "Here are your all your new settings"
echo "==================================="
iw reg get
echo
echo "==================================="
iwconfig wlan0
echo "==================================="
echo "Restoring Stopped Services"
service NetworkManager start &> /dev/null
service wicd start &> /dev/null
service networking start &> /dev/null
systemctl start NetworkManager wicd networking &> /dev/null
sleep 2
echo "** If all is well, there should have been no errors outputed **"
sleep 2

Quest
2015-06-15, 19:40
Thanks des.

like wn722 would say..
hm anyone tried this with TP Link WN722N?

destreza
2015-06-15, 22:52
Thanks des.

like wn722 would say..

np :)

I could not find anything about -22 error I have been getting, but by random chance this "trick" seemed to work.

Quest
2015-06-15, 23:03
it works on TP-Link WN722N ? http://www.tp-link.com/en/products/details/cat-11_TL-WN722N.html

destreza
2015-06-16, 07:31
FCC test results[edit]
Radiated power (with antenna): 98.72 dBuV/m peak (802.11b CH6)
Output power (before antenna): 17.8 dBm peak (802.11b CH6) (60.26mW)

Your chipset (AR9002U) supports modification to max tx (dbm) power but the results will only induce instability if you ask me.


You may try but don't expect the best results.

Nakishus
2015-06-16, 20:12
it works on TP-Link WN722N ? http://www.tp-link.com/en/products/details/cat-11_TL-WN722N.html

i have TP-Link Wn722N adapter and it works following this tutorial. i can set now my card to 30dbm or 1000mW

https://forums.kali.org/showthread.php?22733-How-to-Set-Your-Wi-FI-Card-Tx-Power-Higher-Than-30dbm&highlight=Wi-FI+Card+Power+Higher+30dbm

Quest
2015-06-18, 17:15
you're about the first human in the universe reporting success in cranking up a WN722N, Nakishus. I will give that a spin whenever Kali 1.1.1 comes out. Thanks for the info!