浏览代码

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.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Marcel Holtmann 9 年之前
父节点
当前提交
94c58132c0
共有 1 个文件被更改,包括 14 次插入3 次删除
  1. 14 3
      drivers/bluetooth/hci_bcm.c

+ 14 - 3
drivers/bluetooth/hci_bcm.c

@@ -41,6 +41,9 @@
 #include "btbcm.h"
 #include "btbcm.h"
 #include "hci_uart.h"
 #include "hci_uart.h"
 
 
+#define BCM_LM_DIAG_PKT 0x07
+#define BCM_LM_DIAG_SIZE 63
+
 #define BCM_AUTOSUSPEND_DELAY	5000 /* default autosleep delay */
 #define BCM_AUTOSUSPEND_DELAY	5000 /* default autosleep delay */
 
 
 struct bcm_device {
 struct bcm_device {
@@ -396,10 +399,18 @@ finalize:
 	return err;
 	return err;
 }
 }
 
 
+#define BCM_RECV_LM_DIAG \
+	.type = BCM_LM_DIAG_PKT, \
+	.hlen = BCM_LM_DIAG_SIZE, \
+	.loff = 0, \
+	.lsize = 0, \
+	.maxlen = BCM_LM_DIAG_SIZE
+
 static const struct h4_recv_pkt bcm_recv_pkts[] = {
 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)
 static int bcm_recv(struct hci_uart *hu, const void *data, int count)