aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iwinfo/src
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-06-02 13:10:49 +0000
committerJohn Crispin <john@openwrt.org>2014-06-02 13:10:49 +0000
commitf3aa8a8cf41ac4df18a2409f6595a3ddc866de7b (patch)
tree3677600e12eb4f293d5f1c6ecf0ff37d4b87080b /package/network/utils/iwinfo/src
parent8139ba35af4fb68bb2f841e310bd97e74b363c45 (diff)
downloadupstream-f3aa8a8cf41ac4df18a2409f6595a3ddc866de7b.tar.gz
upstream-f3aa8a8cf41ac4df18a2409f6595a3ddc866de7b.tar.bz2
upstream-f3aa8a8cf41ac4df18a2409f6595a3ddc866de7b.zip
iwinfo: add 802.11ac hwmode support
In case of .11ac device the hwmode was not properly displayed. This patch fixes it. Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com> Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> SVN-Revision: 40953
Diffstat (limited to 'package/network/utils/iwinfo/src')
-rw-r--r--package/network/utils/iwinfo/src/include/iwinfo.h1
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_cli.c5
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_nl80211.c10
3 files changed, 13 insertions, 3 deletions
diff --git a/package/network/utils/iwinfo/src/include/iwinfo.h b/package/network/utils/iwinfo/src/include/iwinfo.h
index d11f128eb0..68d459b8d3 100644
--- a/package/network/utils/iwinfo/src/include/iwinfo.h
+++ b/package/network/utils/iwinfo/src/include/iwinfo.h
@@ -27,6 +27,7 @@
#define IWINFO_80211_B (1 << 1)
#define IWINFO_80211_G (1 << 2)
#define IWINFO_80211_N (1 << 3)
+#define IWINFO_80211_AC (1 << 4)
#define IWINFO_CIPHER_NONE (1 << 0)
#define IWINFO_CIPHER_WEP40 (1 << 1)
diff --git a/package/network/utils/iwinfo/src/iwinfo_cli.c b/package/network/utils/iwinfo/src/iwinfo_cli.c
index 87cc10fb73..891f77e4f0 100644
--- a/package/network/utils/iwinfo/src/iwinfo_cli.c
+++ b/package/network/utils/iwinfo/src/iwinfo_cli.c
@@ -268,11 +268,12 @@ static char * format_hwmodes(int modes)
if (modes <= 0)
snprintf(buf, sizeof(buf), "unknown");
else
- snprintf(buf, sizeof(buf), "802.11%s%s%s%s",
+ snprintf(buf, sizeof(buf), "802.11%s%s%s%s%s",
(modes & IWINFO_80211_A) ? "a" : "",
(modes & IWINFO_80211_B) ? "b" : "",
(modes & IWINFO_80211_G) ? "g" : "",
- (modes & IWINFO_80211_N) ? "n" : "");
+ (modes & IWINFO_80211_N) ? "n" : "",
+ (modes & IWINFO_80211_AC) ? "ac" : "");
return buf;
}
diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
index 8e585892d7..4a52d5ca8d 100644
--- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c
+++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
@@ -2159,6 +2159,7 @@ static int nl80211_get_hwmodelist_cb(struct nl_msg *msg, void *arg)
int *modes = arg;
int bands_remain, freqs_remain;
uint16_t caps = 0;
+ uint32_t vht_caps = 0;
struct nlattr **attr = nl80211_parse(msg);
struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1];
struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1];
@@ -2180,6 +2181,13 @@ static int nl80211_get_hwmodelist_cb(struct nl_msg *msg, void *arg)
if (caps > 0)
*modes |= IWINFO_80211_N;
+ if (bands[NL80211_BAND_ATTR_VHT_CAPA])
+ vht_caps = nla_get_u32(bands[NL80211_BAND_ATTR_VHT_CAPA]);
+
+ /* Treat any nonzero capability as 11ac */
+ if (vht_caps > 0)
+ *modes |= IWINFO_80211_AC;
+
nla_for_each_nested(freq, bands[NL80211_BAND_ATTR_FREQS],
freqs_remain)
{
@@ -2194,7 +2202,7 @@ static int nl80211_get_hwmodelist_cb(struct nl_msg *msg, void *arg)
*modes |= IWINFO_80211_B;
*modes |= IWINFO_80211_G;
}
- else
+ else if (!(*modes & IWINFO_80211_AC))
{
*modes |= IWINFO_80211_A;
}