Received: by 2002:a25:fc0a:0:0:0:0:0 with SMTP id v10csp20745194ybd; Tue, 7 Jan 2020 00:49:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyHJKqL6kVJxcA4Kr9bBvw79FKLIoaT70KCYU539PnB+gIE6MaYe58g0MuQy5Lz/DtZLSKG X-Received: by 2002:a9d:6f85:: with SMTP id h5mr121202933otq.19.1578386966383; Tue, 07 Jan 2020 00:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578386966; cv=none; d=google.com; s=arc-20160816; b=pg8Z0GEyXEKN2fU6dyF5E+UlXwgS7X7T8tI+BtVoHAF6QE5TCoOyBWwL4Ss+d58YhD bh+w9YEuKCLmSLQIMqajSM/Pi1wJ9axEauaSPjn7P1pmvGVxN1aHpxRsYO0kvCjvbdGf Ab6h85XdC5ps/NYD1SxqLuGTiS5WgbFdLhcNQZgnadnjwZ24lD8vnS36H93TKSXEHj4N PyrqyMiUcf8RV8B3zoO62xdrFVhAQ1+tHsKIwSSuSRXaGGOWhmQIL7UXd8VFc+iF3MmB wc9y1PyDcPXrm/pgLdRugSvSBtPWvZqxFyamSO+a7widV06SX8W2tRjX7t746psMsSeg AffA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=0nMy90MMI8IFoHJxkwiVNrdCsqIp4muNC/hIMMD/v5M=; b=VajnrQLYN9b1IZjXob3gC5dd1Z5uKB0zfN7b74STOLLLRw8fgMDA5PQ5fUsB4lmc+V ao0jcrDYVo4GhodDCicv8YX40Z6s2WVkxuEJHcAaXQEbcexcpd7LnDwd6HecUxwT+nIP jvfP9YcqsQFBOwl4EPM/thoQT1z+ZfPKaJUHDl7GSHrA6RB83C18CdRUw3x9PtOR8cnf jA4Ma44UZIaaZ5A+iwBGYlAoAAgDLj0xn7EwKUAhk3Lfso6pJx1HguSZCb6bp0eHNK5L cGBduOL+gW613FUZhr3NJvNxLeg7pW0FNVMHAakZwXuwKFrEP5zVVo8Ft/ojNTGdlkB4 rrUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si19879487oix.22.2020.01.07.00.49.02; Tue, 07 Jan 2020 00:49:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726485AbgAGIs5 (ORCPT + 99 others); Tue, 7 Jan 2020 03:48:57 -0500 Received: from mga12.intel.com ([192.55.52.136]:10239 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbgAGIs4 (ORCPT ); Tue, 7 Jan 2020 03:48:56 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 00:48:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,405,1571727600"; d="scan'208";a="223113177" Received: from unknown (HELO localhost.localdomain) ([10.223.165.29]) by orsmga003.jf.intel.com with ESMTP; 07 Jan 2020 00:48:54 -0800 From: Ankit Navik To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bleutooth: Add definitions for LE Read Tx Power Date: Tue, 7 Jan 2020 14:18:35 +0530 Message-Id: <1578386915-1524-1-git-send-email-ankit.p.navik@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Add the definitions for LE read transmit power HCI commands to read the minimum and maximum Tx power. Signed-off-by: Ankit Navik --- include/net/bluetooth/hci.h | 7 +++++++ include/net/bluetooth/hci_core.h | 3 +++ net/bluetooth/hci_event.c | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 07b6ece..6e8805f 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -1641,6 +1641,13 @@ struct hci_cp_le_ext_conn_param { __le16 max_ce_len; } __packed; +#define HCI_OP_LE_READ_TX_POWER 0x204b +struct hci_rp_le_read_tx_power { + __u8 status; + __s8 min_tx_power; + __s8 max_tx_power; +} __packed; + #define HCI_OP_LE_READ_NUM_SUPPORTED_ADV_SETS 0x203b struct hci_rp_le_read_num_supported_adv_sets { __u8 status; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index faebe38..88c6e55 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -418,6 +418,9 @@ struct hci_dev { __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; __u8 scan_rsp_data_len; + __s8 min_tx_power; + __s8 max_tx_power; + struct list_head adv_instances; unsigned int adv_instance_cnt; __u8 cur_adv_instance; diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6ddc4a7..fc154cf 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -988,6 +988,20 @@ static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, hdev->adv_tx_power = rp->tx_power; } +static void hci_cc_le_read_tx_power(struct hci_dev *hdev, + struct sk_buff *skb) +{ + struct hci_rp_le_read_tx_power *rp = (void *) skb->data; + + BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); + + if (rp->status) + return; + + hdev->min_tx_power = rp->min_tx_power; + hdev->max_tx_power = rp->max_tx_power; +} + static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_user_confirm_reply *rp = (void *) skb->data; @@ -3414,6 +3428,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, hci_cc_le_read_max_data_len(hdev, skb); break; + case HCI_OP_LE_READ_TX_POWER: + hci_cc_le_read_tx_power(hdev, skb); + break; + case HCI_OP_WRITE_LE_HOST_SUPPORTED: hci_cc_write_le_host_supported(hdev, skb); break; -- 2.7.4