linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iwl3945: added channel sysfs entry
@ 2008-09-24  5:57 Zhu Yi
  2008-09-24  5:57 ` [PATCH] iwlwifi: don't fail if scan is issued too early Zhu Yi
  2008-09-24  8:44 ` [PATCH] iwl3945: added channel sysfs entry Johannes Berg
  0 siblings, 2 replies; 17+ messages in thread
From: Zhu Yi @ 2008-09-24  5:57 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Abhijeet Kolekar, Zhu Yi

From: Abhijeet Kolekar <abhijeet.kolekar@intel.com>

The patch adds channels sysfs entry for iwl3945. Make it consistent
with iwlagn.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   56 ++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 62b26be..cf41edf 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -7666,8 +7666,60 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
 			     struct device_attribute *attr, char *buf)
 {
-	/* all this shit doesn't belong into sysfs anyway */
-	return 0;
+	struct iwl3945_priv *priv = dev_get_drvdata(d);
+	struct ieee80211_channel *channels = NULL;
+	const struct ieee80211_supported_band *supp_band = NULL;
+	int len = 0, i;
+	int count = 0;
+
+	if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
+		return -EAGAIN;
+
+	supp_band = iwl3945_get_band(priv, IEEE80211_BAND_2GHZ);
+	channels = supp_band->channels;
+	count = supp_band->n_channels;
+
+	len += sprintf(&buf[len],
+			"Displaying %d channels in 2.4GHz band "
+			"(802.11bg):\n", count);
+
+	for (i = 0; i < count; i++)
+		len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
+				ieee80211_frequency_to_channel(
+				channels[i].center_freq),
+				channels[i].max_power,
+				channels[i].flags & IEEE80211_CHAN_RADAR ?
+				" (IEEE 802.11h required)" : "",
+				(!(channels[i].flags & IEEE80211_CHAN_NO_IBSS)
+				|| (channels[i].flags &
+				IEEE80211_CHAN_RADAR)) ? "" :
+				", IBSS",
+				channels[i].flags &
+				IEEE80211_CHAN_PASSIVE_SCAN ?
+				"passive only" : "active/passive");
+
+	supp_band = iwl3945_get_band(priv, IEEE80211_BAND_5GHZ);
+	channels = supp_band->channels;
+	count = supp_band->n_channels;
+
+	len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band "
+			"(802.11a):\n", count);
+
+	for (i = 0; i < count; i++)
+		len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
+				ieee80211_frequency_to_channel(
+				channels[i].center_freq),
+				channels[i].max_power,
+				channels[i].flags & IEEE80211_CHAN_RADAR ?
+				" (IEEE 802.11h required)" : "",
+				((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
+				|| (channels[i].flags &
+				IEEE80211_CHAN_RADAR)) ? "" :
+				", IBSS",
+				channels[i].flags &
+				IEEE80211_CHAN_PASSIVE_SCAN ?
+				"passive only" : "active/passive");
+	return len;
 }
 
 static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
-- 
1.5.3.6


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-09-26  5:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24  5:57 [PATCH] iwl3945: added channel sysfs entry Zhu Yi
2008-09-24  5:57 ` [PATCH] iwlwifi: don't fail if scan is issued too early Zhu Yi
2008-09-24  8:44 ` [PATCH] iwl3945: added channel sysfs entry Johannes Berg
2008-09-24 10:52   ` Dan Williams
2008-09-25  7:34   ` Zhu Yi
2008-09-25  9:23     ` Johannes Berg
2008-09-25 11:04       ` Tomas Winkler
2008-09-25 11:21         ` Johannes Berg
2008-09-25 11:50           ` Tomas Winkler
2008-09-26  3:54       ` Zhu Yi
2008-09-26  4:13         ` Luis R. Rodriguez
2008-09-26  5:13           ` Zhu Yi
2008-09-26  5:16             ` Zhu Yi
2008-09-26  5:28           ` Zhu Yi
2008-09-26  5:39             ` Luis R. Rodriguez
2008-09-26  5:40               ` Luis R. Rodriguez
2008-09-26  5:44               ` Zhu Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).