Buetooth: Add support for vendor specific diagnostic channel
Subsystems (2)
Marcel Holtmann
maintainerPATCH 1/1 Buetooth: Add support for vendor specific diagnostic channel
Introduce hci_recv_diag function for HCI drivers to allow sending vendor specific diagnostic messages into the Bluetooth core stack. The messages are not processed, but they are forwarded to the monitor channel and can be retrieved by user space diagnostic tools.
Signed-off-by Marcel Holtmann <[email protected]>
--- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 1 + include/net/bluetooth/hci_mon.h | 1 + net/bluetooth/hci_core.c | 15 +++++++++++++++ net/bluetooth/hci_sock.c | 3 +++ 5 files changed, 21 insertions(+)
include/net/bluetooth/hci.h +1 -0
@@ -262,6 +262,7 @@ enum {#define HCI_ACLDATA_PKT 0x02#define HCI_SCODATA_PKT 0x03#define HCI_EVENT_PKT 0x04 +#define HCI_DIAG_PKT 0xf0#define HCI_VENDOR_PKT 0xff/* HCI packet types */
include/net/bluetooth/hci_core.h +1 -0
@@ -1066,6 +1066,7 @@ int hci_remove_adv_instance(struct hci_dev *hdev, u8 instance);void hci_event_packet (struct hci_dev *hdev,struct sk_buff *skb);int hci_recv_frame (struct hci_dev *hdev,struct sk_buff *skb); +int hci_recv_diag (struct hci_dev *hdev,struct sk_buff *skb);void hci_init_sysfs (struct hci_dev *hdev);void hci_conn_init_sysfs (struct hci_conn *conn);
include/net/bluetooth/hci_mon.h +1 -0
@@ -42,6 +42,7 @@ struct hci_mon_hdr {#define HCI_MON_OPEN_INDEX 8#define HCI_MON_CLOSE_INDEX 9#define HCI_MON_INDEX_INFO 10 +#define HCI_MON_VENDOR_DIAG 11struct hci_mon_new_index {__u8 type;
net/bluetooth/hci_core.c +15 -0
@@ -3493,6 +3493,21 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb) }EXPORT_SYMBOL (hci_recv_frame); +/* Receive diagnostic message from HCI drivers */ +int hci_recv_diag (struct hci_dev *hdev,struct sk_buff *skb) +{ +/* Time stamp */ +__net_timestamp (skb); + +/* Mark as diagnostic packet and send to monitor */ +bt_cb (skb)->pkt_type =HCI_DIAG_PKT ; +hci_send_to_monitor (hdev, skb); + +kfree_skb (skb); +return 0 ; +} +EXPORT_SYMBOL (hci_recv_diag); +/* ---- Interface to upper protocols ---- */ int hci_register_cb (struct hci_cb *cb)
net/bluetooth/hci_sock.c +3 -0
@@ -279,6 +279,9 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)else opcode =cpu_to_le16 (HCI_MON_SCO_TX_PKT );break ; +case HCI_DIAG_PKT : + opcode =cpu_to_le16 (HCI_MON_VENDOR_DIAG ); +break ;default :return ; }
Signature · 1 line
2.4.3
Johan Hedberg
AppliedHi Marcel,
Quoted 5 lines · Marcel Holtmann
Introduce
hci_recv_diagfunction for HCI drivers to allow sending vendor specific diagnostic messages into the Bluetooth core stack. The messages are not processed, but they are forwarded to the monitor channel and can be retrieved by user space diagnostic tools.
Quoted 8 lines
Signed-off-by Marcel Holtmann <[email protected]>--- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 1 + include/net/bluetooth/hci_mon.h | 1 + net/bluetooth/hci_core.c | 15 +++++++++++++++ net/bluetooth/hci_sock.c | 3 +++ 5 files changed, 21 insertions(+)
Applied to bluetooth-next (with the obvious 'Buetooth' typo fix). Thanks.
Johan