linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Workaround hd directed advertising bug in Broadcom controllers
@ 2019-10-02 12:22 Szymon Janc
  2019-10-16 19:17 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2019-10-02 12:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc, Sören Beye

It appears that some Broadcom controllers (eg BCM20702A0) reject LE Set
Advertising Parameters command if advertising intervals provided are not
within range for undirected and low duty directed advertising.

Workaround this bug by populating min and max intervals with 'valid'
values.

< HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15                                                                                                                                                                                                                                      #75 [hci0] 29.155775
        Min advertising interval: 0.000 msec (0x0000)
        Max advertising interval: 0.000 msec (0x0000)
        Type: Connectable directed - ADV_DIRECT_IND (high duty cycle) (0x01)
        Own address type: Public (0x00)
        Direct address type: Random (0x01)
        Direct address: E2:F0:7B:9F:DC:F4 (Static)
        Channel map: 37, 38, 39 (0x07)
        Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                                                                                                                                             #76 [hci0] 29.156745
      LE Set Advertising Parameters (0x08|0x0006) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Tested-by: Sören Beye <linux@hypfer.de>
---
 net/bluetooth/hci_conn.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index ad5b0ac1f9ce..7ff92dd4c53c 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -934,6 +934,14 @@ static void hci_req_directed_advertising(struct hci_request *req,
 			return;
 
 		memset(&cp, 0, sizeof(cp));
+
+		/* Some controllers might reject command if intervals are not
+		 * within range for undirected advertising.
+		 * BCM20702A0 is known to be affected by this.
+		 */
+		cp.min_interval = cpu_to_le16(0x0020);
+		cp.max_interval = cpu_to_le16(0x0020);
+
 		cp.type = LE_ADV_DIRECT_IND;
 		cp.own_address_type = own_addr_type;
 		cp.direct_addr_type = conn->dst_type;
-- 
2.21.0


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

* Re: [PATCH] Bluetooth: Workaround hd directed advertising bug in Broadcom controllers
  2019-10-02 12:22 [PATCH] Bluetooth: Workaround hd directed advertising bug in Broadcom controllers Szymon Janc
@ 2019-10-16 19:17 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2019-10-16 19:17 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, Sören Beye

Hi Szymon,

> It appears that some Broadcom controllers (eg BCM20702A0) reject LE Set
> Advertising Parameters command if advertising intervals provided are not
> within range for undirected and low duty directed advertising.
> 
> Workaround this bug by populating min and max intervals with 'valid'
> values.
> 
> < HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15                                                                                                                                                                                                                                      #75 [hci0] 29.155775
>        Min advertising interval: 0.000 msec (0x0000)
>        Max advertising interval: 0.000 msec (0x0000)
>        Type: Connectable directed - ADV_DIRECT_IND (high duty cycle) (0x01)
>        Own address type: Public (0x00)
>        Direct address type: Random (0x01)
>        Direct address: E2:F0:7B:9F:DC:F4 (Static)
>        Channel map: 37, 38, 39 (0x07)
>        Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
>> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                                                                                                                                             #76 [hci0] 29.156745
>      LE Set Advertising Parameters (0x08|0x0006) ncmd 1
>        Status: Invalid HCI Command Parameters (0x12)
> 
> Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
> Tested-by: Sören Beye <linux@hypfer.de>
> ---
> net/bluetooth/hci_conn.c | 8 ++++++++
> 1 file changed, 8 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2019-10-16 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 12:22 [PATCH] Bluetooth: Workaround hd directed advertising bug in Broadcom controllers Szymon Janc
2019-10-16 19:17 ` Marcel Holtmann

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).