iw: print the current operating frequency in the phy info
[openwrt-10.03/.git] / package / iw / patches / 110-freq.patch
1 --- a/info.c
2 +++ b/info.c
3 @@ -62,6 +62,27 @@ static int print_phy_handler(struct nl_m
4         if (tb_msg[NL80211_ATTR_WIPHY_NAME])
5                 printf("Wiphy %s\n", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME]));
6  
7 +       if (tb_msg[NL80211_ATTR_WIPHY_FREQ]) {
8 +               const char *mode;
9 +
10 +               if (tb_msg[NL80211_ATTR_WIPHY_CHANNEL_TYPE])
11 +                       switch(nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_CHANNEL_TYPE])) {
12 +                       case NL80211_CHAN_HT20:
13 +                               mode = "HT20";
14 +                               break;
15 +                       case NL80211_CHAN_HT40PLUS:
16 +                               mode = "HT40+";
17 +                               break;
18 +                       case NL80211_CHAN_HT40MINUS:
19 +                               mode = "HT40-";
20 +                               break;
21 +                       default:
22 +                               mode = "";
23 +                       }
24 +
25 +               printf("\tCurrent frequency: %d MHz %s\n", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_FREQ]), mode);
26 +       }
27 +
28         nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) {
29                 printf("\tBand %d:\n", bandidx);
30                 bandidx++;