Return-path: Received: from mga09.intel.com ([134.134.136.24]:8761 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757515AbXFTF7x (ORCPT ); Wed, 20 Jun 2007 01:59:53 -0400 Subject: [PATCH]mac80211: add support for iwlist channel (2nd rev) From: Hong Liu To: "John W. Linville" , Michael Wu , Jiri Benc Cc: linux-wireless@vger.kernel.org Content-Type: text/plain Date: Wed, 20 Jun 2007 13:56:57 +0800 Message-Id: <1182319017.19178.34.camel@napa-sdv1.sh.intel.com> Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: Add supported channels info in SIOCGIWRANGE implementation. Signed-off-by: Hong Liu --- net/mac80211/ieee80211_ioctl.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index fcea8b2..3c09a93 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c @@ -1500,6 +1500,9 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, { struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct iw_range *range = (struct iw_range *) extra; + struct ieee80211_hw_mode *mode = NULL; + int c = 0; + data->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -1533,6 +1536,28 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + list_for_each_entry(mode, &local->modes_list, list) { + int j = 0; + + if (!(local->enabled_modes & (1 << mode->mode)) || + (local->hw_modes & local->enabled_modes & + (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B)) + continue; + + while (j < mode->num_channels && c < IW_MAX_FREQUENCIES) { + struct ieee80211_channel *chan = &mode->channels[j]; + + if (chan->flag & IEEE80211_CHAN_W_SCAN) { + range->freq[c].i = chan->chan; + range->freq[c].m = chan->freq * 100000; + range->freq[c].e = 1; + } + ++j; ++c; + } + } + range->num_channels = c; + range->num_frequency = c; + IW_EVENT_CAPA_SET_KERNEL(range->event_capa); IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); -- 1.5.0.5