Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature
@ 2020-07-07 15:46 Marcel Holtmann
  2020-07-07 15:51 ` Alain Michaud
  2020-07-07 15:54 ` Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Marcel Holtmann @ 2020-07-07 15:46 UTC (permalink / raw)
  To: linux-bluetooth

From: Alain Michaud <alainm@chromium.org>

This patch adds an le_simult_central_peripheral features which allows a
clients to determine if the controller is able to support peripheral and
central connections separately and at the same time.

Signed-off-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/mgmt.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5e9b9728eeac..d29da80e38fe 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3753,12 +3753,19 @@ static const u8 debug_uuid[16] = {
 };
 #endif
 
+/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
+static const u8 simult_central_periph_uuid[16] = {
+	0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
+	0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
+};
+
 static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
 				  void *data, u16 data_len)
 {
-	char buf[42];
+	char buf[44];
 	struct mgmt_rp_read_exp_features_info *rp = (void *)buf;
 	u16 idx = 0;
+	u32 flags;
 
 	bt_dev_dbg(hdev, "sock %p", sk);
 
@@ -3766,7 +3773,7 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
 
 #ifdef CONFIG_BT_FEATURE_DEBUG
 	if (!hdev) {
-		u32 flags = bt_dbg_get() ? BIT(0) : 0;
+		flags = bt_dbg_get() ? BIT(0) : 0;
 
 		memcpy(rp->features[idx].uuid, debug_uuid, 16);
 		rp->features[idx].flags = cpu_to_le32(flags);
@@ -3774,6 +3781,20 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
 	}
 #endif
 
+	if (hdev) {
+		if (test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) &&
+		    (hdev->le_states[4] & 0x08) &&	/* Central */
+		    (hdev->le_states[4] & 0x40) &&	/* Peripheral */
+		    (hdev->le_states[3] & 0x10))	/* Simultaneous */
+			flags = BIT(0);
+		else
+			flags = 0;
+
+		memcpy(rp->features[idx].uuid, simult_central_periph_uuid, 16);
+		rp->features[idx].flags = cpu_to_le32(flags);
+		idx++;
+	}
+
 	rp->feature_count = cpu_to_le16(idx);
 
 	/* After reading the experimental features information, enable
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature
  2020-07-07 15:46 [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature Marcel Holtmann
@ 2020-07-07 15:51 ` Alain Michaud
  2020-07-07 15:54 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Alain Michaud @ 2020-07-07 15:51 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ

Hi Marcel,

I'm ok with your modifications.

Thanks,
Alain


On Tue, Jul 7, 2020 at 11:46 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> From: Alain Michaud <alainm@chromium.org>
>
> This patch adds an le_simult_central_peripheral features which allows a
> clients to determine if the controller is able to support peripheral and
> central connections separately and at the same time.
>
> Signed-off-by: Alain Michaud <alainm@chromium.org>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/mgmt.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 5e9b9728eeac..d29da80e38fe 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3753,12 +3753,19 @@ static const u8 debug_uuid[16] = {
>  };
>  #endif
>
> +/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
> +static const u8 simult_central_periph_uuid[16] = {
> +       0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92,
> +       0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67,
> +};
> +
>  static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
>                                   void *data, u16 data_len)
>  {
> -       char buf[42];
> +       char buf[44];
>         struct mgmt_rp_read_exp_features_info *rp = (void *)buf;
>         u16 idx = 0;
> +       u32 flags;
>
>         bt_dev_dbg(hdev, "sock %p", sk);
>
> @@ -3766,7 +3773,7 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
>
>  #ifdef CONFIG_BT_FEATURE_DEBUG
>         if (!hdev) {
> -               u32 flags = bt_dbg_get() ? BIT(0) : 0;
> +               flags = bt_dbg_get() ? BIT(0) : 0;
>
>                 memcpy(rp->features[idx].uuid, debug_uuid, 16);
>                 rp->features[idx].flags = cpu_to_le32(flags);
> @@ -3774,6 +3781,20 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
>         }
>  #endif
>
> +       if (hdev) {
> +               if (test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) &&
> +                   (hdev->le_states[4] & 0x08) &&      /* Central */
> +                   (hdev->le_states[4] & 0x40) &&      /* Peripheral */
> +                   (hdev->le_states[3] & 0x10))        /* Simultaneous */
> +                       flags = BIT(0);
> +               else
> +                       flags = 0;
> +
> +               memcpy(rp->features[idx].uuid, simult_central_periph_uuid, 16);
> +               rp->features[idx].flags = cpu_to_le32(flags);
> +               idx++;
> +       }
> +
>         rp->feature_count = cpu_to_le16(idx);
>
>         /* After reading the experimental features information, enable
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature
  2020-07-07 15:46 [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature Marcel Holtmann
  2020-07-07 15:51 ` Alain Michaud
@ 2020-07-07 15:54 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2020-07-07 15:54 UTC (permalink / raw)
  To: linux-bluetooth

Hi Alain,

> This patch adds an le_simult_central_peripheral features which allows a
> clients to determine if the controller is able to support peripheral and
> central connections separately and at the same time.
> 
> Signed-off-by: Alain Michaud <alainm@chromium.org>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-07 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 15:46 [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature Marcel Holtmann
2020-07-07 15:51 ` Alain Michaud
2020-07-07 15:54 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox