2020-02-07 15:54:36

by Markus Theil

[permalink] [raw]
Subject: [PATCH 1/3] iw: scan: add missing word for rm capabilities

Signed-off-by: Markus Theil <[email protected]>
---
scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scan.c b/scan.c
index fd522d4..a07636a 100644
--- a/scan.c
+++ b/scan.c
@@ -609,7 +609,7 @@ static void print_rm_enabled_capabilities(const uint8_t type, uint8_t len,
PRINT_RM_CAPA(2, "Parallel Measurements");
PRINT_RM_CAPA(3, "Repeated Measurements");
PRINT_RM_CAPA(4, "Beacon Passive Measurement");
- PRINT_RM_CAPA(5, "Beacon Active");
+ PRINT_RM_CAPA(5, "Beacon Active Measurement");
PRINT_RM_CAPA(6, "Beacon Table Measurement");
PRINT_RM_CAPA(7, "Beacon Measurement Reporting Conditions");
PRINT_RM_CAPA(8, "Frame Measurement");
--
2.25.0


2020-02-07 15:54:36

by Markus Theil

[permalink] [raw]
Subject: [PATCH 2/3] iw: scan: parse 'supported Operating Classes element'

Signed-off-by: Markus Theil <[email protected]>
---
scan.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/scan.c b/scan.c
index a07636a..57bb463 100644
--- a/scan.c
+++ b/scan.c
@@ -1467,6 +1467,40 @@ static void print_vht_oper(const uint8_t type, uint8_t len, const uint8_t *data,
printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]);
}

+static void print_supp_op_classes(const uint8_t type, uint8_t len,
+ const uint8_t *data,
+ const struct print_ies_data *ie_buffer)
+{
+ uint8_t *p = (uint8_t*) data;
+ const uint8_t *next_data = p + len;
+ int zero_delimiter = 0;
+ int one_hundred_thirty_delimiter = 0;
+
+ printf("\n");
+ printf("\t\t * current operating class: %d\n", *p);
+ while (p++ < next_data) {
+ if (*p == 130) {
+ one_hundred_thirty_delimiter = 1;
+ break;
+ }
+ if (*p == 0) {
+ zero_delimiter = 0;
+ break;
+ }
+ printf("\t\t * operating class: %d\n", *p);
+ }
+ if (one_hundred_thirty_delimiter)
+ while (p++ < next_data) {
+ printf("\t\t * current operating class extension: %d\n", *p);
+ }
+ if (zero_delimiter)
+ while (p++ < next_data - 1) {
+ printf("\t\t * operating class duple: %d %d\n", p[0], p[1]);
+ if (*p == 0)
+ break;
+ }
+}
+
static void print_obss_scan_params(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1588,6 +1622,7 @@ static const struct ie_print ieprinters[] = {
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
[45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
[47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
+ [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
[61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
[62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
--
2.25.0

2020-02-07 15:54:46

by Markus Theil

[permalink] [raw]
Subject: [PATCH 3/3] iw: scan: parse tx power envelope

Signed-off-by: Markus Theil <[email protected]>
---
scan.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/scan.c b/scan.c
index 57bb463..50a4147 100644
--- a/scan.c
+++ b/scan.c
@@ -1224,6 +1224,35 @@ static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data,
}
}

+static void print_tx_power_envelope(const uint8_t type, uint8_t len,
+ const uint8_t *data,
+ const struct print_ies_data *ie_buffer)
+{
+ const uint8_t local_max_tx_power_count = data[0] & 7;
+ const uint8_t local_max_tx_power_unit_interp = (data[0] >> 3) & 7;
+ int i;
+
+ printf("\n");
+ const char *power_names[] = {
+ "Local Maximum Transmit Power For 20 MHz",
+ "Local Maximum Transmit Power For 40 MHz",
+ "Local Maximum Transmit Power For 80 MHz",
+ "Local Maximum Transmit Power For 160/80+80 MHz",
+ };
+ if (local_max_tx_power_count + 2 != len)
+ return;
+ if (local_max_tx_power_unit_interp != 0)
+ return;
+ for (i = 0; i < local_max_tx_power_count + 1; ++i) {
+ int8_t power_val = ((int8_t)data[1 + i]) >> 1;
+ int8_t point5 = data[1 + i] & 1;
+ if (point5)
+ printf("\t\t * %s: %i.5 dBm\n", power_names[i], power_val);
+ else
+ printf("\t\t * %s: %i dBm\n", power_names[i], power_val);
+ }
+}
+
static const char *ht_secondary_offset[4] = {
"no secondary",
"above",
@@ -1637,6 +1666,7 @@ static const struct ie_print ieprinters[] = {
[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
[111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
+ [195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), },
};

static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
--
2.25.0