mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-25 15:06:47 +02:00
add function for enabling/disabling radio in wlcompat
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1129 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ccd2cd2a4d
commit
54fa2845dd
@ -384,30 +384,44 @@ 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:
|
||||||
{
|
{
|
||||||
int override;
|
/* This is weird: WLC_SET_RADIO with 1 as argument disables the radio */
|
||||||
|
int radio = wrqu->txpower.disabled;
|
||||||
if (wl_get_val(dev, "qtxpower", &override, sizeof(int)) < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
wrqu->txpower.value |= override & WL_TXPWR_OVERRIDE;
|
|
||||||
|
|
||||||
if (wrqu->txpower.flags != IW_TXPOW_MWATT)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (wl_set_val(dev, "qtxpower", &wrqu->txpower.value, sizeof(int)) < 0)
|
if (wl_ioctl(dev, WLC_SET_RADIO, &radio, sizeof(int)) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!wrqu->txpower.disabled) {
|
||||||
|
int override;
|
||||||
|
|
||||||
|
if (wl_get_val(dev, "qtxpower", &override, sizeof(int)) < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
wrqu->txpower.value |= override & WL_TXPWR_OVERRIDE;
|
||||||
|
|
||||||
|
if (wrqu->txpower.flags != IW_TXPOW_MWATT)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (wl_set_val(dev, "qtxpower", &wrqu->txpower.value, sizeof(int)) < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case SIOCGIWENCODE:
|
case SIOCGIWENCODE:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user