Skip to contentSkip to conversation

Bluetooth: hci_bcm: Enable parsing of LM_DIAG messages

PATCH Superseded Marcel Holtmann 2 participants 2 messages Oct 7, 2015 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_bcm: Enable parsing of LM_DIAG messages

The Broadcom UART based controllers can send LM_DIAG messages with the identifier 0x07 inside the HCI stream. These messages are 63 octets in size and have no variable payload or length indicator.

This patch adds correct parsing information for the h4_recv_buf handler and in case these packets are received, they are forwarded to the Bluetooth core via hci_recv_diag interface.

---
 drivers/bluetooth/hci_bcm.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_bcm.c +14 -3
index 512873262055..d491a968e291 100644
@@ -41,6 +41,9 @@
 #include "btbcm.h"
 #include "hci_uart.h"
 
+#define HCI_BCM_LM_DIAG_PKT 0x07
+#define HCI_BCM_LM_DIAG_SIZE 63
+
 #define BCM_AUTOSUSPEND_DELAY	5000 /* default autosleep delay */
 
 struct bcm_device {
@@ -396,10 +399,18 @@ finalize:
 	return err;
 }
 
+#define BCM_RECV_LM_DIAG \
+	.type = HCI_BCM_LM_DIAG_PKT, \
+	.hlen = HCI_BCM_LM_DIAG_SIZE, \
+	.loff = 0, \
+	.lsize = 0, \
+	.maxlen = HCI_BCM_LM_DIAG_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 },
+	{ 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  },
 };
 
 static int bcm_recv(struct hci_uart *hu, const void *data, int count)
Signature · 1 line
2.4.3
#1 lore raw
config: i386-randconfig-i0-201540 (attached as .config) reproduce:

Hi Marcel,

[auto build test ERROR on next-20151007 -- if it's inappropriate base, please ignore]

config: i386-randconfig-i0-201540 (attached as .config) reproduce:

        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/bluetooth/hci_bcm.c:413:30: error: 'hci_recv_diag' undeclared here (not in a function)

{ BCM_RECV_LM_DIAG, .recv = hci_recv_diag },
^

vim +/hci_recv_diag +413 drivers/bluetooth/hci_bcm.c

407 .maxlen = HCI_BCM_LM_DIAG_SIZE
408
409 static const struct h4_recv_pkt bcm_recv_pkts[] = {

   410		{ H4_RECV_ACL,      .recv = hci_recv_frame },
   411		{ H4_RECV_SCO,      .recv = hci_recv_frame },
   412		{ H4_RECV_EVENT,    .recv = hci_recv_frame },
 > 413		{ BCM_RECV_LM_DIAG, .recv = hci_recv_diag  },

414 };
415
416 static int bcm_recv(struct hci_uart *hu, const void *data, int count)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation