]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add radar detect widths to phy info
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Fri, 8 Feb 2013 17:16:21 +0000 (18:16 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 18 Feb 2013 22:24:19 +0000 (23:24 +0100)
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
info.c
interface.c
iw.h

diff --git a/info.c b/info.c
index 08dbfc081521ed1cf92234b962d1423a906e04d2..14db37ff916f8655bf99b77f90470e66b83a8cff 100644 (file)
--- a/info.c
+++ b/info.c
@@ -245,6 +245,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                                [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 },
                                [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG },
                                [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 },
+                               [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 },
                        };
                        struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
                        static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
@@ -296,11 +297,30 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                        }
                        printf(",\n\t\t   ");
 
-                       printf("total <= %d, #channels <= %d%s\n",
+                       printf("total <= %d, #channels <= %d%s",
                                nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]),
                                nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]),
                                tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ?
                                        ", STA/AP BI must match" : "");
+                       if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) {
+                               unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]);
+
+                               if (widths) {
+                                       int width;
+                                       bool first = true;
+
+                                       printf(", radar detect widths: {");
+                                       for (width = 0; width < 32; width++)
+                                               if (widths & (1 << width)) {
+                                                       printf("%s %s",
+                                                              first ? "":",",
+                                                              channel_width_name(width));
+                                                       first = false;
+                                               }
+                                       printf(" }\n");
+                               }
+                       }
+                       printf("\n");
 broken_combination:
                        ;
                }
index 26e72dce3bb536e1d2b776cc5f0bd6e6cf81b232..b52c8ddfdc8aa20f45fc93f117fccbc9f51ea8ee 100644 (file)
@@ -262,7 +262,7 @@ static char *channel_type_name(enum nl80211_channel_type channel_type)
        }
 }
 
-static char *channel_width_name(enum nl80211_chan_width width)
+char *channel_width_name(enum nl80211_chan_width width)
 {
        switch (width) {
        case NL80211_CHAN_WIDTH_20_NOHT:
diff --git a/iw.h b/iw.h
index 3e83bd2c65fc2c347b757589dcfd8e606a6ec2fc..d56e358a256366641a7580c424deff6ac62176bf 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -145,6 +145,7 @@ void print_ampdu_spacing(__u8 spacing);
 void print_ht_capability(__u16 cap);
 void print_vht_info(__u32 capa, const __u8 *mcs);
 
+char *channel_width_name(enum nl80211_chan_width width);
 const char *iftype_name(enum nl80211_iftype iftype);
 const char *command_name(enum nl80211_commands cmd);
 int ieee80211_channel_to_frequency(int chan);