]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: fix 'iw list' MCS set print
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 8 Dec 2009 02:13:56 +0000 (21:13 -0500)
committerJohannes Berg <johannes@sipsolutions.net>
Tue, 8 Dec 2009 08:31:02 +0000 (09:31 +0100)
The MCS set was being printed backward, fix this and while at it
add a helper to share with scanning.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
info.c
iw.h
scan.c
util.c

diff --git a/info.c b/info.c
index ddff78b7c4683e666b035c0f4e7f26c20a92369f..c80a11f83c8b9e3863aed6c13c97392c554e549c 100644 (file)
--- a/info.c
+++ b/info.c
@@ -153,9 +153,9 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                        unsigned char *mcs = nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]);
                        bool tx_mcs_set_defined, tx_mcs_set_equal, tx_unequal_modulation;
 
-                       printf("\t\tHT MCS set: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n",
-                               mcs[0], mcs[1], mcs[2], mcs[3], mcs[4], mcs[5], mcs[6], mcs[7],
-                               mcs[8], mcs[9], mcs[10], mcs[11], mcs[12], mcs[13], mcs[14], mcs[15]);
+                       printf("\t\tHT MCS set:");
+                       print_mcs_set(mcs);
+                       printf("\n");
 
                        max_rx_supp_data_rate = ((mcs[10] >> 8) & ((mcs[11] & 0x3) << 8));
                        tx_mcs_set_defined = !!(mcs[12] & (1 << 0));
diff --git a/iw.h b/iw.h
index e22a2819708fcf38acba4d308b4d7e6704518b66..ef22737a48111c56189e99e0c0bc08de2e4347ab 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -120,6 +120,8 @@ void mac_addr_n2a(char *mac_addr, unsigned char *arg);
 
 int parse_keys(struct nl_msg *msg, char **argv, int argc);
 
+void print_mcs_set(const uint8_t *data);
+
 const char *iftype_name(enum nl80211_iftype iftype);
 const char *command_name(enum nl80211_commands cmd);
 int ieee80211_channel_to_frequency(int chan);
diff --git a/scan.c b/scan.c
index 1889bd0bd05c02bbe536f016aa90e271d01a1b30..973d6906378a8936dfb27a47ab86169f71f61989 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -547,11 +547,9 @@ static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
               print_ampdu_space(ampdu_spacing), ampdu_spacing);
 
        /* This is the whole MCS set, which is 16 bytes */
-       printf("\t\tMCS set: ");
+       printf("\t\tMCS set:");
        data+=2;
-       for (i = 15; i != 0; i--) {
-               printf(" %.2x", data[i]);
-       }
+       print_mcs_set(data);
        printf("\n");
 
        if (htc->mcs_set.tx_rx_mcs_defined && htc->mcs_set.tx_rx_mcs_not_equal)
diff --git a/util.c b/util.c
index 6a3fcc0043efdbaa32575b92572565d150446497..3b6fa4786104b66f73c03f89c736a577c3a075ec 100644 (file)
--- a/util.c
+++ b/util.c
@@ -292,3 +292,12 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc)
                        "for example: d:2:6162636465 is the same as d:2:abcde\n");
        return 2;
 }
+
+void print_mcs_set(const uint8_t *data)
+{
+       unsigned int i;
+
+        for (i = 15; i != 0; i--) {
+                printf(" %.2x", data[i]);
+        }
+}