aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorEster Kummer <ester.kummer@intel.com>2008-06-13 03:44:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:11 -0400
commit5d72a1f5b6da334f8722255c766fdbcd4c1b4c51 (patch)
tree374ca22bc2c7ba3e728e7daf4b00a416f03eb7e1 /drivers/net/wireless/iwlwifi/iwl4965-base.c
parentdc0ae30c31ee6ef83992bb692f37dfbba08a2ef6 (diff)
iwlwifi: adding channels to sysfs
This patch returns channel list to sysfs. Signed-off-by: Ester Kummer <ester.kummer@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 81a1c22874a1..c179b21bd0d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
4122static ssize_t show_channels(struct device *d, 4122static ssize_t show_channels(struct device *d,
4123 struct device_attribute *attr, char *buf) 4123 struct device_attribute *attr, char *buf)
4124{ 4124{
4125 /* all this shit doesn't belong into sysfs anyway */ 4125
4126 return 0; 4126 struct iwl_priv *priv = dev_get_drvdata(d);
4127 struct ieee80211_channel *channels = NULL;
4128 const struct ieee80211_supported_band *supp_band = NULL;
4129 int len = 0, i;
4130 int count = 0;
4131
4132 if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
4133 return -EAGAIN;
4134
4135 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
4136 channels = supp_band->channels;
4137 count = supp_band->n_channels;
4138
4139 len += sprintf(&buf[len],
4140 "Displaying %d channels in 2.4GHz band "
4141 "(802.11bg):\n", count);
4142
4143 for (i = 0; i < count; i++)
4144 len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
4145 ieee80211_frequency_to_channel(
4146 channels[i].center_freq),
4147 channels[i].max_power,
4148 channels[i].flags & IEEE80211_CHAN_RADAR ?
4149 " (IEEE 802.11h required)" : "",
4150 (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS)
4151 || (channels[i].flags &
4152 IEEE80211_CHAN_RADAR)) ? "" :
4153 ", IBSS",
4154 channels[i].flags &
4155 IEEE80211_CHAN_PASSIVE_SCAN ?
4156 "passive only" : "active/passive");
4157
4158 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
4159 channels = supp_band->channels;
4160 count = supp_band->n_channels;
4161
4162 len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band "
4163 "(802.11a):\n", count);
4164
4165 for (i = 0; i < count; i++)
4166 len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
4167 ieee80211_frequency_to_channel(
4168 channels[i].center_freq),
4169 channels[i].max_power,
4170 channels[i].flags & IEEE80211_CHAN_RADAR ?
4171 " (IEEE 802.11h required)" : "",
4172 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
4173 || (channels[i].flags &
4174 IEEE80211_CHAN_RADAR)) ? "" :
4175 ", IBSS",
4176 channels[i].flags &
4177 IEEE80211_CHAN_PASSIVE_SCAN ?
4178 "passive only" : "active/passive");
4179
4180 return len;
4127} 4181}
4128 4182
4129static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); 4183static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);