Skip to contentSkip to conversation

doc/btmon: Add missing documentation

PATCH Applied Luiz Augusto von Dentz 3 participants 14 messages Feb 20

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/12 doc/btmon: Add missing documentation

From: Luiz Augusto von Dentz <[email protected]>

This adds missing documentation for -I/--iso and -N/--no-time options.

---
 doc/btmon.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/btmon.rst +5 -0
index 11d98a93b4b0..e51001921ab1 100644
@@ -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.
Signature · 1 line
2.52.0
author maintainer
#1 lore raw

PATCH v2 2/12 doc/btmon: Add dedicate sections for timestamp and frame number

From: Luiz Augusto von Dentz <[email protected]>

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(+)
doc/btmon.rst +35 -0
index e51001921ab1..de05a5fcd6df 100644
@@ -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
 -----------------------
 
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH v2 3/12 doc/btmon: Add connection tracking section

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds connection tracking section which explains how connections and buffers are tracked.

---
 doc/btmon.rst | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
doc/btmon.rst +141 -0
index de05a5fcd6df..d93aa34a9412 100644
@@ -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
 ========
 
Signature · 1 line
2.52.0
author maintainer
#3 lore raw

PATCH v2 4/12 doc/btmon: Add a dedicated section for analyze mode

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds a dedicated section for analyze mode.

---
 doc/btmon.rst | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
doc/btmon.rst +37 -0
index d93aa34a9412..66a97859a49e 100644
@@ -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
 ========
 
Signature · 1 line
2.52.0
author maintainer
#4 lore raw

PATCH v2 5/12 doc/btmon: Add a section for automated trace analysis

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

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(+)
doc/btmon.rst +75 -0
index 66a97859a49e..70cdb90e37ab 100644
@@ -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
 =========
 
Signature · 1 line
2.52.0
author maintainer
#5 lore raw

PATCH v2 6/12 doc: add btsnoop protocol manpage

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Add manpage-style RST doc/btsnoop-protocol.rst and synchronize opcodes with src/shared/btsnoop.h.

---
 Makefile.am              |   7 +-
 doc/btsnoop-protocol.rst | 221 +++++++++++++++++++++++++++++++++++++++
 doc/btsnoop.txt          | 178 -------------------------------
 3 files changed, 225 insertions(+), 181 deletions(-)
 create mode 100644 doc/btsnoop-protocol.rst
 delete mode 100644 doc/btsnoop.txt
Makefile.am +4 -3
index 064ee91698e2..dee6aa6d0d9b 100644
@@ -367,7 +367,8 @@ CLEANFILES += $(builtin_files)
 
 if MANPAGES
 man_MANS += doc/bluetoothd.8
-man_MANS += doc/hci.7 doc/mgmt.7 doc/l2cap.7 doc/rfcomm.7 doc/sco.7 doc/iso.7
+man_MANS += doc/hci.7 doc/mgmt.7 doc/l2cap.7 doc/rfcomm.7 doc/sco.7 doc/iso.7 \
+		doc/btsnoop.7
 man_MANS += doc/org.bluez.Adapter.5 doc/org.bluez.Device.5 \
 		doc/org.bluez.Bearer.LE.5 doc/org.bluez.Bearer.BREDR.5 \
 		doc/org.bluez.DeviceSet.5 doc/org.bluez.AgentManager.5 \
@@ -407,7 +408,7 @@ man_MANS += doc/org.bluez.ThermometerManager.5 \
 endif
 manual_pages += doc/bluetoothd.8
 manual_pages += doc/hci.7 doc/mgmt.7 doc/l2cap.7 doc/rfcomm.7 doc/sco.7 \
-		doc/iso.7
+		doc/iso.7 doc/btsnoop.7
 manual_pages += doc/org.bluez.Adapter.5 doc/org.bluez.Device.5 \
 		doc/org.bluez.Bearer.LE.5 doc/org.bluez.Bearer.BREDR.5 \
 		doc/org.bluez.DeviceSet.5 doc/org.bluez.AgentManager.5 \
@@ -535,7 +536,7 @@ EXTRA_DIST += doc/org.bluez.ThermometerManager.rst \
 EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \
 		doc/pts-opp.txt
 
-EXTRA_DIST += doc/btsnoop.txt
+EXTRA_DIST += doc/btsnoop-protocol.rst
 
 EXTRA_DIST += tools/magic.btsnoop
 
doc/btsnoop-protocol.rst new file +221 -0

221 lines not on this page · raw message

doc/btsnoop.txt deleted +0 -178

178 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#6 lore raw

PATCH v2 7/12 doc/btmon: Add reference to btsnoop documention

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds SEE ALSO section mentioning btsnoop documentation.

---
 doc/btmon.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/btmon.rst +5 -0
index 70cdb90e37ab..c1616318a004 100644
@@ -824,3 +824,8 @@ REPORTING BUGS
 ==============
 
 [email protected]
+
+SEE ALSO
+========
+
+btsnoop(7)
Signature · 1 line
2.52.0
author maintainer
#7 lore raw

PATCH v2 8/12 monitor: Annotate ACL/SCO/ISO data with device address

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Add the remote device address to ACL, SCO and ISO data packet output so each data packet line shows which device it belongs to. This makes it much easier to follow multi-device traces without having to cross-reference handle numbers with earlier connection events:

