Pacific Beach Drive

Mike's Drive.

Follow me on GitHub

Types of logs

rundown of logs to diagnose Bluetooth testing issues, analyze performance, and ensure compliance.

  • These logs, when used together, provide a comprehensive view of Bluetooth operations, from low-level hardware interactions to high-level application behavior.
  • They are crucial for troubleshooting, performance optimization, and ensuring compliance with Bluetooth specifications.
  • At Google and meta I pulled the logs with an adb cmd
adb devices
adb bugreport

# or you pull a logcat
# capture logcat output in real-time and
# save it to a file on your computer

adb logcat > logcat.txt
adb pull /sdcard/logcat.log /path/to/local/directory/
adb logcat -d > /path/to/local/directory/logcat.txt

At Google they have a software that unzips the bugreport and enables you to

  • surf through the logs
  • search for a specific log and open it for further investigation
  • search in all logs for a specific error message (it even shows you how often a specific error occured).

Alternatively you can pull the bugreport into wireshark, different name same game.


1. Bluetooth Stack Logs

  • Description: Logs generated by the Bluetooth stack (software) on the host device. They provide a high-level view of the Bluetooth operations, including connection management, pairing, and data exchange.
  • Usage: For debugging issues related to the Bluetooth stack or its interaction with the application layer.

2. Bluetooth Controller Logs

  • Description: Logs from the Bluetooth controller (hardware). These can include information about the lower-level operations of the Bluetooth chip, such as hardware events and status.
  • Usage: For understanding hardware-specific issues and performance metrics.

3. Bluetooth HCI Command/Event Logs

  • Description: Detailed logs of HCI commands sent from the host to the controller and the events generated by the controller.
  • Usage: For analyzing the commands issued by the host and the corresponding responses or events generated by the controller.

4. Bluetooth Packet Logs

  • Description: Logs of individual Bluetooth packets transmitted over the air. These logs can include raw data packets, such as ACL, SCO (Synchronous Connection-Oriented), and advertising packets.
  • Usage: For analyzing the actual data being transmitted and received, including checking packet integrity and timing.

5. Bluetooth LE Advertising Logs

  • Description: Logs specific to Bluetooth Low Energy (BLE) advertising and scanning. They record information about advertising packets and scan responses.
  • Usage: For debugging BLE-related issues, such as problems with device discovery or connection establishment.

6. Bluetooth Profiles Logs

  • Description: Logs related to specific Bluetooth profiles (e.g., A2DP, HID, GATT). They track profile-specific operations and interactions.
  • Usage: For troubleshooting issues within a specific Bluetooth profile or service.

7. Connection Event Logs

  • Description: Logs detailing connection events, such as connection establishment, disconnection, and connection parameter updates.
  • Usage: For diagnosing issues related to connection stability and performance.

8. Error Logs

  • Description: Logs that capture error messages and codes generated by the Bluetooth stack or controller.
  • Usage: For identifying and resolving specific error conditions encountered during Bluetooth operations.

9. Power Consumption Logs

  • Description: Logs related to the power usage of Bluetooth devices, often measured during different Bluetooth operations (e.g., idle, scanning, transmitting).
  • Usage: Important for assessing the power efficiency of Bluetooth devices, especially in battery-operated devices.

10. Trace Logs

  • Description: Detailed trace logs that provide a chronological view of Bluetooth operations, often including timestamps and sequence information.
  • Usage: For in-depth analysis of the Bluetooth communication sequence and timing.

in more detail - Bluetooth stack logs

