add function for enabling/disabling radio in wlcompat

SVN-Revision: 1129
owl
Felix Fietkau 2005-06-01 15:12:20 +00:00
parent f1aeb6c8f2
commit 43e5060743
1 changed files with 25 additions and 11 deletions

View File

@ -384,18 +384,30 @@ static int wlcompat_ioctl(struct net_device *dev,
} }
case SIOCGIWTXPOW: case SIOCGIWTXPOW:
{ {
int radio;
if (wl_ioctl(dev, WLC_GET_RADIO, &radio, sizeof(int)) < 0)
return -EINVAL;
if (wl_get_val(dev, "qtxpower", &(wrqu->txpower.value), sizeof(int)) < 0) if (wl_get_val(dev, "qtxpower", &(wrqu->txpower.value), sizeof(int)) < 0)
return -EINVAL; return -EINVAL;
wrqu->txpower.value &= ~WL_TXPWR_OVERRIDE; wrqu->txpower.value &= ~WL_TXPWR_OVERRIDE;
wrqu->txpower.fixed = 0; wrqu->txpower.fixed = 0;
wrqu->txpower.disabled = 0; wrqu->txpower.disabled = radio;
wrqu->txpower.flags = IW_TXPOW_MWATT; wrqu->txpower.flags = IW_TXPOW_MWATT;
break; break;
} }
case SIOCSIWTXPOW: case SIOCSIWTXPOW:
{ {
/* This is weird: WLC_SET_RADIO with 1 as argument disables the radio */
int radio = wrqu->txpower.disabled;
if (wl_ioctl(dev, WLC_SET_RADIO, &radio, sizeof(int)) < 0)
return -EINVAL;
if (!wrqu->txpower.disabled) {
int override; int override;
if (wl_get_val(dev, "qtxpower", &override, sizeof(int)) < 0) if (wl_get_val(dev, "qtxpower", &override, sizeof(int)) < 0)
@ -408,6 +420,8 @@ static int wlcompat_ioctl(struct net_device *dev,
if (wl_set_val(dev, "qtxpower", &wrqu->txpower.value, sizeof(int)) < 0) if (wl_set_val(dev, "qtxpower", &wrqu->txpower.value, sizeof(int)) < 0)
return -EINVAL; return -EINVAL;
}
} }
case SIOCGIWENCODE: case SIOCGIWENCODE:
{ {