linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btbcm: Read controller features during configuration
@ 2017-06-10 12:32 Marcel Holtmann
  2017-06-12  9:49 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2017-06-10 12:32 UTC (permalink / raw)
  To: linux-bluetooth

Read the Broadcom specific controller features during configuration and
print them for informational purposes.

< HCI Command: Broadcom Read Controller Features (0x3f|0x006e) plen 0
> HCI Event: Command Complete (0x0e) plen 12
      Broadcom Read Controller Features (0x3f|0x006e) ncmd 1
        Status: Success (0x00)
        Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          Multi-AV transport bandwidth reducer
          WBS SBC
          FW LC-PLC

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 drivers/bluetooth/btbcm.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index ba3dd2eafc09..24f8c4e93f4e 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -246,6 +246,27 @@ static struct sk_buff *btbcm_read_verbose_config(struct hci_dev *hdev)
 	return skb;
 }
 
+static struct sk_buff *btbcm_read_controller_features(struct hci_dev *hdev)
+{
+	struct sk_buff *skb;
+
+	skb = __hci_cmd_sync(hdev, 0xfc6e, 0, NULL, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		BT_ERR("%s: BCM: Read controller features failed (%ld)",
+		       hdev->name, PTR_ERR(skb));
+		return skb;
+	}
+
+	if (skb->len != 9) {
+		BT_ERR("%s: BCM: Controller features length mismatch",
+		       hdev->name);
+		kfree_skb(skb);
+		return ERR_PTR(-EIO);
+	}
+
+	return skb;
+}
+
 static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -417,6 +438,14 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
 	BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read Controller Features */
+	skb = btbcm_read_controller_features(hdev);
+	if (IS_ERR(skb))
+		return PTR_ERR(skb);
+
+	BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
+	kfree_skb(skb);
+
 	/* Read Local Name */
 	skb = btbcm_read_local_name(hdev);
 	if (IS_ERR(skb))
@@ -540,6 +569,13 @@ int btbcm_setup_apple(struct hci_dev *hdev)
 		kfree_skb(skb);
 	}
 
+	/* Read Controller Features */
+	skb = btbcm_read_controller_features(hdev);
+	if (!IS_ERR(skb)) {
+		BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
+		kfree_skb(skb);
+	}
+
 	/* Read Local Name */
 	skb = btbcm_read_local_name(hdev);
 	if (!IS_ERR(skb)) {
-- 
2.9.4


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

* Re: [PATCH] Bluetooth: btbcm: Read controller features during configuration
  2017-06-10 12:32 [PATCH] Bluetooth: btbcm: Read controller features during configuration Marcel Holtmann
@ 2017-06-12  9:49 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2017-06-12  9:49 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Saturday, 10 June 2017 14:32:29 CEST Marcel Holtmann wrote:
> Read the Broadcom specific controller features during configuration and
> print them for informational purposes.
> 
> < HCI Command: Broadcom Read Controller Features (0x3f|0x006e) plen 0
> 
> > HCI Event: Command Complete (0x0e) plen 12
> 
>       Broadcom Read Controller Features (0x3f|0x006e) ncmd 1
>         Status: Success (0x00)
>         Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00
>           Multi-AV transport bandwidth reducer
>           WBS SBC
>           FW LC-PLC
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  drivers/bluetooth/btbcm.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
> index ba3dd2eafc09..24f8c4e93f4e 100644
> --- a/drivers/bluetooth/btbcm.c
> +++ b/drivers/bluetooth/btbcm.c
> @@ -246,6 +246,27 @@ static struct sk_buff *btbcm_read_verbose_config(struct
> hci_dev *hdev) return skb;
>  }
> 
> +static struct sk_buff *btbcm_read_controller_features(struct hci_dev *hdev)
> +{
> +	struct sk_buff *skb;
> +
> +	skb = __hci_cmd_sync(hdev, 0xfc6e, 0, NULL, HCI_INIT_TIMEOUT);
> +	if (IS_ERR(skb)) {
> +		BT_ERR("%s: BCM: Read controller features failed (%ld)",
> +		       hdev->name, PTR_ERR(skb));
> +		return skb;
> +	}
> +
> +	if (skb->len != 9) {
> +		BT_ERR("%s: BCM: Controller features length mismatch",
> +		       hdev->name);
> +		kfree_skb(skb);
> +		return ERR_PTR(-EIO);
> +	}
> +
> +	return skb;
> +}
> +
>  static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
>  {
>  	struct sk_buff *skb;
> @@ -417,6 +438,14 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
>  	BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
>  	kfree_skb(skb);
> 
> +	/* Read Controller Features */
> +	skb = btbcm_read_controller_features(hdev);
> +	if (IS_ERR(skb))
> +		return PTR_ERR(skb);
> +
> +	BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
> +	kfree_skb(skb);
> +
>  	/* Read Local Name */
>  	skb = btbcm_read_local_name(hdev);
>  	if (IS_ERR(skb))
> @@ -540,6 +569,13 @@ int btbcm_setup_apple(struct hci_dev *hdev)
>  		kfree_skb(skb);
>  	}
> 
> +	/* Read Controller Features */
> +	skb = btbcm_read_controller_features(hdev);
> +	if (!IS_ERR(skb)) {
> +		BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
> +		kfree_skb(skb);
> +	}
> +
>  	/* Read Local Name */
>  	skb = btbcm_read_local_name(hdev);
>  	if (!IS_ERR(skb)) {

Applied to bluetooth-next tree. Thanks.

-- 
pozdrawiam
Szymon Janc

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

end of thread, other threads:[~2017-06-12  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-10 12:32 [PATCH] Bluetooth: btbcm: Read controller features during configuration Marcel Holtmann
2017-06-12  9:49 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).