From: nbd Date: Wed, 1 Jun 2005 15:12:20 +0000 (+0000) Subject: add function for enabling/disabling radio in wlcompat X-Git-Url: http://git.rohieb.name/openwrt.git/commitdiff_plain/260f1a89a0d4f8382c415b33c524f610143d570e?hp=670c2455c25ae20dfe1b845521b644cef90faedd add function for enabling/disabling radio in wlcompat git-svn-id: svn://svn.openwrt.org/openwrt/trunk@1129 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/openwrt/target/linux/package/wlcompat/wlcompat.c b/openwrt/target/linux/package/wlcompat/wlcompat.c index e39fe6889..e3d42f5cb 100644 --- a/openwrt/target/linux/package/wlcompat/wlcompat.c +++ b/openwrt/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: {