Skip to content

Commit

Permalink
[PATCH] ipw2100: Fix setting txpower failed problem
Browse files Browse the repository at this point in the history
The ipw2100 driver misunderstood the parameter of txpower.
Tx Power off means turn off the radio, but the driver interpret it as
"can't set txpower". So when getting the txpower, it sets disabled=1 to
the iwconifg tool in managed mode. And the tool will display "Tx Power off"
when disabled=1.

Now, in managed mode, iwconfig will not show "TX Power" if the radio is not
switched off. It will only display "Tx Power off" only if the radio is killed.

Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Zhu Yi authored and John W. Linville committed Jan 30, 2006
1 parent 3c5eca5 commit b6e4da7
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions drivers/net/wireless/ipw2100.c
Original file line number Diff line number Diff line change
Expand Up @@ -7114,11 +7114,17 @@ static int ipw2100_wx_set_txpow(struct net_device *dev,
{
struct ipw2100_priv *priv = ieee80211_priv(dev);
int err = 0, value;

if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled))
return -EINPROGRESS;

if (priv->ieee->iw_mode != IW_MODE_ADHOC)
return 0;

if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
return -EINVAL;

if (wrqu->txpower.disabled == 1 || wrqu->txpower.fixed == 0)
if (wrqu->txpower.fixed == 0)
value = IPW_TX_POWER_DEFAULT;
else {
if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM ||
Expand Down Expand Up @@ -7153,24 +7159,19 @@ static int ipw2100_wx_get_txpow(struct net_device *dev,

struct ipw2100_priv *priv = ieee80211_priv(dev);

if (priv->ieee->iw_mode != IW_MODE_ADHOC) {
wrqu->power.disabled = 1;
return 0;
}
wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0;

if (priv->tx_power == IPW_TX_POWER_DEFAULT) {
wrqu->power.fixed = 0;
wrqu->power.value = IPW_TX_POWER_MAX_DBM;
wrqu->power.disabled = 1;
wrqu->txpower.fixed = 0;
wrqu->txpower.value = IPW_TX_POWER_MAX_DBM;
} else {
wrqu->power.disabled = 0;
wrqu->power.fixed = 1;
wrqu->power.value = priv->tx_power;
wrqu->txpower.fixed = 1;
wrqu->txpower.value = priv->tx_power;
}

wrqu->power.flags = IW_TXPOW_DBM;
wrqu->txpower.flags = IW_TXPOW_DBM;

IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->power.value);
IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->txpower.value);

return 0;
}
Expand Down

0 comments on commit b6e4da7

Please sign in to comment.