< ACL Data TX: Handle 2048 [1/6] [42:96:D7:49:78:CC (Resolvable)] flags 0x00 dlen 7
ATT: Exchange MTU Request (0x02) len 2
Client RX MTU: 527

Quoted 1 line

ACL Data RX: Handle 256 [20:32:C6:09:FF:6C (Apple, Inc.)] flags 0x02 dlen 16

      L2CAP: Connection Response (0x03) ident 33 len 8
        Destination CID: 17169
        Source CID: 64
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)

Also fix the connection lookup in packet_hci_acldata() to use acl_handle() to mask off the flags bits, matching what assign_handle() stores.

---
 monitor/packet.c | 92 +++++++++++++++++++++++++++++++++++++++++++++---
 monitor/packet.h |  4 +++
 2 files changed, 92 insertions(+), 4 deletions(-)
monitor/packet.c +88 -4
index 3ba33f8f3afa..b8a48bb549af 100644
@@ -322,6 +322,43 @@ static void assign_handle(uint16_t index, uint16_t handle, uint8_t type,
 		memcpy(conn->dst, dst, sizeof(conn->dst));
 		conn->dst_type = dst_type;
 	}
+
+	switch (conn->dst_type) {
+	case 0x00:
+	case 0x02:
+		/* If address public set dst_oui */
+		hwdb_get_company(conn->dst, &conn->dst_oui);
+		break;
+	case 0x01:
+	case 0x03:
+		/* Attempt to resolve the identity if resolvable */
+		if ((conn->dst[5] & 0xc0) == 0x40) {
+			keys_resolve_identity(conn->dst, conn->dst,
+						&conn->dst_type);
+			/* If identity address is public set dst_out */
+			if (conn->dst_type == 0x00 || conn->dst_type == 0x02) {
+				hwdb_get_company(conn->dst, &conn->dst_oui);
+				break;
+			}
+		}
+
+		/* Set the random type */
+		switch ((conn->dst[5] & 0xc0) >> 6) {
+		case 0x00:
+			conn->dst_rtype = strdup("Non-Resolvable");
+			break;
+		case 0x01:
+			conn->dst_rtype = strdup("Resolvable");
+			break;
+		case 0x03:
+			conn->dst_rtype = strdup("Static");
+			break;
+		default:
+			conn->dst_rtype = strdup("Reserved");
+			break;
+		}
+		break;
+	}
 }
 
 struct packet_conn_data *packet_get_conn_data(uint16_t handle)
@@ -329,7 +366,7 @@ struct packet_conn_data *packet_get_conn_data(uint16_t handle)
 	int i;
 
 	for (i = 0; i < MAX_CONN; i++) {
-		if (conn_list[i].handle == handle)
+		if (conn_list[i].handle == acl_handle(handle))
 			return &conn_list[i];
 	}
 
@@ -14047,6 +14084,43 @@ static void packet_enqueue_tx(struct timeval *tv, uint16_t handle,
 	queue_push_tail(conn->tx_q, frame);
 }
 
