aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2005-06-01 15:12:20 +0000
committerFelix Fietkau <nbd@openwrt.org>2005-06-01 15:12:20 +0000
commit3cb2477b84e8157971a6e2df007a90793d79e330 (patch)
tree91119edc8d39c64e096061fc290929ad17da31a5 /target
parenta18f0ccc4ec27a8f796f142358a2e1e76616a713 (diff)
downloadupstream-3cb2477b84e8157971a6e2df007a90793d79e330.tar.gz
upstream-3cb2477b84e8157971a6e2df007a90793d79e330.tar.bz2
upstream-3cb2477b84e8157971a6e2df007a90793d79e330.zip
add function for enabling/disabling radio in wlcompat
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1129 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/package/wlcompat/wlcompat.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/target/linux/package/wlcompat/wlcompat.c b/target/linux/package/wlcompat/wlcompat.c
index e39fe6889a..e3d42f5cbe 100644
--- a/target/linux/package/wlcompat/wlcompat.c
+++ b/target/linux/package/wlcompat/wlcompat.c
@@ -384,30 +384,44 @@ static int wlcompat_ioctl(struct net_device *dev,
}
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)
return -EINVAL;
wrqu->txpower.value &= ~WL_TXPWR_OVERRIDE;
wrqu->txpower.fixed = 0;
- wrqu->txpower.disabled = 0;
+ wrqu->txpower.disabled = radio;
wrqu->txpower.flags = IW_TXPOW_MWATT;
break;
}
case SIOCSIWTXPOW:
{
- int override;
-
- if (wl_get_val(dev, "qtxpower", &override, sizeof(int)) < 0)
+ /* 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;
- wrqu->txpower.value |= override & WL_TXPWR_OVERRIDE;
-
- if (wrqu->txpower.flags != IW_TXPOW_MWATT)
- return -EINVAL;
+ if (!wrqu->txpower.disabled) {
+ int override;
- if (wl_set_val(dev, "qtxpower", &wrqu->txpower.value, sizeof(int)) < 0)
- return -EINVAL;
+ 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:
{