txpower not working after reset [PATCH included]

Jirka Bohac jbohac
Wed Jun 11 03:45:52 PDT 2003

> Hello,
> I am using hostap cvs dated 20030531 with two Prism cards: Senao 2511 and
> Engenius 2011.
> On both cards, when I use "iwpriv wlan+ reset" (whatever number), I can no
> longer set the txpower.

There seems to be a bug in the driver. Resetting the card resets the ALC
(automatic power) value to 1. The driver does not know about this
(resets occur for different reasons, quite asynchronously :) ).

When setting the power after the reset, the function
prism2_ioctl_siwtxpow assumes the card is already in fixed power mode
(ALC=0) and sets the CR31 register, which has no effect.

A workaround for this is:

iwconfig wlanx txpower auto (sets ALC to 1, the driver will know it is 1)
iwconfig wlanx txpower desired_value fixed (the driver knows it has to
set the ALC to 0)

Anyhow, resets happen every now and then and this cancels the txpower
settings. 1 workaround is setting the power using something like cron,

I did not like this and wrote a patch that resets the txpower settings
after all resets. It also fixes your problem with the shadow copy of the
ALC setting. 

The patch and more info can be found at http://jikos.cz/~jbohac/hostap

The patch also tries to reset the correct values for sens,
rate and retry parameters after resets, but some of it works only in
master mode and it has not been thoroughly tested, so it is not enabled
by default.

> BTW the txpower "dBm" rating is not accurate, a friend used a spectrum
> analyser with an Engenius 2011 (STA fw 1.4.9) and made a handy diagram
> between "real dBm" and "hostap dBm"
> http://fantasy.cslab.ntua.gr/hostapchart.jpg

This is one more thing the patch changes. We also have calibrations for
the cards most used in our network (ZCOM XI626 and Alphawave)
The calibration maps the real measured output power to the internal
register values of the CR31, so we preferred iwconfig to work with these
values. Of course that the original iffy dBm conversion can be used as
well - more info on the webpage containing the patch.

Calibrations for our cards can be found here (you will understand the
digits :) ):

Jouni: the patch does rather big changes to the code, which I'm sure you
wouldn't like. However, you might want to incorporate some of the
changes to the driver in some other manner. The shadow copy of the ALC
is an obvious bug, and restoring power and other settings after a card's
reset is also very handy. I will be happy if you can use any of the
modified code. Do write if you need more comments!

Jirka Bohac
CZFree.Net, Prague, Czechia

More information about the Hostap mailing list