Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5543468ybl; Tue, 14 Jan 2020 10:41:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxzpZHHUdOkuOus5i/fC+2Tzqn9KbnS20PvVAcwPtezcylAQi2b2G6WgLmAL8hghsG4qnKo X-Received: by 2002:a9d:53c4:: with SMTP id i4mr18912458oth.48.1579027282695; Tue, 14 Jan 2020 10:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579027282; cv=none; d=google.com; s=arc-20160816; b=JVk7V8JOTRYimx7cTyAL4B0bY3oZxZ4uzkrCMzYVOr276lTW7j8dsUdvdfVzsL8TRe wkgb/1jNyAGvs7Pzj3oovIsbxnoxOVf9PlBvhiptldC5412UfX+rPSd/b9r4Fdzg+kZ2 GeKL5IvypDqfZwmMlnRhBGh97EFCVYLC3Tvn5t9mUyNRRRBa+Zu+DsiYCw/2HgUUik2G VfAEXB61tE4BhgF+J37kuQ2zi57iQ1pYoGFMWpoVElOP6kLrzekqfEJwHaf/efZ0ixV0 PQzQWDSNSDOLFDQfinbdVUHGLGdFZQ0DoQFBvKTI54uxQd2e2Rg9qpx8x8+c5E/SylCO UBCA== 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=Xmx4Q9dzxd1c2PnNMSziYIIZTXgSajmHArFf7wAZ4g4=; b=lAkcMTcEfDKflPP6Nu13DWmaOa0gcPQFb1J4tLvAo1YrOJBpWfOri7UAQXq6XYVQI/ elztST1kadC1dEmsoh3PZ62xYOhS5U6wpHbS+i9iMfUoFehtBpvidHZ23UoNmN71rPYV Xtl9bkAx0I+b6tY7FKECnjUPsvtYgOiyp/5myge/8/syZKHadJAQfzEg+LMlMb9Yi9Wo plt3wiw3V3ooBL1ZSIlkizOaphnn2ABoYuPFYVVHwi6sS6XS5RmpFRcr+mHMg8RuGzfN ZFbMTOv6WcvjDJgwHx2VQdLtiwT09jeosrnqTYOWe3YIBBKkSsTlSalYEBKbZuqICJ6G jBDQ== 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 g1si9123569otj.115.2020.01.14.10.41.00; Tue, 14 Jan 2020 10:41:22 -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 S1727083AbgANSk5 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 14 Jan 2020 13:40:57 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:43191 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgANSk5 (ORCPT ); Tue, 14 Jan 2020 13:40:57 -0500 Received: from marcel-macpro.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id D245CCECE2; Tue, 14 Jan 2020 19:50:13 +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 v2] Bleutooth: Add definitions for LE Read Tx Power From: Marcel Holtmann In-Reply-To: <1578592151-9220-1-git-send-email-ankit.p.navik@intel.com> Date: Tue, 14 Jan 2020 19:40:55 +0100 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <227F4801-990E-4C12-9E0D-A3CFD807F8CB@holtmann.org> References: <1578592151-9220-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 | 17 +++++++++++++++++ > 3 files changed, 27 insertions(+) > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > index 07b6ece..eccb6b2 100644 > --- a/include/net/bluetooth/hci.h > +++ b/include/net/bluetooth/hci.h > @@ -1718,6 +1718,13 @@ struct hci_cp_le_set_adv_set_rand_addr { > bdaddr_t bdaddr; > } __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; > + > /* ---- HCI Events ---- */ > #define HCI_EV_INQUIRY_COMPLETE 0x01 > > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > index faebe38..f3d389d 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 le_min_tx_power; > + __s8 le_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..3646f77 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -988,6 +988,19 @@ 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->le_min_tx_power = rp->min_tx_power; > + hdev->le_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 +3427,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; by itself this addition is useless. You also need to send the HCI_OP_LE_READ_TX_POWER during the power on of the controller. Please add that part. And on the controller creation you need to the default le_{min,max}_tx_power fields to invalid. Regards Marcel