Tobias Diedrich wrote:
> Tobias Diedrich wrote:
> > This patch tries to fix this (but is probably wrong :))
> > After applying this patch "iw phy phy0 info" looks good, but
> > WiFi Analyzer on my phone still shows a very weak signal for the AP.
> > 
> > Until I do this:
> > root@OpenWrt:/# iw phy phy0 set txpower fixed 0
> > root@OpenWrt:/# iw phy phy0 set txpower auto
> > 
> > And then the signal strength is good.
> > 
> > iw phy phy0 set txpower fixed|limit still doesn't accept values above 0 for
> > some reason though.
> 
> Ok, "iw phy phy0 set txpower fixed|limit 2000" does work, I fell
> into the 'must be multiple of 100 but I won't give you any helpful
> error message to tell you this' trap.
> 
> I also now believe the value for max_power below should be
> AR5K_TUNE_MAX_TXPOWER/2 (31dBm) (or even better use calibration
> data from the eeprom).
> 
> Still need to figure out why it boots up with txpower set to 0
> though...


Ok, the problem there is as follows, here is an excerpt with added printks:

[  391.348000] cfg80211: Regulatory domain changed to country: CH
[  391.356000] cfg80211:   (start_freq - end_freq @ bandwidth), 
(max_antenna_gain, max_eirp)
[  391.364000] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 
mBm)
[  391.372000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 
mBm)
[  391.376000] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 
mBm)
[  391.384000] cfg80211:   (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 
mBm)
[  393.288000] ath5k_hw_txpower(txp_user_pwr = 63)
[  393.290000] Reset TX power values
[  393.304000] ath5k_hw_txpower(txp_user_pwr = 0)
                                ^^^^^^^^^^^^^^^^
txp_user_pwr was lost because in drivers/wireless/ath/ath5k/phy.c,
ath5k_hw_txpower() will memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower))
if the channel has changed.

[  393.312000] ath5k_config: set power_level 20
[  393.316000] ath5k_hw_set_txpower_limit(40)
[  393.320000] ath5k_hw_txpower(txp_user_pwr = 40)
[  393.324000] ath5k_config: set power_level ret=0
[  393.388000] device wlan0 entered promiscuous mode
[  393.396000] ath5k_hw_txpower(txp_user_pwr = 40)
[  393.416000] ath5k_hw_txpower(txp_user_pwr = 40)
[  394.448000] ath5k_hw_txpower(txp_user_pwr = 40)
[  394.450000] Reset TX power values
               ^^^^^^^^^^^^^^^^^^^^^
Here txp_user_pwr is lost again.

[  394.456000] br-lan: port 2(wlan0) entered forwarding state
[  394.460000] br-lan: port 2(wlan0) entered forwarding state
[  396.464000] br-lan: port 2(wlan0) entered forwarding state
[  396.920000] set_tx_power fn at 80d144bc
[  396.924000] trying to set level to 2000
[  396.928000] set_tx_power returned 0

OpenWRT scripts (or wpad) called "iw set txpower limit 2000", but
the upper mac80211 layer did not call into the driver since it was set to
20dBm before and this would be (should have been) a noop.

root@OpenWrt:/# iw phy phy0 set txpower limit 0
[  524.344000] set_tx_power fn at 80d144bc
[  524.344000] trying to set level to 0
[  524.348000] ath5k_config: set power_level 0
[  524.352000] ath5k_hw_set_txpower_limit(0)
[  524.356000] ath5k_hw_txpower(txp_user_pwr = 0)
[  524.360000] ath5k_config: set power_level ret=0
[  524.368000] set_tx_power returned 0

Explicitly set to 0, called into the driver, effectively no change
since txp_user_pwr was already 0.

root@OpenWrt:/# iw phy phy0 set txpower limit 2000
[  543.632000] set_tx_power fn at 80d144bc
[  543.636000] trying to set level to 2000
[  543.636000] ath5k_config: set power_level 20
[  543.644000] ath5k_hw_set_txpower_limit(40)
[  543.648000] ath5k_hw_txpower(txp_user_pwr = 40)
[  543.652000] ath5k_config: set power_level ret=0
[  543.656000] set_tx_power returned 0

Finally txp_user_pwr is 40 and the WiFi signal is strong.

-- 
Tobias                                          PGP: http://8ef7ddba.uguu.de
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to