diff options
author | Zhu Yi <yi.zhu@intel.com> | 2007-02-14 03:04:24 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:00:54 -0400 |
commit | 375dd24428cfe900f4ed95d301fe604f8e0d459b (patch) | |
tree | cd2e17d66154e308199ae9f78a082426edb4fc55 | |
parent | b9099ff63c75216d6ca10bce5a1abcd9293c27e6 (diff) |
[PATCH] ipw2200: add channels sysfs entry
Add 'channels' sysfs entry for ipw2200. The entry exports channels
information for the user space.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 4839a45098cb..2069908a3066 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1847,6 +1847,52 @@ static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, | |||
1847 | static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, | 1847 | static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, |
1848 | show_net_stats, store_net_stats); | 1848 | show_net_stats, store_net_stats); |
1849 | 1849 | ||
1850 | static ssize_t show_channels(struct device *d, | ||
1851 | struct device_attribute *attr, | ||
1852 | char *buf) | ||
1853 | { | ||
1854 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1855 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
1856 | int len = 0, i; | ||
1857 | |||
1858 | len = sprintf(&buf[len], | ||
1859 | "Displaying %d channels in 2.4Ghz band " | ||
1860 | "(802.11bg):\n", geo->bg_channels); | ||
1861 | |||
1862 | for (i = 0; i < geo->bg_channels; i++) { | ||
1863 | len += sprintf(&buf[len], "%d: BSS%s%s, %s, Band %s.\n", | ||
1864 | geo->bg[i].channel, | ||
1865 | geo->bg[i].flags & IEEE80211_CH_RADAR_DETECT ? | ||
1866 | " (radar spectrum)" : "", | ||
1867 | ((geo->bg[i].flags & IEEE80211_CH_NO_IBSS) || | ||
1868 | (geo->bg[i].flags & IEEE80211_CH_RADAR_DETECT)) | ||
1869 | ? "" : ", IBSS", | ||
1870 | geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY ? | ||
1871 | "passive only" : "active/passive", | ||
1872 | geo->bg[i].flags & IEEE80211_CH_B_ONLY ? | ||
1873 | "B" : "B/G"); | ||
1874 | } | ||
1875 | |||
1876 | len += sprintf(&buf[len], | ||
1877 | "Displaying %d channels in 5.2Ghz band " | ||
1878 | "(802.11a):\n", geo->a_channels); | ||
1879 | for (i = 0; i < geo->a_channels; i++) { | ||
1880 | len += sprintf(&buf[len], "%d: BSS%s%s, %s.\n", | ||
1881 | geo->a[i].channel, | ||
1882 | geo->a[i].flags & IEEE80211_CH_RADAR_DETECT ? | ||
1883 | " (radar spectrum)" : "", | ||
1884 | ((geo->a[i].flags & IEEE80211_CH_NO_IBSS) || | ||
1885 | (geo->a[i].flags & IEEE80211_CH_RADAR_DETECT)) | ||
1886 | ? "" : ", IBSS", | ||
1887 | geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY ? | ||
1888 | "passive only" : "active/passive"); | ||
1889 | } | ||
1890 | |||
1891 | return len; | ||
1892 | } | ||
1893 | |||
1894 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | ||
1895 | |||
1850 | static void notify_wx_assoc_event(struct ipw_priv *priv) | 1896 | static void notify_wx_assoc_event(struct ipw_priv *priv) |
1851 | { | 1897 | { |
1852 | union iwreq_data wrqu; | 1898 | union iwreq_data wrqu; |
@@ -11383,6 +11429,7 @@ static struct attribute *ipw_sysfs_entries[] = { | |||
11383 | &dev_attr_led.attr, | 11429 | &dev_attr_led.attr, |
11384 | &dev_attr_speed_scan.attr, | 11430 | &dev_attr_speed_scan.attr, |
11385 | &dev_attr_net_stats.attr, | 11431 | &dev_attr_net_stats.attr, |
11432 | &dev_attr_channels.attr, | ||
11386 | #ifdef CONFIG_IPW2200_PROMISCUOUS | 11433 | #ifdef CONFIG_IPW2200_PROMISCUOUS |
11387 | &dev_attr_rtap_iface.attr, | 11434 | &dev_attr_rtap_iface.attr, |
11388 | &dev_attr_rtap_filter.attr, | 11435 | &dev_attr_rtap_filter.attr, |