#306: Can't set txpower by iwconfig command
------------------------------------+---------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: dyqith
Type: defect | Status: assigned
Priority: major | Milestone:
Component: madwifi: other | Version: trunk
Resolution: | Keywords: txpower
Patch_attached: 0 |
------------------------------------+---------------------------------------
Comment (by [EMAIL PROTECTED]):
There is definately a problem here, and it is affected by time, or maybe
attempts
coupled with time.
iwconfig commands appear to be completely ignored sometimes. I've tried
different timeouts, before during after and in-between various commands.
See the comments I put in the trace below. Repeating the entire sequence
will make it work. *SOMETIMES*.
Custom setup:
2.4.31 kernel
Madwifi < 1 week old, and I keep updating, not seeing many changed files
that would appear to be relevant.
Tested with CM6,CM9,EMP-8602,NTE-312AA (A-Only)
WRAP .2C .1E w/latest firmware
Soekris 4511 4521 w/latest firmware
I run into channel set problems in master mode even on the A only card
setting an A channel.
Wierd.
{{{
Below is a script trace (custom) card was CM-6 on this pass.
===> Means a Comment from me
. . . ===> ath_pci loaded manually, other modules auto
Module ath_rate_sample loaded, with warnings
Module ath_pci loaded, with warnings
+ '[' wifi0 = '' ']'
+ wlanmode=ap
+ wlanconfig ath0 create wlandev wifi0 wlanmode ap
ath0
+ iwconfig ath0
ath0 IEEE 802.11b ESSID:""
Mode:Master Channel:0 Access Point: 00:00:00:00:00:00
Bit Rate:0 kb/s Tx-Power:50 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/94 Signal level=-95 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
===> So far so good. This is checking for an 802.11 mode and the
===> requested channel this is to run on. In this case I want
===> channel 161 and the mode is not set in the config file
+ '[' '(' 0 -eq 0 ')' -a '(' 161 -gt 11 ')' ']'
+ ap_mode=1
+ '[' '(' 1 ')' -a '(' 1 -ne 0 ')' ']'
===> This is some BS I put in the script to try 3 times to set mode
===> NOTE: I've done this before and after other parms
+ ix=4
+ '[' 4 -gt 0 ']'
===> OK attempt to set the mode to 1 (11a)
+ iwpriv ath0 mode 1
+ sleep 2
===> get_mode=`iwpriv $iface get_mode | awk -F ':' ' {print $2}'`
++ iwpriv ath0 get_mode
++ awk -F : ' {print $2}'
+ get_mode=11b
+ echo 'Got mode = 11b'
Got mode = 11b
++ expr 4 - 1
+ ix=3
+ '[' 3 -gt 0 ']'
===> OK again
+ iwpriv ath0 mode 1
+ sleep 2
++ iwpriv ath0 get_mode
++ awk -F : ' {print $2}'
+ get_mode=11b
+ echo 'Got mode = 11b'
Got mode = 11b
++ expr 3 - 1
+ ix=2
+ '[' 2 -gt 0 ']'
===> OK Try # 3
+ iwpriv ath0 mode 1
+ sleep 2
++ iwpriv ath0 get_mode
++ awk -F : ' {print $2}'
+ get_mode=11b
+ echo 'Got mode = 11b'
Got mode = 11b
++ expr 2 - 1
+ ix=1
+ '[' 1 -gt 0 ']'
===> Try # 4
+ iwpriv ath0 mode 1
+ sleep 2
++ iwpriv ath0 get_mode
++ awk -F : ' {print $2}'
+ get_mode=11b
+ echo 'Got mode = 11b'
Got mode = 11b
++ expr 1 - 1
+ ix=0
+ '[' 0 -gt 0 ']'
===> Give up, set up antenna. This works every time no matter
===> what the values, or where it is in the script . . .
===> [ \( "$antsel_rx" != "0" \) -o \( "$antsel_tx" != "0" \) ] && \
===> echo "0" > /proc/sys/dev/$wifi/diversity
===> [ "$antsel_rx" != "0" ] && \
===> echo $antsel_rx > /proc/sys/dev/$wifi/rxantenna
===> [ "$antsel_tx" != "0" ] && \
===> echo $antsel_tx > /proc/sys/dev/$wifi/txantenna
+ '[' '(' 1 '!=' 0 ')' -o '(' 1 '!=' 0 ')' ']'
+ echo 0
+ '[' 1 '!=' 0 ']'
+ echo 1
+ '[' 1 '!=' 0 ']'
+ echo 1
+ '[' 300 ']'
+ athctrl -i wifi0 -d 300
Setting distance on interface wifi0 to 300 meters
+ start_wcommon
+ ifconfig ath0 up
===> ESSID setup. This works every time, no matter where it is.
+ '[' CasaFiestaA ']'
+ iwconfig ath0 essid CasaFiestaA
+ sleep 2
===> Pointless sleep, I've taken this up to 10 seconds to no avail
===> If we are a master we can set the channel
+ '[' '(' Master '!=' Managed ')' -a '(' 161 ')' ']'
+ echo 'iwconfig ath0 channel 161'
iwconfig ath0 channel 161
+ iwconfig ath0 channel 161
+ sleep 2
===> Another pointless sleep, Note the channel. . . It is Wrong!!!
===> Channel 161 = 5.805
===> *and* no error given either. . .
+ iwconfig ath0
ath0 IEEE 802.11Ta ESSID:"CasaFiestaA"
Mode:Master Frequency:5.765 GHz Access Point:
00:00:00:00:00:00
Bit Rate:0 kb/s Tx-Power:14 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/94 Signal level=-95 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
===> Now we try to set power, which pukes. Now this is odd. According to
===> the documentation setting power to 30 will always select the highest
===> available power. This does not work on anything but the emp card.
===> The biggest number you can plug in varies by selected channel, but is
===> *always higher* than the reported number from iwconfig. Too wierd :)
+ '[' 25 '!=' auto ']'
+ echo 'iwconfig ath0 txpower 25'
iwconfig ath0 txpower 25
+ iwconfig ath0 txpower 25
Error for wireless request "Set Tx Power" (8B26) :
SET failed on device ath0 ; Operation not supported.
+ '[' 0 -a '(' 0 -ne 0 ')' ']'
+ '[' '' ']'
===>
===> So fuggit, I run thru the common stuff twice for madwifi
===> (I use hostap stuff too)
+ start_wcommon
+ ifconfig ath0 up
+ '[' CasaFiestaA ']'
+ iwconfig ath0 essid CasaFiestaA
+ sleep 2
+ '[' '(' Master '!=' Managed ')' -a '(' 161 ')' ']'
+ echo 'iwconfig ath0 channel 161'
iwconfig ath0 channel 161
+ iwconfig ath0 channel 161
+ sleep 2
+ iwconfig ath0
ath0 IEEE 802.11a ESSID:"CasaFiestaA"
Mode:Master Frequency:5.805 GHz Access Point:
00:0B:6B:33:5A:D0
Bit Rate:0 kb/s Tx-Power:14 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/94 Signal level=-95 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
===> MAGIC!
===> The channel sets this time. NOTE: LONG TIMEOUT's above do not help
===> even between commands, but now all of a sudden, re-running the ESSID
===> set, and the channel set it works, and of course the power will then
===> set below!
===> This does not *always* work! But is relatively reliable.
+ '[' 25 '!=' auto ']'
+ echo 'iwconfig ath0 txpower 25'
iwconfig ath0 txpower 25
+ iwconfig ath0 txpower 25
+ '[' 0 -a '(' 0 -ne 0 ')' ']'
+ '[' '' ']'
+ ifconfig ath0
+ '[' 10.100.128.1 ']'
+ /sbin/ifconfig ath0 10.100.128.1 netmask 255.255.255.0 broadcast
10.100.128.255
+ '[' disable = enable ']'
+ '[' '' ']'
+ exit 0
}}}
I'd be happy to test any changes thouroughly with all my various cards.
I consider this a critical problem really because I cannot reliably fire
up a MADWIFI based AP. I had to fork the madwifi startup severely because
of 'wlanconfig', but this was a problem even with the old madwifi stuff in
AP mode. I have *never* been able to get a reliable channel set, even in
the 'B' or 'G' band/modes, with and without iwpriv athX mode X
In reality one should be able to simply set the channel, and go. With
hostap
you can set this stuff in any order. It maintains the settings internally
and
will reset what is neccessary at ioctl time. If time permits I might
could
dig into this, but I have no clue about the 'HAL' layer API.
--KS
--
Ticket URL: <http://madwifi.org/ticket/306>
MadWifi <http://madwifi.org/>
Multiband Atheros Driver for Wireless Fidelity