+static void handle_str_append_addr(char *handle_str,
+					struct packet_conn_data *conn)
+{
+	if (!conn)
+		return;
+
+	switch (conn->dst_type) {
+	case 0x00:
+	case 0x02:
+		if (conn->dst_oui) {
+			sprintf(handle_str + strlen(handle_str),
+				" [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X (%.16s)]",
+				conn->dst[5], conn->dst[4], conn->dst[3],
+				conn->dst[2], conn->dst[1], conn->dst[0],
+				conn->dst_oui);
+			return;
+		}
+		break;
+	case 0x01:
+	case 0x03:
+		if (conn->dst_rtype) {
+			sprintf(handle_str + strlen(handle_str),
+				" [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X (%.16s)]",
+				conn->dst[5], conn->dst[4], conn->dst[3],
+				conn->dst[2], conn->dst[1], conn->dst[0],
+				conn->dst_rtype);
+			return;
+		}
+		break;
+	}
+
+	sprintf(handle_str + strlen(handle_str),
+			" [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
+			conn->dst[5], conn->dst[4], conn->dst[3],
+			conn->dst[2], conn->dst[1], conn->dst[0]);
+}
+
 void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
 				bool in, const void *data, uint16_t size)
 {
@@ -14054,7 +14128,7 @@ void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint16_t dlen = le16_to_cpu(hdr->dlen);
 	uint8_t flags = acl_flags(handle);
-	char handle_str[22], extra_str[32];
+	char handle_str[58], extra_str[32];
 	struct packet_conn_data *conn;
 	struct index_buf_pool *pool = &index_list[index].acl;
 
@@ -14089,6 +14163,8 @@ void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	else
 		sprintf(handle_str, "Handle %d", acl_handle(handle));
 
+	handle_str_append_addr(handle_str, conn);
+
 	sprintf(extra_str, "flags 0x%2.2x dlen %d", flags, dlen);
 
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_ACLDATA,
@@ -14118,7 +14194,8 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	const hci_sco_hdr *hdr = data;
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint8_t flags = acl_flags(handle);
-	char handle_str[22], extra_str[32];
+	char handle_str[42], extra_str[32];
+	struct packet_conn_data *conn;
 
 	if (index >= MAX_INDEX) {
 		print_field("Invalid index (%d).", index);
@@ -14140,6 +14217,7 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 
 	data += HCI_SCO_HDR_SIZE;
 	size -= HCI_SCO_HDR_SIZE;
+	conn = packet_get_conn_data(handle);
 
 	if (index_list[index].sco.total && !in)
 		sprintf(handle_str, "Handle %d [%u/%u]", acl_handle(handle),
@@ -14147,6 +14225,8 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	else
 		sprintf(handle_str, "Handle %d", acl_handle(handle));
 
+	handle_str_append_addr(handle_str, conn);
+
 	sprintf(extra_str, "flags 0x%2.2x dlen %d", flags, hdr->dlen);
 
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_SCODATA,
@@ -14175,8 +14255,9 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	const struct bt_hci_iso_data_start *start;
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint8_t flags = acl_flags(handle);
-	char handle_str[36], extra_str[50], ts_str[16] = { 0 };
+	char handle_str[56], extra_str[50], ts_str[16] = { 0 };
 	struct index_buf_pool *pool = &index_list[index].iso;
+	struct packet_conn_data *conn;
 	size_t ts_size = 0;
 
 	if (index >= MAX_INDEX) {
@@ -14206,6 +14287,7 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	}
 
 	start = data;
+	conn = packet_get_conn_data(handle);
 
 	if (!in && pool->total)
 		sprintf(handle_str, "Handle %d [%u/%u] SN %u",
@@ -14214,6 +14296,8 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 		sprintf(handle_str, "Handle %u SN %u", acl_handle(handle),
 			start->sn);
 
+	handle_str_append_addr(handle_str, conn);
+
 	sprintf(extra_str, "flags 0x%2.2x dlen %u slen %u%s", flags, hdr->dlen,
 							start->slen, ts_str);
 
monitor/packet.h +4 -0
index 2990b795bd3e..f6547ec9b594 100644
@@ -47,6 +47,10 @@ struct packet_conn_data {
 	uint8_t  type;
 	uint8_t  dst[6];
 	uint8_t  dst_type;
+	union {
+		char *dst_oui;
+		char *dst_rtype;
+	};
 	struct queue *tx_q;
 	struct queue *chan_q;
 	struct packet_latency tx_l;
Signature · 1 line
2.52.0
author maintainer
#8 lore raw

PATCH v2 9/12 monitor: Print connection type in Disconnect Complete

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Print the connection type (BR-ACL, LE-ACL, BR-SCO, BR-ESCO, LE-CIS, LE-BIS) alongside the handle in Disconnect Complete events so the type of link being torn down is immediately visible without cross-referencing earlier connection events:

Quoted 1 line

HCI Event: Disconnect Complete (0x05) plen 4

        Status: Success (0x00)
        Handle: 2050 (LE-ACL) Address: 6A:59:B2:90:5E:AB (Resolvable)
        Reason: Remote User Terminated Connection (0x13)
Quoted 1 line

HCI Event: Disconnect Complete (0x05) plen 4

        Status: Success (0x00)
        Handle: 2304 (LE-CIS) Address: 65:0D:7B:2F:D6:E7 (Resolvable)
        Reason: Connection Terminated By Local Host (0x16)
---
 monitor/analyze.c | 53 +++++++++++++++++++++++-------------------
 monitor/packet.c  | 59 ++++++++++++++++++++++++++++++++++-------------
 monitor/packet.h  |  9 ++++++++
 3 files changed, 81 insertions(+), 40 deletions(-)
monitor/analyze.c +29 -24
index 268ea10e29e6..2cf42f903b61 100644
@@ -53,12 +53,6 @@ struct hci_dev {
 	struct queue *conn_list;
 };
 
-#define CONN_BR_ACL	0x01
-#define CONN_BR_SCO	0x02
-#define CONN_BR_ESCO	0x03
-#define CONN_LE_ACL	0x04
-#define CONN_LE_ISO	0x05
-
 struct hci_stats {
 	size_t bytes;
 	size_t num;
@@ -223,20 +217,23 @@ static void conn_destroy(void *data)
 	const char *str;
 
 	switch (conn->type) {
-	case CONN_BR_ACL:
+	case BTMON_CONN_ACL:
 		str = "BR-ACL";
 		break;
-	case CONN_BR_SCO:
+	case BTMON_CONN_LE:
 		str = "BR-SCO";
 		break;
-	case CONN_BR_ESCO:
+	case BTMON_CONN_SCO:
 		str = "BR-ESCO";
 		break;
-	case CONN_LE_ACL:
+	case BTMON_CONN_ESCO:
 		str = "LE-ACL";
 		break;
-	case CONN_LE_ISO:
-		str = "LE-ISO";
+	case BTMON_CONN_CIS:
+		str = "LE-CIS";
+		break;
+	case BTMON_CONN_BIS:
+		str = "LE-BIS";
 		break;
 	default:
 		str = "unknown";
@@ -476,7 +473,7 @@ static void evt_conn_complete(struct hci_dev *dev, struct timeval *tv,
 	if (evt->status)
 		return;
 
-	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), CONN_BR_ACL);
+	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), BTMON_CONN_ACL);
 	if (!conn)
 		return;
 
@@ -567,7 +564,7 @@ static void evt_le_conn_complete(struct hci_dev *dev, struct timeval *tv,
 	if (!evt || evt->status)
 		return;
 
-	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), CONN_LE_ACL);
+	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), BTMON_CONN_LE);
 	if (!conn)
 		return;
 
@@ -585,7 +582,7 @@ static void evt_le_enh_conn_complete(struct hci_dev *dev, struct timeval *tv,
 	if (!evt || evt->status)
 		return;
 
-	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), CONN_LE_ACL);
+	conn = conn_lookup_type(dev, le16_to_cpu(evt->handle), BTMON_CONN_LE);
 	if (!conn)
 		return;
 
