From: Liu Hong [Bug 339] Fix ipw2100 iwconfig set/get txpower. --- ipw2100-1.1.1-chuyee/ipw2100.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff -puN ipw2100.c~txpower-fix ipw2100.c --- ipw2100-1.1.1/ipw2100.c~txpower-fix 2005-07-13 14:49:44.000000000 +0800 +++ ipw2100-1.1.1-chuyee/ipw2100.c 2005-07-13 14:49:57.000000000 +0800 @@ -4852,6 +4852,10 @@ static int ipw2100_set_tx_power(struct i }; int err = 0; + if (tx_power != IPW_TX_POWER_DEFAULT) + tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / + (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); + cmd.host_command_parameters[0] = tx_power; if (priv->ieee->iw_mode == IW_MODE_ADHOC) @@ -7266,8 +7270,7 @@ static int ipw2100_wx_set_txpow(struct n wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) return -EINVAL; - value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); + value = wrqu->txpower.value; } down(&priv->action_sem); @@ -7307,11 +7310,7 @@ static int ipw2100_wx_get_txpow(struct n } else { wrqu->power.disabled = 0; wrqu->power.fixed = 1; - wrqu->power.value = - (priv->tx_power * - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / - (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + - IPW_TX_POWER_MIN_DBM; + wrqu->power.value = priv->tx_power; } wrqu->power.flags = IW_TXPOW_DBM; _