]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ipw2200: SIOCGIWFREQ ioctl returns frequency rather than channel
authorZhu Yi <yi.zhu@intel.com>
Mon, 21 Aug 2006 03:37:01 +0000 (11:37 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 29 Aug 2006 21:06:31 +0000 (17:06 -0400)
The SIOCGIWFREQ ioctl fills the request structure's freq field by setting
the exponent to 0 and the mantissa to the current channel number. The
iwconfig tool works around this behaviour by looking up the frequency
from the channel table if a frequency below 1kHz is returned, other tools
(e.g. kwlaninfo) don't. According to the comment in the iwconfig source
the driver is supposed to return the frequency, not the channel number.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ipw2200.c

index 89e076fa10394bd971707063274f0732ade8d10b..0b2c774f5ee787b9110773dbad47bffce58ef05c 100644 (file)
@@ -8562,9 +8562,26 @@ static int ipw_wx_get_freq(struct net_device *dev,
         * configured CHANNEL then return that; otherwise return ANY */
        mutex_lock(&priv->mutex);
        if (priv->config & CFG_STATIC_CHANNEL ||
-           priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))
-               wrqu->freq.m = priv->channel;
-       else
+           priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) {
+               int i;
+
+               i = ieee80211_channel_to_index(priv->ieee, priv->channel);
+               BUG_ON(i == -1);
+               wrqu->freq.e = 1;
+
+               switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) {
+               case IEEE80211_52GHZ_BAND:
+                       wrqu->freq.m = priv->ieee->geo.a[i].freq * 100000;
+                       break;
+
+               case IEEE80211_24GHZ_BAND:
+                       wrqu->freq.m = priv->ieee->geo.bg[i].freq * 100000;
+                       break;
+
+               default:
+                       BUG();
+               }
+       } else
                wrqu->freq.m = 0;
 
        mutex_unlock(&priv->mutex);