@@ -670,7 +667,7 @@ static void evt_le_cis_established(struct hci_dev *dev, struct timeval *tv,
 		return;
 
 	conn = conn_lookup_type(dev, le16_to_cpu(evt->conn_handle),
-						CONN_LE_ISO);
+						BTMON_CONN_CIS);
 	if (!conn)
 		return;
 
@@ -715,7 +712,7 @@ static void evt_le_big_complete(struct hci_dev *dev, struct timeval *tv,
 		if (!util_iov_pull_le16(iov, &handle))
 			return;
 
-		conn = conn_lookup_type(dev, handle, CONN_LE_ISO);
+		conn = conn_lookup_type(dev, handle, BTMON_CONN_BIS);
 		if (conn)
 			conn->setup_seen = true;
 	}
@@ -738,7 +735,7 @@ static void evt_le_big_sync_established(struct hci_dev *dev, struct timeval *tv,
 		if (!util_iov_pull_le16(iov, &handle))
 			return;
 
-		conn = conn_lookup_type(dev, handle, CONN_LE_ISO);
+		conn = conn_lookup_type(dev, handle, BTMON_CONN_BIS);
 		if (conn)
 			conn->setup_seen = true;
 	}
@@ -928,9 +925,13 @@ static void sco_pkt(struct timeval *tv, uint16_t index, bool out,
 	dev->num_sco++;
 
 	conn = conn_lookup_type(dev, le16_to_cpu(hdr->handle) & 0x0fff,
-								CONN_BR_SCO);
-	if (!conn)
-		return;
+							BTMON_CONN_SCO);
+	if (!conn) {
+		conn = conn_lookup_type(dev, le16_to_cpu(hdr->handle) & 0x0fff,
+							BTMON_CONN_ESCO);
+		if (!conn)
+			return;
+	}
 
 	if (out) {
 		conn_pkt_tx(conn, tv, size - sizeof(*hdr), NULL);
@@ -1015,9 +1016,13 @@ static void iso_pkt(struct timeval *tv, uint16_t index, bool out,
 	dev->num_iso++;
 
 	conn = conn_lookup_type(dev, le16_to_cpu(hdr->handle) & 0x0fff,
-								CONN_LE_ISO);
-	if (!conn)
-		return;
+							BTMON_CONN_CIS);
+	if (!conn) {
+		conn = conn_lookup_type(dev, le16_to_cpu(hdr->handle) & 0x0fff,
+							BTMON_CONN_BIS);
+		if (!conn)
+			return;
+	}
 
 	if (out) {
 		conn_pkt_tx(conn, tv, size - sizeof(*hdr), NULL);
monitor/packet.c +43 -16

131 lines not on this page · raw message

monitor/packet.h +9 -0
index f6547ec9b594..38f3f5514dba 100644
@@ -39,6 +39,15 @@ struct packet_frame {
 	size_t len;
 };
 
+enum {
+	BTMON_CONN_ACL = 0x00,
+	BTMON_CONN_LE,
+	BTMON_CONN_SCO,
+	BTMON_CONN_ESCO,
+	BTMON_CONN_CIS,
+	BTMON_CONN_BIS
+};
+
 struct packet_conn_data {
 	uint16_t index;
 	uint8_t  src[6];
Signature · 1 line
2.52.0
author maintainer
#9 lore raw

PATCH v2 10/12 monitor: Add connection lifecycle to analyze summary

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Record the frame number at connection and disconnection time for each connection. Print the connected and disconnected frame numbers in the per-connection summary produced by analyze mode so that users can cross-reference with the btmon trace output:

Found LE-ACL connection with handle 2051

        Address: 66:B0:26:F1:D3:BC (Resolvable)
        RX packets: 48/48
        RX Latency: 1-7604 msec (~74 msec)
        RX size: 5-51 octets (~13 octets)
        RX speed: ~0 Kb/s
        TX packets: 39/37
        TX Latency: 12-426 msec (~43 msec)
        TX size: 5-97 octets (~15 octets)
        TX speed: ~1 Kb/s
        Connected: #52044
        Disconnected: #53069
        Disconnect Reason: 0x08

Also fix the TODO in conn_destroy() that was passing a hardcoded 0x00 address type by using the stored bdaddr_type from the LE connection complete events.

---
 monitor/analyze.c | 73 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 59 insertions(+), 14 deletions(-)
monitor/analyze.c +59 -14
index 2cf42f903b61..1db1e7898132 100644
@@ -68,8 +68,12 @@ struct hci_conn {
 	uint16_t link;
 	uint8_t type;
 	uint8_t bdaddr[6];
+	uint8_t bdaddr_type;
 	bool setup_seen;
 	bool terminated;
+	uint8_t disconnect_reason;
+	unsigned long frame_connected;
+	unsigned long frame_disconnected;
 	struct queue *tx_queue;
 	struct timeval last_rx;
 	struct queue *chan_list;
@@ -241,13 +245,22 @@ static void conn_destroy(void *data)
 	}
 
 	printf("  Found %s connection with handle %u\n", str, conn->handle);
-	/* TODO: Store address type */
-	packet_print_addr("Address", conn->bdaddr, 0x00);
+	packet_print_addr("Address", conn->bdaddr, conn->bdaddr_type);
 	if (!conn->setup_seen)
 		print_field("Connection setup missing");
 	print_stats(&conn->rx, "RX");
 	print_stats(&conn->tx, "TX");
 
+	if (conn->setup_seen) {
+		print_field("Connected: #%lu", conn->frame_connected);
+		if (conn->terminated) {
+			print_field("Disconnected: #%lu",
+					conn->frame_disconnected);
+			print_field("Disconnect Reason: 0x%02x",
+						conn->disconnect_reason);
+		}
+	}
+
 	queue_destroy(conn->rx.plot, free);
 	queue_destroy(conn->tx.plot, free);
 	queue_destroy(conn->chan_list, chan_destroy);
@@ -465,6 +478,7 @@ static void command_pkt(struct timeval *tv, uint16_t index,
 }
 
 static void evt_conn_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					const void *data, uint16_t size)
 {
 	const struct bt_hci_evt_conn_complete *evt = data;
@@ -478,10 +492,12 @@ static void evt_conn_complete(struct hci_dev *dev, struct timeval *tv,
 		return;
 
 	memcpy(conn->bdaddr, evt->bdaddr, 6);
+	conn->frame_connected = frame;
 	conn->setup_seen = true;
 }
 
 static void evt_disconnect_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					const void *data, uint16_t size)
 {
 	const struct bt_hci_evt_disconnect_complete *evt = data;
@@ -494,6 +510,8 @@ static void evt_disconnect_complete(struct hci_dev *dev, struct timeval *tv,
 	if (!conn)
 		return;
 
+	conn->frame_disconnected = frame;
+	conn->disconnect_reason = evt->reason;
 	conn->terminated = true;
 }
 
@@ -555,6 +573,7 @@ static void plot_add(struct queue *queue, struct timeval *latency,
 }
 
 static void evt_le_conn_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					struct iovec *iov)
 {
 	const struct bt_hci_evt_le_conn_complete *evt;
@@ -569,10 +588,13 @@ static void evt_le_conn_complete(struct hci_dev *dev, struct timeval *tv,
 		return;
 
 	memcpy(conn->bdaddr, evt->peer_addr, 6);
+	conn->bdaddr_type = evt->peer_addr_type;
+	conn->frame_connected = frame;
 	conn->setup_seen = true;
 }
 
 static void evt_le_enh_conn_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					struct iovec *iov)
 {
 	const struct bt_hci_evt_le_enhanced_conn_complete *evt;
@@ -587,6 +609,8 @@ static void evt_le_enh_conn_complete(struct hci_dev *dev, struct timeval *tv,
 		return;
 
 	memcpy(conn->bdaddr, evt->peer_addr, 6);
+	conn->bdaddr_type = evt->peer_addr_type;
+	conn->frame_connected = frame;
 	conn->setup_seen = true;
 }
 
@@ -640,6 +664,7 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv,
 }
 
 static void evt_sync_conn_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					const void *data, uint16_t size)
 {
 	const struct bt_hci_evt_sync_conn_complete *evt = data;
@@ -653,10 +678,12 @@ static void evt_sync_conn_complete(struct hci_dev *dev, struct timeval *tv,
 		return;
 
 	memcpy(conn->bdaddr, evt->bdaddr, 6);
+	conn->frame_connected = frame;
 	conn->setup_seen = true;
 }
 
 static void evt_le_cis_established(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					struct iovec *iov)
 {
 	const struct bt_hci_evt_le_cis_established *evt;
@@ -671,6 +698,7 @@ static void evt_le_cis_established(struct hci_dev *dev, struct timeval *tv,
 	if (!conn)
 		return;
 
+	conn->frame_connected = frame;
 	conn->setup_seen = true;
 
 	link = link_lookup(dev, conn->handle);
@@ -696,6 +724,7 @@ static void evt_le_cis_req(struct hci_dev *dev, struct timeval *tv,
 }
 
 static void evt_le_big_complete(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					struct iovec *iov)
 {
 	const struct bt_hci_evt_le_big_complete *evt;
@@ -713,12 +742,15 @@ static void evt_le_big_complete(struct hci_dev *dev, struct timeval *tv,
 			return;
 
 		conn = conn_lookup_type(dev, handle, BTMON_CONN_BIS);
-		if (conn)
+		if (conn) {
 			conn->setup_seen = true;
+			conn->frame_connected = frame;
+		}
 	}
 }
 
 static void evt_le_big_sync_established(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					struct iovec *iov)
 {
 	const struct bt_hci_evt_le_big_sync_estabilished *evt;
@@ -736,12 +768,15 @@ static void evt_le_big_sync_established(struct hci_dev *dev, struct timeval *tv,
 			return;
 
 		conn = conn_lookup_type(dev, handle, BTMON_CONN_BIS);
-		if (conn)
+		if (conn) {
 			conn->setup_seen = true;
+			conn->frame_connected = frame;
+		}
 	}
 }
 
 static void evt_le_meta_event(struct hci_dev *dev, struct timeval *tv,
+					unsigned long frame,
 					const void *data, uint16_t size)
 {
 	struct iovec iov = {
@@ -755,27 +790,28 @@ static void evt_le_meta_event(struct hci_dev *dev, struct timeval *tv,
 
 	switch (subevt) {
 	case BT_HCI_EVT_LE_CONN_COMPLETE:
-		evt_le_conn_complete(dev, tv, &iov);
+		evt_le_conn_complete(dev, tv, frame, &iov);
 		break;
 	case BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE:
-		evt_le_enh_conn_complete(dev, tv, &iov);
+		evt_le_enh_conn_complete(dev, tv, frame, &iov);
 		break;
 	case BT_HCI_EVT_LE_CIS_ESTABLISHED:
-		evt_le_cis_established(dev, tv, &iov);
+		evt_le_cis_established(dev, tv, frame, &iov);
 		break;
 	case BT_HCI_EVT_LE_CIS_REQ:
 		evt_le_cis_req(dev, tv, &iov);
 		break;
 	case BT_HCI_EVT_LE_BIG_COMPLETE:
-		evt_le_big_complete(dev, tv, &iov);
+		evt_le_big_complete(dev, tv, frame, &iov);
 		break;
 	case BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED:
-		evt_le_big_sync_established(dev, tv, &iov);
+		evt_le_big_sync_established(dev, tv, frame, &iov);
 		break;
 	}
 }
 
 static void event_pkt(struct timeval *tv, uint16_t index,
+					unsigned long frame,
 					const void *data, uint16_t size)
 {
 	const struct bt_hci_evt_hdr *hdr = data;
@@ -793,10 +829,10 @@ static void event_pkt(struct timeval *tv, uint16_t index,
 
 	switch (hdr->evt) {
 	case BT_HCI_EVT_CONN_COMPLETE:
-		evt_conn_complete(dev, tv, data, size);
+		evt_conn_complete(dev, tv, frame, data, size);
 		break;
 	case BT_HCI_EVT_DISCONNECT_COMPLETE:
-		evt_disconnect_complete(dev, tv, data, size);
+		evt_disconnect_complete(dev, tv, frame, data, size);
 		break;
 	case BT_HCI_EVT_CMD_COMPLETE:
 		evt_cmd_complete(dev, tv, data, size);
@@ -805,10 +841,10 @@ static void event_pkt(struct timeval *tv, uint16_t index,
 		evt_num_completed_packets(dev, tv, data, size);
 		break;
 	case BT_HCI_EVT_SYNC_CONN_COMPLETE:
-		evt_sync_conn_complete(dev, tv, data, size);
+		evt_sync_conn_complete(dev, tv, frame, data, size);
 		break;
 	case BT_HCI_EVT_LE_META_EVENT:
-		evt_le_meta_event(dev, tv, data, size);
+		evt_le_meta_event(dev, tv, frame, data, size);
 		break;
 	}
 }
@@ -1047,6 +1083,7 @@ void analyze_trace(const char *path)
 {
 	struct btsnoop *btsnoop_file;
 	unsigned long num_packets = 0;
+	unsigned long num_frames = 0;
 	uint32_t format;
 
 	btsnoop_file = btsnoop_open(path, BTSNOOP_FLAG_PKLG_SUPPORT);
@@ -1084,21 +1121,27 @@ void analyze_trace(const char *path)
 			del_index(&tv, index, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_COMMAND_PKT:
+			num_frames++;
 			command_pkt(&tv, index, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_EVENT_PKT:
-			event_pkt(&tv, index, buf, pktlen);
+			num_frames++;
+			event_pkt(&tv, index, num_frames, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_ACL_TX_PKT:
+			num_frames++;
 			acl_pkt(&tv, index, true, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_ACL_RX_PKT:
+			num_frames++;
 			acl_pkt(&tv, index, false, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_SCO_TX_PKT:
+			num_frames++;
 			sco_pkt(&tv, index, true, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_SCO_RX_PKT:
+			num_frames++;
 			sco_pkt(&tv, index, false, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_OPEN_INDEX:
@@ -1123,9 +1166,11 @@ void analyze_trace(const char *path)
 			ctrl_msg(&tv, index, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_ISO_TX_PKT:
+			num_frames++;
 			iso_pkt(&tv, index, true, buf, pktlen);
 			break;
 		case BTSNOOP_OPCODE_ISO_RX_PKT:
+			num_frames++;
 			iso_pkt(&tv, index, false, buf, pktlen);
 			break;
 		default:
Signature · 1 line
2.52.0
author maintainer
#10 lore raw

PATCH v2 11/12 monitor: Prefix data packets with proper type

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This attemps to prefix data packets using conn_type_str so it properly differentiate BR and LE bearers and CIS from BIS and also eliminate "Data TX/RX" labels as they are implicit from the direction marker:

< LE-CIS: Handle 2304 [8/8] SN 15 ...

Quoted 1 line

LE-ACL: Handle 2048 ...

---
 monitor/packet.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
monitor/packet.c +21 -6
index a4930c855144..fbe773ffbdfe 100644
@@ -14155,6 +14155,7 @@ void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint16_t dlen = le16_to_cpu(hdr->dlen);
 	uint8_t flags = acl_flags(handle);
+	char label[8];
 	char handle_str[58], extra_str[32];
 	struct packet_conn_data *conn;
 	struct index_buf_pool *pool = &index_list[index].acl;
@@ -14194,9 +14195,13 @@ void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
 
 	sprintf(extra_str, "flags 0x%2.2x dlen %d", flags, dlen);
 
+	if (conn)
+		sprintf(label, "%s", conn_type_str(conn->type));
+	else
+		sprintf(label, "ACL");
+
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_ACLDATA,
-				in ? "ACL Data RX" : "ACL Data TX",
-						handle_str, extra_str);
+				label, handle_str, extra_str);
 
 	if (!in)
 		packet_enqueue_tx(tv, acl_handle(handle),
@@ -14221,6 +14226,7 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	const hci_sco_hdr *hdr = data;
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint8_t flags = acl_flags(handle);
+	char label[8];
 	char handle_str[42], extra_str[32];
 	struct packet_conn_data *conn;
 
@@ -14256,9 +14262,13 @@ void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 
 	sprintf(extra_str, "flags 0x%2.2x dlen %d", flags, hdr->dlen);
 
+	if (conn)
+		sprintf(label, "%s", conn_type_str(conn->type));
+	else
+		sprintf(label, "SCO");
+
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_SCODATA,
-				in ? "SCO Data RX" : "SCO Data TX",
-						handle_str, extra_str);
+				label, handle_str, extra_str);
 
 	if (!in)
 		packet_enqueue_tx(tv, acl_handle(handle),
@@ -14282,6 +14292,7 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	const struct bt_hci_iso_data_start *start;
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint8_t flags = acl_flags(handle);
+	char label[8];
 	char handle_str[56], extra_str[50], ts_str[16] = { 0 };
 	struct index_buf_pool *pool = &index_list[index].iso;
 	struct packet_conn_data *conn;
@@ -14328,9 +14339,13 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	sprintf(extra_str, "flags 0x%2.2x dlen %u slen %u%s", flags, hdr->dlen,
 							start->slen, ts_str);
 
+	if (conn)
+		sprintf(label, "%s", conn_type_str(conn->type));
+	else
+		sprintf(label, "ISO");
+
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_ISODATA,
-				in ? "ISO Data RX" : "ISO Data TX",
-						handle_str, extra_str);
+				label, handle_str, extra_str);
 
 	if (!in)
 		packet_enqueue_tx(tv, acl_handle(handle),
Signature · 1 line
2.52.0
author maintainer
#11 lore raw

PATCH v2 12/12 doc/btmon: Update documentation to reflect lastest changes

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This update the diagram showing where each information is displayed to include the connection type and peer address.

---
 doc/btmon.rst | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
doc/btmon.rst +18 -15
index c1616318a004..e1e362b7c1b6 100644
@@ -255,23 +255,26 @@ completes and the result status.
 
 **ACL Data** shows data plane traffic with handle and protocol decoding::
 
-    < ACL Data TX: Handle 2048 [1.. flags 0x00 dlen 16  #493 [hci0] 12:36:18.977915
-    │              │              │            │          │    │       │
-    │              │              │            │          │    │       └─ Timestamp
-    │              │              │            │          │    └─ Controller
-    │              │              │            │          └─ Frame number
-    │              │              │            └─ Data length
-    │              │              └─ Fragment info / flags
-    │              └─ Connection handle
-    └─ Direction: TX = outgoing, RX = incoming
+    < LE-ACL: Handle 2048 [66:B0:26:F1:D3:BC] [1/6] flags 0x00 dlen 16  #493 [hci0] 12:36:18.977915
+    │   │            │     │                   │          │         │    │    │     │
+    │   │            │     │                   │          │         │    │    │     └─ Timestamp
+    │   │            │     │                   │          │         │    │    └─ Controller
+    │   │            │     │                   │          │         │    └─ Frame number
+    │   │            │     │                   │          │         └─ Data length
+    │   │            │     │                   │          └─ flags
+    │   │            │     │                   └─ Buffer tracking (optional)
+    │   │            │     └─ Peer address (optional)
+    │   │            └─ Handle number
+    │   └─ Connection-type-aware label (e.g. BR-ACL, LE-ACL, BR-SCO, LE-ISO)
+    └─ Direction marker: '<' = host->controller (TX), '>' = controller->host (RX)
 
 ACL data is automatically decoded into higher-layer protocols::
 
-    < ACL Data TX: Handle 2048 [2/6] flags 0x00 dlen 7  #494 [hci0] 12:36:18.978488
+    < LE-ACL: Handle 2048 [2/6] flags 0x00 dlen 7  #494 [hci0] 12:36:18.978488
           ATT: Exchange MTU Request (0x02) len 2
             Client RX MTU: 517
 
-    > ACL Data RX: Handle 2048 flags 0x02 dlen 11       #497 [hci0] 12:36:19.000048
+    > LE-ACL: Handle 2048 flags 0x02 dlen 11       #497 [hci0] 12:36:19.000048
           SMP: Pairing Request (0x01) len 6
             IO capability: NoInputNoOutput (0x03)
             OOB data: Authentication data not present (0x00)
@@ -435,7 +438,7 @@ frame. The indentation level indicates the protocol layer:
 
 Example of protocol layering in ACL data::
 
-    > ACL Data RX: Handle 2048 flags 0x02 dlen 11       #497 [hci0] 12:36:19.000048
+    > ACL: Handle 2048 flags 0x02 dlen 11       #497 [hci0] 12:36:19.000048
           SMP: Pairing Request (0x01) len 6                          ← L2CAP/SMP layer
             IO capability: NoInputNoOutput (0x03)                    ← SMP fields
             OOB data: Authentication data not present (0x00)
@@ -520,9 +523,9 @@ MGMT Command Complete event back to bluetoothd.
             Peer address: AA:BB:CC:DD:EE:FF (OUI Company)
     @ MGMT Event: Device Connec.. (0x000b) plen 13  {0x0001} [hci0] 12:36:18.974319
     = bluetoothd: src/adapter.c:connected_callback() hci0 devic..   12:36:18.975307
-    < ACL Data TX: Handle 2048 [1.. flags 0x00 dlen 16  #493 [hci0] 12:36:18.977915
+    < ACL: Handle 2048 [1.. flags 0x00 dlen 16  #493 [hci0] 12:36:18.977915
           LE L2CAP: Connection Parameter Update Request (0x12) ident 1 len 8
-    < ACL Data TX: Handle 2048 [2/6] flags 0x00 dlen 7  #494 [hci0] 12:36:18.978488
+    < ACL: Handle 2048 [2/6] flags 0x00 dlen 7  #494 [hci0] 12:36:18.978488
           ATT: Exchange MTU Request (0x02) len 2
             Client RX MTU: 517
 
@@ -579,7 +582,7 @@ Controller Buffer Tracking
 
 Buffer tracking may show a indicator in square brackets::
 
-    < ACL Data TX: Handle 2048 [1/6] flags 0x00 dlen 16
+    < ACL: 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
Signature · 1 line
2.52.0
#12 lore raw
In reply to Luiz Augusto von Dentz

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=1055976

---Test result---

Test Summary:

CheckPatch                    PENDING   0.39 seconds
GitLint                       PENDING   0.34 seconds
BuildEll                      PASS      20.66 seconds
BluezMake                     PASS      652.64 seconds
MakeCheck                     PASS      18.11 seconds
MakeDistcheck                 PASS      242.90 seconds
CheckValgrind                 PASS      301.09 seconds
CheckSmatch                   WARNING   352.89 seconds
bluezmakeextell               PASS      181.43 seconds
IncrementalBuild              PENDING   0.34 seconds
ScanBuild                     PASS      1012.95 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c:1993:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresmonitor/bt.h:3854:40: warning: array of flexible structuresmonitor/packet.c:1993:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresmonitor/bt.h:3854:40: warning: array of flexible structuresmonitor/packet.c:1993:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresmonitor/bt.h:3854:40: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

---
Regards,
Linux Bluetooth

#13 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 6 lines · On Fri, 20 Feb 2026 12:31:05 -0500 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This adds missing documentation for -I/--iso and -N/--no-time options.

---
 doc/btmon.rst | 5 +++++
 1 file changed, 5 insertions(+)

Here is the summary with links:
- [BlueZ,v2,01/12] doc/btmon: Add missing documentation

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5958e4492990
  - [BlueZ,v2,02/12] doc/btmon: Add dedicate sections for timestamp and frame number
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=36197cc3965d
  - [BlueZ,v2,03/12] doc/btmon: Add connection tracking section
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3ddbc4f499c6
  - [BlueZ,v2,04/12] doc/btmon: Add a dedicated section for analyze mode
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c25a8de27137
  - [BlueZ,v2,05/12] doc/btmon: Add a section for automated trace analysis
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=197f1d2a86c1
  - [BlueZ,v2,06/12] doc: add btsnoop protocol manpage
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=076e705fdb52
  - [BlueZ,v2,07/12] doc/btmon: Add reference to btsnoop documention
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=791a7bb024c1
  - [BlueZ,v2,08/12] monitor: Annotate ACL/SCO/ISO data with device address
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=611f84a0ff0e
  - [BlueZ,v2,09/12] monitor: Print connection type in Disconnect Complete
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8157e2fde5d3
  - [BlueZ,v2,10/12] monitor: Add connection lifecycle to analyze summary
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=13cf50b6607e
  - [BlueZ,v2,11/12] monitor: Prefix data packets with proper type
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=25ba1ab49f34
  - [BlueZ,v2,12/12] doc/btmon: Update documentation to reflect lastest changes
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d84a8fb8db97

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html