commit dbd66bd49745fefd15ce16052d7f6661ac690953
parent 709b77794b6e5f71f664f1431e251e436e506023
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 28 May 2021 22:14:01 -0500
wiphy: Print more basic wiphy info
Diffstat:
| M | src/wiphy.c | | | 77 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- |
1 file changed, 63 insertions(+), 14 deletions(-)
diff --git a/src/wiphy.c b/src/wiphy.c
@@ -749,29 +749,78 @@ bool wiphy_state_watch_remove(struct wiphy *wiphy, uint32_t id)
return watchlist_remove(&wiphy->state_watches, id);
}
-static void wiphy_print_basic_info(struct wiphy *wiphy)
+static void wiphy_print_mcs_indexes(const uint8_t *mcs)
{
- uint32_t bands;
- char buf[1024];
+ int i;
- l_info("Wiphy: %d, Name: %s", wiphy->id, wiphy->name);
- l_info("\tPermanent Address: "MAC, MAC_STR(wiphy->permanent_addr));
+ for (i = 0; i < 77; i++) {
+ int start;
- bands = scan_freq_set_get_bands(wiphy->supported_freqs);
+ if (!test_bit(mcs, i))
+ continue;
- if (bands) {
- int len = 0;
+ start = i;
+
+ while (i < 76 && test_bit(mcs, i + 1))
+ i += 1;
+
+ if (start != i)
+ l_info("\t\t\t%d-%d", start, i);
+ else
+ l_info("\t\t\t%d", start);
+ }
+}
+
+static void wiphy_print_band_info(struct band *band, const char *name)
+{
+ int i;
- len += sprintf(buf + len, "\tBands:");
+ l_info("\t%s:", name);
+ l_info("\t\tBitrates (non-HT):");
- if (bands & SCAN_BAND_2_4_GHZ)
- len += sprintf(buf + len, " 2.4 GHz");
+ for (i = 0; i < band->supported_rates_len; i++)
+ l_info("\t\t\t%2d.%d Mbps", band->supported_rates[i] / 2,
+ band->supported_rates[i] % 2 * 5);
- if (bands & SCAN_BAND_5_GHZ)
- len += sprintf(buf + len, " 5 GHz");
+ if (band->ht_supported) {
+ uint8_t max_nss = bit_field(band->ht_mcs_set[12], 2, 2) + 1;
+ l_info("\t\tHT Capabilities:");
- l_info("%s", buf);
+ if (test_bit(band->ht_capabilities, 1))
+ l_info("\t\t\tHT40");
+ else
+ l_info("\t\t\tHT20");
+
+ if (test_bit(band->ht_capabilities, 5))
+ l_info("\t\t\tShort GI for 20Mhz");
+
+ if (test_bit(band->ht_capabilities, 6))
+ l_info("\t\t\tShort GI for 40Mhz");
+
+ l_info("\t\tHT RX MCS indexes:");
+ wiphy_print_mcs_indexes(band->ht_mcs_set);
+
+ if (test_bit(band->ht_mcs_set, 96)) {
+ if (test_bit(band->ht_mcs_set, 97))
+ l_info("\t\tHT TX MCS differ, max NSS: %d",
+ max_nss);
+ } else
+ l_info("\t\tHT TX MCS set undefined");
}
+}
+
+static void wiphy_print_basic_info(struct wiphy *wiphy)
+{
+ char buf[1024];
+
+ l_info("Wiphy: %d, Name: %s", wiphy->id, wiphy->name);
+ l_info("\tPermanent Address: "MAC, MAC_STR(wiphy->permanent_addr));
+
+ if (wiphy->band_2g)
+ wiphy_print_band_info(wiphy->band_2g, "2.4Ghz Band");
+
+ if (wiphy->band_5g)
+ wiphy_print_band_info(wiphy->band_5g, "5Ghz Band");
if (wiphy->supported_ciphers) {
int len = 0;