Skip to content

Commit 375dd24

Browse files
Zhu YiJeff Garzik
authored andcommitted
[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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent b9099ff commit 375dd24

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

drivers/net/wireless/ipw2200.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,52 @@ static ssize_t store_net_stats(struct device *d, struct device_attribute *attr,
18471847
static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
18481848
show_net_stats, store_net_stats);
18491849

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+
18501896
static void notify_wx_assoc_event(struct ipw_priv *priv)
18511897
{
18521898
union iwreq_data wrqu;
@@ -11383,6 +11429,7 @@ static struct attribute *ipw_sysfs_entries[] = {
1138311429
&dev_attr_led.attr,
1138411430
&dev_attr_speed_scan.attr,
1138511431
&dev_attr_net_stats.attr,
11432+
&dev_attr_channels.attr,
1138611433
#ifdef CONFIG_IPW2200_PROMISCUOUS
1138711434
&dev_attr_rtap_iface.attr,
1138811435
&dev_attr_rtap_filter.attr,

0 commit comments

Comments
 (0)