mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-25 09:35:42 +00:00
add instructions on HCI logging
This commit is contained in:
parent
b615042013
commit
7b2f72db63
@ -273,4 +273,35 @@ data registered by *l2cap_create_channel_internal*; after that
|
||||
keyboard can reconnect by itself. For this, you need to register L2CAP
|
||||
services for the HID Control and HID Interrupt PSMs using
|
||||
*l2cap_register_service_internal*. In this call, you’ll also specify
|
||||
a packet handler to accept and receive keyboard data.
|
||||
a packet handler to accept and receive keyboard data.
|
||||
|
||||
|
||||
Bluetooth HCI Packet Logs
|
||||
-------------------------
|
||||
|
||||
If things don't work as expected, having a look at the data exchanged
|
||||
between BTstack and the Bluetooth chipset often helps.
|
||||
|
||||
For this, BTstack provides a configurable packet logging mechanism via hci_dump.h:
|
||||
|
||||
// formats: HCI_DUMP_BLUEZ, HCI_DUMP_PACKETLOGGER, HCI_DUMP_STDOUT
|
||||
void hci_dump_open(const char *filename, hci_dump_format_t format);
|
||||
|
||||
On POSIX systems, you can call hci_dump_open with a path and HCI_DUMP_BLUEZ
|
||||
or HCI_DUMP_PACKETLOGGER in the setup, i.e., before entering the run loop.
|
||||
The resulting file can be analyzed with Wireshark
|
||||
or the Apple's PacketLogger tool.
|
||||
|
||||
On embedded systems without a file system, you still can call hci_dump_open(NULL, HCI_DUMP_STDOUT).
|
||||
It will log all HCI packets to the consolve via printf.
|
||||
If you capture the console output, incl. your own debug messages, you can use
|
||||
the create_packet_log.py tool in the tools folder to convert a text output into a
|
||||
PacketLogger file.
|
||||
|
||||
In addition to the HCI packets, you can also enable BTstack's debug information by adding
|
||||
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
|
||||
to the btstack-config.h and recompiling your application.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user