1. Data Capture

  • How: Bluetooth stack logs are captured through specialized logging mechanisms embedded within the Bluetooth stack implementation. These mechanisms can be activated through:
    • Software APIs: Some Bluetooth stack libraries provide functions to enable and control logging.
    • Configuration Settings: Certain device firmware configurations or debugging tools offer options to enable logging.
    • Hardware Debug Ports: Advanced setups might involve capturing data directly from dedicated debug ports on the Bluetooth hardware.
  • What: The logs typically capture events and data associated with Bluetooth communication, including:
    • Protocol Events: Key milestones like connection establishment, data transfers, disconnections, and error occurrences.
    • Packet Contents: Actual data payloads exchanged between devices, formatted according to Bluetooth protocols.
    • State Transitions: Changes in the Bluetooth stack’s internal states, providing insights into the flow of communication.
  • Where: Logs are generally stored in:
    • Device Memory: Logs might be stored in temporary buffers within the device’s RAM, potentially with limits on log size.
    • External Storage: Depending on the device and setup, logs might be written to a file on a microSD card, USB drive, or network location.

2. Protocol Details

  • Bluetooth Stack: Bluetooth stack logs provide a glimpse into the internal workings of the Bluetooth communication protocols, including:
    • L2CAP (Logical Link Control and Adaptation Protocol): Handles data transfer between Bluetooth devices.
    • ATT (Attribute Protocol): Used for accessing data stored in Bluetooth device profiles.
    • GATT (Generic Attribute Profile): Defines the structure and behavior of Bluetooth device services and characteristics.
    • SDP (Service Discovery Protocol): Enables devices to discover and connect to available services on other devices.
  • Log Interpretation: Logs often include details about:
    • Protocol Versions: The specific version of Bluetooth and related protocols used.
    • Packet IDs: Unique identifiers for individual packets in communication.
    • Packet Types: Types of messages being exchanged (e.g., control packets, data packets).
    • Data Fields: Content of the data fields within the Bluetooth packets.
  • Tools for Parsing: To analyze Bluetooth stack logs, you might require specialized tools that understand the Bluetooth protocol structure. These tools can decode the log data and present it in a human-readable format.

3. Debugging and Analysis

  • Identifying Issues: Bluetooth stack logs are invaluable for:
    • Connection Problems: Analyzing log entries can reveal reasons for connection failures, connection drops, or slow communication.
    • Data Transfer Errors: Detecting corrupted or lost data during transfer.
    • Device Compatibility: Identifying conflicts or incompatibilities between devices.
    • Security Issues: Analyzing security-related events in the log.
  • Troubleshooting Tools: Tools for analyzing Bluetooth stack logs:
    • Wireshark: Although Wireshark is primarily designed for general network traffic analysis, it can be used to decode some Bluetooth data.
    • Vendor-Specific Tools: Many Bluetooth chip manufacturers and software vendors provide dedicated tools for logging and analysis tailored to their specific products.
    • Custom Scripts: Developers might write custom scripts or programs to parse and analyze Bluetooth logs.

## in more detail - Bluetooth HCI (Host Controller Interface) Snoop Log

for in-depth analysis of Bluetooth communication, providing insights into the inner workings of Bluetooth interactions and helping to resolve complex issues related to Bluetooth technology

  • 1.Data Capture: The log captures packets of data that are transmitted and received over the HCI interface. This includes both command and event packets, as well as ACL (Asynchronous Connection-Less) data packets used for Bluetooth communication.

  • 2.Protocol Details: It provides a detailed view of the HCI commands and events, such as connection requests, data transfers, and various Bluetooth state changes. This is crucial for understanding the low-level operations of Bluetooth communication.

  • 3.Debugging and Analysis: By analyzing HCI Snoop Logs, developers and testers can troubleshoot Bluetooth issues, verify correct protocol implementation, and ensure that the Bluetooth stack is operating as expected. It helps in diagnosing problems like failed connections, data transfer issues, or protocol errors.

  • 4.Log Formats: HCI Snoop Logs are typically saved in a binary or text-based format and can be analyzed using various tools, such as Wireshark. In Wireshark, for example, you can view the decoded Bluetooth packets, inspect individual fields, and trace the sequence of Bluetooth operations. Companies like Google, Amazon and Meta have their proprietary tools to cover that.

  • 5.Usage in Development: During the development and testing phase, engineers use HCI Snoop Logs to validate that the Bluetooth hardware and software are functioning correctly. It helps in ensuring that the Bluetooth stack is compliant with the Bluetooth specification and that all commands and responses are correctly handled.