Jörg Sommer wrote:
> Hi,
> 
> the code in bcm43xx_wc.c:bcm43xx_wx_set_channelfreq() passes the value
> unchanged to bcm43xx_freq_to_channel() which leads to mistakes, because
> bcm43xx_freq_to_channel() expects the frequency in MHz, but the value
> given to bcm43xx_wx_set_channelfreq() might be scaled somehow different.
> 
> Also passing the internal frequency value in bcm43xx_wx_get_rangeparams()
> to userland is not correct. The frequency is in MHz, but the factor
> passed to userland is freq*10^1.
> 
> #v+
> --- /home/joerg/bcm43xx_wx.c  2007-02-07 11:25:19.000000000 +0100
> +++ bcm43xx_wx.c      2007-02-07 11:09:46.000000000 +0100
> @@ -108,16 +108,21 @@
>       u8 channel;
>       int freq;
>       int err = -EINVAL;
> +     s16 ex;
>  
>       mutex_lock(&bcm->mutex);
>       spin_lock_irqsave(&bcm->irq_lock, flags);
>  
> -     if ((data->freq.m >= 0) && (data->freq.m <= 1000)) {
> +     if ((data->freq.e == 0) &&
> +            (data->freq.m >= 0) && (data->freq.m <= 1000)) {
>               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;
> +             ex = 6 - data->freq.e;
> +             while (--ex >= 0)    /* scale down the frequency to MHz */
> +                     freq /= 10;
> +             channel = bcm43xx_freq_to_channel(bcm, freq);
>       }
>       if (!ieee80211_is_valid_channel(bcm->ieee, channel))
>               goto out_unlock;

I'm testing this hunk now.

> @@ -295,7 +300,7 @@
>                       break;
>               range->freq[j].i = j + 1;
>               range->freq[j].m = geo->bg[i].freq;//FIXME?
> -             range->freq[j].e = 1;
> +             range->freq[j].e = 6;
>               j++;
>       }
>       range->num_frequency = j;

This one has already been fixed by multiplying geo->bg[i].freq by 100,000. Same 
result. There was a
similar error for 802.11a frequencies as well.

> @@ -439,7 +444,7 @@
>       u16 maxpower;
>  
>       if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) {
> -             printk(PFX KERN_ERR "TX power not in dBm.\n");
> +             printk(KERN_ERR PFX "TX power not in dBm.\n");
>               return -EOPNOTSUPP;
>       }

Good catch. Thanks for your contribution.

Larry

_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to