add even more workarounds for bcm4710, remove -fno-delayed-branch from kernel cflags...
[openwrt.git] / target / linux / package / wlcompat / wlcompat.c
index d010e2b..e3d42f5 100644 (file)
@@ -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:
                {
@@ -485,18 +499,11 @@ static int wlcompat_ioctl(struct net_device *dev,
                                        return -EINVAL;
                        }
                        
-                       if (wl_ioctl(dev, WLC_SET_PASSIVE, &passive, sizeof(passive)) < 0)
-                               return -EINVAL;
-                       if (wl_ioctl(dev, WLC_SET_MONITOR, &passive, sizeof(passive)) < 0)
-                               return -EINVAL;
-                       if (wl_ioctl(dev, WLC_SET_WET, &wet, sizeof(wet)) < 0)
-                               return -EINVAL;
-                       if (ap >= 0)
-                               if (wl_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)) < 0)
-                                       return -EINVAL;
-                       if (infra >= 0)
-                               if (wl_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra)) < 0)
-                                       return -EINVAL;
+                       wl_ioctl(dev, WLC_SET_PASSIVE, &passive, sizeof(passive));
+                       wl_ioctl(dev, WLC_SET_MONITOR, &passive, sizeof(passive));
+                       wl_ioctl(dev, WLC_SET_WET, &wet, sizeof(wet));
+                       wl_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap));
+                       wl_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra));
 
                        break;
                                                
This page took 0.021079 seconds and 4 git commands to generate.