From patchwork Fri Feb 7 15:54:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11370717 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A392292A for ; Fri, 7 Feb 2020 15:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 827AA214AF for ; Fri, 7 Feb 2020 15:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbgBGPyQ (ORCPT ); Fri, 7 Feb 2020 10:54:16 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:41611 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbgBGPyP (ORCPT ); Fri, 7 Feb 2020 10:54:15 -0500 Received: from localhost.localdomain (unknown [109.41.128.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 575A4580078; Fri, 7 Feb 2020 16:54:13 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH 3/3] iw: scan: parse tx power envelope Date: Fri, 7 Feb 2020 16:54:06 +0100 Message-Id: <20200207155406.8985-3-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200207155406.8985-1-markus.theil@tu-ilmenau.de> References: <20200207155406.8985-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Markus Theil --- 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,