2007-04-21 04:26:18

by Larry Finger

[permalink] [raw]
Subject: [PATCH V2] ieee80211: Output frequency rather than channel in scan results

In ieee80211, the output of scan results lists channels rather than
frequencies; however, NetworkManager needs frequency. This patch
adds the frequency to the output.

Signed-off-by: Larry Finger <[email protected]>
---

Index: wireless-2.6/net/ieee80211/ieee80211_wx.c
===================================================================
--- wireless-2.6.orig/net/ieee80211/ieee80211_wx.c
+++ wireless-2.6/net/ieee80211/ieee80211_wx.c
@@ -89,15 +89,22 @@ static char *ieee80211_translate_scan(st
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
}

- /* Add frequency/channel */
+ /* Add channel and frequency */
iwe.cmd = SIOCGIWFREQ;
-/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode);
- iwe.u.freq.e = 3; */
iwe.u.freq.m = network->channel;
iwe.u.freq.e = 0;
iwe.u.freq.i = 0;
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);

+ if (network->channel < 15)
+ iwe.u.freq.m = 2407 + 5 * network->channel;
+ else
+ iwe.u.freq.m = 5000 + 5 * network->channel;
+ if (network->channel == 14)
+ iwe.u.freq.m = 2484; /* special case for Japan */
+ iwe.u.freq.e = 6;
+ start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
+
/* Add encryption capability */
iwe.cmd = SIOCGIWENCODE;
if (network->capability & WLAN_CAPABILITY_PRIVACY)


2007-04-21 13:42:56

by Joerg Mayer

[permalink] [raw]
Subject: Re: [PATCH V2] ieee80211: Output frequency rather than channel in scan results

On Fri, Apr 20, 2007 at 11:25:40PM -0500, Larry Finger wrote:
> + if (network->channel < 15)
> + iwe.u.freq.m = 2407 + 5 * network->channel;
> + else
> + iwe.u.freq.m = 5000 + 5 * network->channel;
> + if (network->channel == 14)
> + iwe.u.freq.m = 2484; /* special case for Japan */

As you are taking japanese channels into account: How about handling the
>= 4.9 GHz case for Japan as well?
See 802.11j-2004.pdf 17.3.8.3.2, 17.3.8.3.3 and table J.3 for details.

ciao
Joerg
--
Joerg Mayer <[email protected]>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.

2007-04-21 20:16:50

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH V2] ieee80211: Output frequency rather than channel in scan results

Johannes Berg wrote:
> On Sat, 2007-04-21 at 15:42 +0200, Joerg Mayer wrote:
>> On Fri, Apr 20, 2007 at 11:25:40PM -0500, Larry Finger wrote:
>>> + if (network->channel < 15)
>>> + iwe.u.freq.m = 2407 + 5 * network->channel;
>>> + else
>>> + iwe.u.freq.m = 5000 + 5 * network->channel;
>>> + if (network->channel == 14)
>>> + iwe.u.freq.m = 2484; /* special case for Japan */
>> As you are taking japanese channels into account: How about handling the
>> >= 4.9 GHz case for Japan as well?
>> See 802.11j-2004.pdf 17.3.8.3.2, 17.3.8.3.3 and table J.3 for details.
>
> How about just adding some sort of table in other common code and using
> that. Then you can submit a patch for that table :P

I did a variation of your suggestion by adding the ieee80211_channel_to_freq routine that ieee80211
was lacking. This way if anyone adds the 4.9 GHz channels in Japan to the ieee80211_geo struct, my
routine will be just fine.

Larry

2007-04-21 13:51:23

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH V2] ieee80211: Output frequency rather than channel in scan results

On Sat, 2007-04-21 at 15:42 +0200, Joerg Mayer wrote:
> On Fri, Apr 20, 2007 at 11:25:40PM -0500, Larry Finger wrote:
> > + if (network->channel < 15)
> > + iwe.u.freq.m = 2407 + 5 * network->channel;
> > + else
> > + iwe.u.freq.m = 5000 + 5 * network->channel;
> > + if (network->channel == 14)
> > + iwe.u.freq.m = 2484; /* special case for Japan */
>
> As you are taking japanese channels into account: How about handling the
> >= 4.9 GHz case for Japan as well?
> See 802.11j-2004.pdf 17.3.8.3.2, 17.3.8.3.3 and table J.3 for details.

How about just adding some sort of table in other common code and using
that. Then you can submit a patch for that table :P

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part