Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1207149ybl; Wed, 8 Jan 2020 12:58:48 -0800 (PST) X-Google-Smtp-Source: APXvYqywrFa9rG+lE7PHNC4kUZ5f2ivteX6CqucGZqV/p3rSWEDdGzrvGv5BpH6d0DHA/O24Jltw X-Received: by 2002:a9d:7ada:: with SMTP id m26mr5803828otn.111.1578517128795; Wed, 08 Jan 2020 12:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578517128; cv=none; d=google.com; s=arc-20160816; b=VRZFECm9XCIe94CItjYNKf8SuEJUG69fLipUNrvKMukjKRU5Ec3iPEHpMGkhX0KqH+ 4jVh/+jg/U0ZMMEga51iZEuJB7jPxgngjzPiqwRzgHKmOd9S4AhiH2sdDRN+uz6ySymX oCvGfnOAI0Kp1cbb7tg0SO2SQEMXOPnFOpTR3kuna4VJ8tTQEo5RMsQWEr7mclVebkD0 IktuLSNnkSwZX6+f/n12OZS+/SzhHKNUHNiWvpieuNE+PUEvha4c0iYB8uEwWPNAA/1a CyWfHJ2drUkPC4Bb0wQwDqIvT4nsPiXQZ72/zWoqqxwLcu0phQNgY11GwUNIfmICfoKr di3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=dmcf+XReNhcPUfQu9jl8mfQ9wdGMKWvJ07H0+n/URA4=; b=Z3C3NPBV9Tx3GUwGD7gd1xBFS48oFlMqCOo9yuFBDRIRHYl5dZEenfUFx8lR1ykCw+ dU0806FsWZ7oF+lD/2F4cezfO5sH49Pu1UU05IomO4/6Bdp5KLJpPiLvR0TjGQ2/jzqW jNDIvOHOk166OfVjgCGmSFIX6NWyqPdhDjA1WkA98Ty4rcTneWooCZ9OGIDJ1pzKmHfu 7/vrRv6vvWhMTTQpLiQ2o07pNdcgUu0UdWXGHed1LxBHMDtHQFQYjcpp9PT9O9MH0Jpj xTvEC+KmVi6RE+97r8ykVZKB1q88MKOBngQXwbig1ZRT3Mz54yEO2txJPSgCfiE8SIZ1 KAFg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si2530227otp.280.2020.01.08.12.58.36; Wed, 08 Jan 2020 12:58:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgAHU5J convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Jan 2020 15:57:09 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:48276 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgAHU5J (ORCPT ); Wed, 8 Jan 2020 15:57:09 -0500 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id ADCE2CECFA; Wed, 8 Jan 2020 22:06:24 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: [PATCH] Bleutooth: Add definitions for LE Read Tx Power From: Marcel Holtmann In-Reply-To: <1578386915-1524-1-git-send-email-ankit.p.navik@intel.com> Date: Wed, 8 Jan 2020 21:57:07 +0100 Cc: BlueZ devel list Content-Transfer-Encoding: 8BIT Message-Id: <08B392B2-334A-47E3-A60F-AD7E21FAF9B2@holtmann.org> References: <1578386915-1524-1-git-send-email-ankit.p.navik@intel.com> To: Ankit Navik X-Mailer: Apple Mail (2.3608.40.2.2.4) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Ankit, > 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 can we please keep this list sorted by opcode. > 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; > + They are LE specific so lets prefix them as le_ and put them together with other le_ data. > 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) Please do proper indentation. > +{ > + 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; Regards Marcel