Greetings,

attached a combined patch with is consistent with the scales being used where :

* channel is always u8
* geo.freq * 100000 -> freq.m, freq.e=1 (as ipw2200 does)
* freq is int and corresponds to the frequency in MHz (as used by the 
  freq_to_channel and channel_to_freq helper functions) 

tested and currently being used to send this email with working values for
iwlist, iwgetid and iwconfig channel/freq

Carlo

PS. not to apply incrementally with previous patch
Index: bcm43xx_radio.c
===================================================================
--- bcm43xx_radio.c     (revision 1023)
+++ bcm43xx_radio.c     (working copy)
@@ -147,7 +147,7 @@
 u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm)
 {
        u8 ret[13];
-       unsigned int channel = bcm->current_core->radio->channel;
+       u8 channel = bcm->current_core->radio->channel;
        unsigned int i, j, start, end;
        unsigned long phylock_flags;
 
Index: bcm43xx_wx.c
===================================================================
--- bcm43xx_wx.c        (revision 1023)
+++ bcm43xx_wx.c        (working copy)
@@ -127,8 +127,8 @@
                channel = data->freq.m;
                freq = bcm43xx_channel_to_freq(bcm, channel);
        } else {
-               channel = bcm43xx_freq_to_channel(bcm, data->freq.m);
-               freq = data->freq.m;
+               freq = data->freq.m / 100000;
+               channel = bcm43xx_freq_to_channel(bcm, freq);
        }
        if (!bcm43xx_is_valid_channel(bcm, channel))
                return -EINVAL;
@@ -156,7 +156,8 @@
        struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
        unsigned long flags;
        int err = -ENODEV;
-       u16 channel;
+       u8 channel;
+       int freq;
 
        wx_enter();
 
@@ -168,9 +169,10 @@
                if (channel == 0xFF)
                        goto out_unlock;
        }
-       assert(channel > 0 && channel <= 1000);
+       freq = bcm43xx_channel_to_freq(bcm, channel);
+       assert(freq > 1000);
        data->freq.e = 1;
-       data->freq.m = bcm43xx_channel_to_freq(bcm, channel) * 100000;
+       data->freq.m = freq * 100000;
        data->freq.flags = 1;
 
        err = 0;
@@ -315,7 +317,7 @@
                if (j == IW_MAX_FREQUENCIES)
                        break;
                range->freq[j].i = j + 1;
-               range->freq[j].m = geo->a[i].freq;//FIXME?
+               range->freq[j].m = geo->a[i].freq * 100000;
                range->freq[j].e = 1;
                j++;
        }
@@ -323,7 +325,7 @@
                if (j == IW_MAX_FREQUENCIES)
                        break;
                range->freq[j].i = j + 1;
-               range->freq[j].m = geo->bg[i].freq;//FIXME?
+               range->freq[j].m = geo->bg[i].freq * 100000;
                range->freq[j].e = 1;
                j++;
        }

Reply via email to