linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_bcm: Handle empty packet after firmware loading
@ 2017-08-17 19:41 Marcel Holtmann
  2017-08-17 19:53 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2017-08-17 19:41 UTC (permalink / raw)
  To: linux-bluetooth

The Broadcom controller on the Raspberry Pi3 sends an empty packet with
packet type 0x00 after launching the firmware. This will cause logging
of errors.

  Bluetooth: hci0: Frame reassembly failed (-84)

Since this seems to be an intented behaviour of the controller, handle
it gracefully by parsing that empty packet with packet type 0x00 and
then just simply report it as diagnostic packet.

With that change no errors are logging and the packet itself is actually
recorded in the Bluetooth monitor traces.

  < HCI Command: Broadcom Launch RAM (0x3f|0x004e) plen 4
         Address: 0xffffffff
  > HCI Event: Command Complete (0x0e) plen 4
       Broadcom Launch RAM (0x3f|0x004e) ncmd 1
         Status: Success (0x00)
  = Vendor Diagnostic (len 0)
  < HCI Command: Broadcom Update UART Baud Rate (0x3f|0x0018) plen 6
         00 00 00 10 0e 00                                ......
  > HCI Event: Command Complete (0x0e) plen 4
       Broadcom Update UART Baud Rate (0x3f|0x0018) ncmd 1
         Status: Success (0x00)
  < HCI Command: Reset (0x03|0x0003) plen 0
  > HCI Event: Command Complete (0x0e) plen 4
       Reset (0x03|0x0003) ncmd 1
         Status: Success (0x00)

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

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 1eb286ade48a..302789a2bd3a 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -41,6 +41,9 @@
 #include "btbcm.h"
 #include "hci_uart.h"
 
+#define BCM_NULL_PKT 0x00
+#define BCM_NULL_SIZE 0
+
 #define BCM_LM_DIAG_PKT 0x07
 #define BCM_LM_DIAG_SIZE 63
 
@@ -436,11 +439,19 @@ static int bcm_setup(struct hci_uart *hu)
 	.lsize = 0, \
 	.maxlen = BCM_LM_DIAG_SIZE
 
+#define BCM_RECV_NULL \
+	.type = BCM_NULL_PKT, \
+	.hlen = BCM_NULL_SIZE, \
+	.loff = 0, \
+	.lsize = 0, \
+	.maxlen = BCM_NULL_SIZE
+
 static const struct h4_recv_pkt bcm_recv_pkts[] = {
 	{ H4_RECV_ACL,      .recv = hci_recv_frame },
 	{ H4_RECV_SCO,      .recv = hci_recv_frame },
 	{ H4_RECV_EVENT,    .recv = hci_recv_frame },
 	{ BCM_RECV_LM_DIAG, .recv = hci_recv_diag  },
+	{ BCM_RECV_NULL,    .recv = hci_recv_diag  },
 };
 
 static int bcm_recv(struct hci_uart *hu, const void *data, int count)
-- 
2.13.5


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

* Re: [PATCH] Bluetooth: hci_bcm: Handle empty packet after firmware loading
  2017-08-17 19:41 [PATCH] Bluetooth: hci_bcm: Handle empty packet after firmware loading Marcel Holtmann
@ 2017-08-17 19:53 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2017-08-17 19:53 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Thu, Aug 17, 2017, Marcel Holtmann wrote:
> The Broadcom controller on the Raspberry Pi3 sends an empty packet with
> packet type 0x00 after launching the firmware. This will cause logging
> of errors.
> 
>   Bluetooth: hci0: Frame reassembly failed (-84)
> 
> Since this seems to be an intented behaviour of the controller, handle
> it gracefully by parsing that empty packet with packet type 0x00 and
> then just simply report it as diagnostic packet.
> 
> With that change no errors are logging and the packet itself is actually
> recorded in the Bluetooth monitor traces.
> 
>   < HCI Command: Broadcom Launch RAM (0x3f|0x004e) plen 4
>          Address: 0xffffffff
>   > HCI Event: Command Complete (0x0e) plen 4
>        Broadcom Launch RAM (0x3f|0x004e) ncmd 1
>          Status: Success (0x00)
>   = Vendor Diagnostic (len 0)
>   < HCI Command: Broadcom Update UART Baud Rate (0x3f|0x0018) plen 6
>          00 00 00 10 0e 00                                ......
>   > HCI Event: Command Complete (0x0e) plen 4
>        Broadcom Update UART Baud Rate (0x3f|0x0018) ncmd 1
>          Status: Success (0x00)
>   < HCI Command: Reset (0x03|0x0003) plen 0
>   > HCI Event: Command Complete (0x0e) plen 4
>        Reset (0x03|0x0003) ncmd 1
>          Status: Success (0x00)
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  drivers/bluetooth/hci_bcm.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Applied to bluetooth-next. Thanks.

Johan

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

end of thread, other threads:[~2017-08-17 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 19:41 [PATCH] Bluetooth: hci_bcm: Handle empty packet after firmware loading Marcel Holtmann
2017-08-17 19:53 ` Johan Hedberg

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