* [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation
@ 2026-02-18 18:31 Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 2/5] doc/btmon: Add dedicate sections for timestamp and frame number Luiz Augusto von Dentz
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-18 18:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing documentation for -I/--iso and -N/--no-time options.
---
doc/btmon.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/btmon.rst b/doc/btmon.rst
index 11d98a93b4b0..e51001921ab1 100644
--- a/doc/btmon.rst
+++ b/doc/btmon.rst
@@ -84,10 +84,15 @@ OPTIONS
-T, --date Show a time and date information instead of
time offset.
+-N, --no-time Suppress the time offset display entirely.
+
-S, --sco Dump SCO traffic in raw hex format.
-A, --a2dp Dump A2DP stream traffic in a raw hex format.
+-I, --iso Dump ISO stream traffic in raw hex format. Required
+ to see LE Audio isochronous data in the output.
+
-E IP, --ellisys IP Send Ellisys HCI Injection.
-P, --no-pager Disable pager usage while reading the log file.
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ v1 2/5] doc/btmon: Add dedicate sections for timestamp and frame number
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
@ 2026-02-18 18:31 ` Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 3/5] doc/btmon: Add connection tracking section Luiz Augusto von Dentz
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-18 18:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds sections for how timestamp and frame numbers are generated
and explaim the difference between a frame number and a line number.
---
doc/btmon.rst | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/doc/btmon.rst b/doc/btmon.rst
index e51001921ab1..de05a5fcd6df 100644
--- a/doc/btmon.rst
+++ b/doc/btmon.rst
@@ -442,6 +442,41 @@ Example of protocol layering in ACL data::
Authentication requirement: Bonding, MITM, SC (0x2d)
Max encryption key size: 16
+Timestamp Notes
+---------------
+
+When reading btsnoop files with ``-t`` or ``-T``, timestamps reflect the
+wall-clock time recorded in the btsnoop file. The precision depends on
+the source:
+
+- **Live capture** (``btmon`` monitor channel): Microsecond precision
+ from the kernel.
+- **btsnoop files**: The btsnoop format stores timestamps as
+ microseconds since epoch, so full microsecond precision is
+ preserved. Trailing zeros in the display (e.g., ``14:38:46.589000``)
+ indicate the original capture source had millisecond granularity.
+
+The default timestamp mode shows seconds elapsed since the first
+packet in the trace, which is useful for measuring intervals between
+events without needing to know the absolute time.
+
+Frame Numbers vs Line Numbers
+-----------------------------
+
+btmon assigns sequential **frame numbers** (``#N``) to HCI packets.
+These are stable identifiers for specific packets regardless of output
+formatting. However, when processing btmon text output with tools like
+``grep`` or ``sed``, the relevant unit is **line numbers** in the output
+file. The two are unrelated:
+
+- A single frame may produce many output lines (header + decoded
+ fields).
+- Frame numbers only apply to HCI traffic (``<`` and ``>``). MGMT
+ (``@``) and system notes (``=``) do not have frame numbers.
+- When referencing specific packets, prefer frame numbers (``#487``)
+ over line numbers, as frame numbers are stable across different
+ terminal widths and formatting options.
+
Practical Reading Guide
-----------------------
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ v1 3/5] doc/btmon: Add connection tracking section
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 2/5] doc/btmon: Add dedicate sections for timestamp and frame number Luiz Augusto von Dentz
@ 2026-02-18 18:31 ` Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 4/5] doc/btmon: Add a dedicated section for analyze mode Luiz Augusto von Dentz
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-18 18:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds connection tracking section which explains how connections
and buffers are tracked.
---
doc/btmon.rst | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 141 insertions(+)
diff --git a/doc/btmon.rst b/doc/btmon.rst
index de05a5fcd6df..d93aa34a9412 100644
--- a/doc/btmon.rst
+++ b/doc/btmon.rst
@@ -531,6 +531,147 @@ The kernel forwarded this as a MGMT Device Connected event. bluetoothd
logged its ``connected_callback()``. Then data exchange began -- an L2CAP
parameter update and ATT MTU negotiation over the new ACL connection.
+CONNECTION TRACKING
+===================
+
+HCI uses **connection handles** (16-bit integers) to identify individual
+connections. Understanding how handles map to devices is essential for
+reading traces.
+
+Handle Types
+------------
+
+Different connection types use different handle ranges, but these ranges
+are controller-specific and not standardized. The connection type can be
+determined by looking at the event that created the handle:
+
+.. list-table::
+ :header-rows: 1
+ :widths: 15 25 60
+
+ * - Type
+ - Creation Event
+ - Description
+ * - BR/EDR ACL
+ - Connection Complete
+ - Classic Bluetooth data connection
+ * - LE ACL
+ - LE (Enhanced) Connection Complete
+ - Low Energy data connection
+ * - CIS
+ - LE CIS Established
+ - Connected Isochronous Stream (LE Audio)
+ * - BIS
+ - LE BIG Complete
+ - Broadcast Isochronous Stream (LE Audio)
+ * - SCO/eSCO
+ - Synchronous Connection Complete
+ - Voice/audio synchronous connection (classic)
+
+A single device may have multiple handles simultaneously. For example,
+an LE Audio device will have an LE ACL handle for control traffic and
+one or more CIS handles for audio streams. The ``LE CIS Established``
+event includes the ACL connection handle that the CIS is associated
+with.
+
+Controller Buffer Tracking
+--------------------------
+
+Buffer tracking may show a indicator in square brackets::
+
+ < ACL Data TX: Handle 2048 [1/6] flags 0x00 dlen 16
+
+The ``[1/6]`` means this is buffer slot 1 of 6 available controller
+ACL buffers. This reflects the host-side HCI flow control: the host
+tracks how many buffers the controller has available and shows the
+current usage. When the controller sends ``Number of Completed Packets``
+events, buffers are freed and the count decreases.
+
+HCI ERROR AND DISCONNECT REASON CODES
+======================================
+
+HCI status and disconnect reason codes use the same code space. These
+appear in ``Status:`` and ``Reason:`` fields throughout the trace.
+btmon decodes them automatically, but the hex values are useful for
+searching and filtering.
+
+Common Disconnect Reasons
+-------------------------
+
+.. list-table::
+ :header-rows: 1
+ :widths: 8 40 52
+
+ * - Code
+ - Name
+ - Diagnostic Meaning
+ * - 0x05
+ - Authentication Failure
+ - Pairing or encryption setup failed. Key may be
+ stale or devices have mismatched security databases.
+ * - 0x08
+ - Connection Timeout
+ - The supervision timer expired. The remote device
+ moved out of range or stopped responding. This is
+ an RF link loss.
+ * - 0x13
+ - Remote User Terminated Connection
+ - The remote device intentionally disconnected.
+ This is the normal graceful disconnect.
+ * - 0x14
+ - Remote Device Terminated due to Low Resources
+ - The remote device ran out of resources (memory,
+ connection slots).
+ * - 0x15
+ - Remote Device Terminated due to Power Off
+ - The remote device is powering down.
+ * - 0x16
+ - Connection Terminated By Local Host
+ - The local BlueZ stack intentionally disconnected.
+ Normal when bluetoothd initiates disconnect.
+ * - 0x1f
+ - Unspecified Error
+ - Generic error. Often indicates a firmware issue.
+ * - 0x22
+ - LMP/LL Response Timeout
+ - Link layer procedure timed out. The remote device
+ stopped responding to LL control PDUs.
+ * - 0x28
+ - Instant Passed
+ - A timing-critical operation missed its deadline.
+ Often seen with connection parameter updates.
+ * - 0x2f
+ - Insufficient Security
+ - The required security level (encryption, MITM
+ protection) was not met.
+ * - 0x3b
+ - Unacceptable Connection Parameters
+ - The remote rejected a connection parameter update.
+ * - 0x3d
+ - Connection Terminated due to MIC Failure
+ - Encryption integrity check failed. Possible key
+ mismatch or corruption.
+ * - 0x3e
+ - Connection Failed to be Established
+ - Connection attempt failed entirely (e.g., the
+ remote device did not respond to connection
+ requests).
+ * - 0x3f
+ - MAC Connection Failed
+ - MAC-level connection failure.
+ * - 0x44
+ - Operation Cancelled by Host
+ - The host cancelled the operation before it
+ completed.
+
+Full Error Code Table
+---------------------
+
+The complete set of HCI error codes (0x00-0x45) is defined in the
+Bluetooth Core Specification, Volume 1, Part F. btmon decodes all
+of them automatically in ``Status:`` and ``Reason:`` fields. The
+source mapping is in ``monitor/packet.c`` (``error2str_table``).
+
EXAMPLES
========
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ v1 4/5] doc/btmon: Add a dedicated section for analyze mode
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 2/5] doc/btmon: Add dedicate sections for timestamp and frame number Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 3/5] doc/btmon: Add connection tracking section Luiz Augusto von Dentz
@ 2026-02-18 18:31 ` Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 5/5] doc/btmon: Add a section for automated trace analysis Luiz Augusto von Dentz
2026-02-18 19:48 ` [BlueZ,v1,1/5] doc/btmon: Add missing documentation bluez.test.bot
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-18 18:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds a dedicated section for analyze mode.
---
doc/btmon.rst | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/doc/btmon.rst b/doc/btmon.rst
index d93aa34a9412..66a97859a49e 100644
--- a/doc/btmon.rst
+++ b/doc/btmon.rst
@@ -672,6 +672,43 @@ Bluetooth Core Specification, Volume 1, Part F. btmon decodes all
of them automatically in ``Status:`` and ``Reason:`` fields. The
source mapping is in ``monitor/packet.c`` (``error2str_table``).
+ANALYZE MODE
+============
+
+The ``-a`` (``--analyze``) option reads a btsnoop file and produces a
+statistical summary instead of the full decoded trace.
+
+Usage
+-----
+
+.. code-block::
+
+ $ btmon -a hcidump.log
+
+Output Contents
+---------------
+
+Analyze mode reports, for each controller found in the trace:
+
+- **Packet counts**: Total HCI packets broken down by type (commands,
+ events, ACL, SCO, ISO, vendor diagnostics, system notes, user
+ logs, control messages).
+
+- **Per-connection statistics**: For each connection handle found:
+
+ - Connection type (BR-ACL, LE-ACL, BR-SCO, BR-ESCO, LE-ISO)
+ - Device address
+ - TX and RX packet counts and completion counts
+ - Latency statistics (min, max, median) in milliseconds
+ - Packet size statistics (min, max, average) in octets
+ - Throughput estimate in Kb/s
+
+- **Per-channel statistics**: For each L2CAP channel within a
+ connection, the same packet/latency/size statistics.
+
+- **Latency plots**: If ``gnuplot`` is installed, ASCII-art latency
+ distribution plots are rendered in the terminal.
+
EXAMPLES
========
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ v1 5/5] doc/btmon: Add a section for automated trace analysis
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
` (2 preceding siblings ...)
2026-02-18 18:31 ` [PATCH BlueZ v1 4/5] doc/btmon: Add a dedicated section for analyze mode Luiz Augusto von Dentz
@ 2026-02-18 18:31 ` Luiz Augusto von Dentz
2026-02-18 19:48 ` [BlueZ,v1,1/5] doc/btmon: Add missing documentation bluez.test.bot
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-18 18:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds a section dedicated for automated trace analysis which can be
used for analysing traces programmatically or with use of AI assistance.
---
doc/btmon.rst | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/doc/btmon.rst b/doc/btmon.rst
index 66a97859a49e..70cdb90e37ab 100644
--- a/doc/btmon.rst
+++ b/doc/btmon.rst
@@ -740,6 +740,81 @@ Open the trace file with full date and time
$ btmon -T -r hcidump.log
+AUTOMATED TRACE ANALYSIS
+=========================
+
+This section provides guidance for analyzing btmon traces
+programmatically or with AI assistance.
+
+Recommended Workflow
+--------------------
+
+1. **Get an overview**: Start with ``btmon -a <file>`` to see packet
+ counts, connection handles, device addresses, and traffic volumes.
+
+2. **Decode with timestamps**: Use ``btmon -t -r <file> > output.txt``
+ to produce a text file with wall-clock timestamps for analysis.
+
+3. **Identify connections**: Search for connection establishment events
+ to build a handle-to-address mapping::
+
+ grep -n "Connection Complete\|Enhanced Connection Complete\|CIS Established" output.txt
+
+4. **Track disconnections**: Search for disconnect events and their
+ reasons::
+
+ grep -n "Disconnect Complete" output.txt
+
+ Then examine the lines following each match for the ``Reason:``
+ field.
+
+5. **Identify LE Audio**: Search for ASCS and CIS activity::
+
+ grep -n "ASE Control Point\|CIG Parameters\|Create Connected Isochronous\|CIS Established\|Setup ISO Data Path" output.txt
+
+6. **Check for errors**: Search for non-success status codes::
+
+ grep -n "Status:" output.txt | grep -v "Success"
+
+Key Patterns for Connection Lifecycle
+-------------------------------------
+
+A complete connection lifecycle for an LE ACL connection follows this
+pattern in the trace:
+
+1. ``LE Enhanced Connection Complete`` -- connection established,
+ note the Handle and Peer address
+2. ``LE Connection Update Complete`` -- connection parameters changed
+ (may occur zero or more times)
+3. ``Encryption Change`` -- link encrypted (may show encryption
+ algorithm)
+4. ACL Data with ATT/SMP/L2CAP -- service discovery and data exchange
+5. ``Disconnect Complete`` -- connection ended, check Reason field
+
+For LE Audio connections, additional steps appear between 3 and 5:
+
+- ATT operations on PACS/ASCS characteristics (codec negotiation)
+- ``LE Set CIG Parameters`` command and response
+- ``LE Create CIS`` command
+- ``LE CIS Established`` event (note the CIS handle)
+- ``LE Setup ISO Data Path`` command
+- ISO Data TX/RX (audio streaming)
+- ``Disconnect Complete`` on CIS handle (stream ended)
+- ``LE Remove CIG`` (group removed)
+
+Vendor-Specific Events
+----------------------
+
+Vendor-specific HCI events (event code 0xFF) contain
+controller-manufacturer diagnostic data. btmon decodes some vendor
+events for known manufacturers (Intel, Broadcom, etc.) but many
+sub-events show as ``Unknown`` with raw hex data. These are expected
+and generally not actionable without vendor documentation.
+
+Intel controllers emit extended telemetry events (subevent 0x8780)
+that include connection quality metrics, error counters, and firmware
+state. Partial decoding is available in ``monitor/intel.c``.
+
RESOURCES
=========
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [BlueZ,v1,1/5] doc/btmon: Add missing documentation
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
` (3 preceding siblings ...)
2026-02-18 18:31 ` [PATCH BlueZ v1 5/5] doc/btmon: Add a section for automated trace analysis Luiz Augusto von Dentz
@ 2026-02-18 19:48 ` bluez.test.bot
4 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2026-02-18 19:48 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1055296
---Test result---
Test Summary:
CheckPatch PENDING 0.49 seconds
GitLint PENDING 0.39 seconds
BuildEll PASS 20.88 seconds
BluezMake PASS 651.98 seconds
MakeCheck PASS 19.25 seconds
MakeDistcheck PASS 246.20 seconds
CheckValgrind PASS 297.28 seconds
CheckSmatch PASS 362.17 seconds
bluezmakeextell PASS 183.61 seconds
IncrementalBuild PENDING 0.56 seconds
ScanBuild PASS 1029.34 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-18 19:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 18:31 [PATCH BlueZ v1 1/5] doc/btmon: Add missing documentation Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 2/5] doc/btmon: Add dedicate sections for timestamp and frame number Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 3/5] doc/btmon: Add connection tracking section Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 4/5] doc/btmon: Add a dedicated section for analyze mode Luiz Augusto von Dentz
2026-02-18 18:31 ` [PATCH BlueZ v1 5/5] doc/btmon: Add a section for automated trace analysis Luiz Augusto von Dentz
2026-02-18 19:48 ` [BlueZ,v1,1/5] doc/btmon: Add missing documentation bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox