Linux bluetooth development
 help / color / mirror / Atom feed
From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ v3 6/9] monitor: Fix LE PAST Received decoding
Date: Thu, 19 Nov 2026 09:16:18 +0100	[thread overview]
Message-ID: <20261119081621.112623-7-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261119081621.112623-1-rolandschober1968@gmail.com>

The LE Periodic Advertising Sync Transfer Received decoder prints the
connection handle twice, doubles the colon of three labels, prints the
interval without a unit and decodes the 1 octet Advertiser_Clock_Accuracy
as a BR/EDR clock accuracy in units of 0.3125 ms:

        Handle: 3585
        Connection handle: 3585
        ...
        Address type:: Random (0x01)
        Address:: C0:11:22:33:44:55 (Static)
        PHY:: LE 2M (0x02)
        Periodic advertising Interval: 1000.000
        Accuracy: 1.5625 msec (0x0005)

Decode it the way LE Periodic Advertising Sync Established is decoded:

        Handle: 3585 (LE-ACL) Address: C0:11:22:33:44:55 (Static)
        ...
        Address type: Random (0x01)
        Address: C0:11:22:33:44:55 (Static)
        PHY: LE 2M (0x02)
        Periodic advertising interval: 1000.00 msec (0x0320)
        Advertiser clock accuracy: 0x05

Fixes: 228c945a93a4 ("monitor: Decode LE Periodic Advertising Sync Transfer Received Event")
Assisted-by: Claude:claude-opus-5-5
---
 monitor/packet.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index d926efe28..015392713 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -14058,17 +14058,15 @@ static void le_past_received_evt(struct timeval *tv, uint16_t index,
 	const struct bt_hci_evt_le_past_recv *evt = data;
 
 	print_status(evt->status);
-	print_field("Handle: %d", evt->handle);
-	print_field("Connection handle: %d", evt->handle);
-	print_field("Service data: 0x%4.4x", evt->service_data);
-	print_field("Sync handle: %d", evt->sync_handle);
+	print_handle(evt->handle);
+	print_field("Service data: 0x%4.4x", le16_to_cpu(evt->service_data));
+	print_field("Sync handle: %d", le16_to_cpu(evt->sync_handle));
 	print_field("SID: 0x%2.2x", evt->sid);
-	print_peer_addr_type("Address type:", evt->addr_type);
-	print_addr("Address:", evt->addr, evt->addr_type);
-	print_le_phy("PHY:", evt->phy);
-	print_field("Periodic advertising Interval: %.3f",
-							1.25 * evt->interval);
-	print_clock_accuracy(evt->clock_accuracy);
+	print_peer_addr_type("Address type", evt->addr_type);
+	print_addr("Address", evt->addr, evt->addr_type);
+	print_le_phy("PHY", evt->phy);
+	print_slot_125("Periodic advertising interval", evt->interval);
+	print_field("Advertiser clock accuracy: 0x%2.2x", evt->clock_accuracy);
 }
 
 static void le_cis_established_evt(struct timeval *tv, uint16_t index,
-- 
2.47.3


  parent reply	other threads:[~2026-11-19  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  8:16 [PATCH BlueZ v3 0/9] monitor: Decode Periodic Advertising with Responses Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 1/9] monitor: Fix handle decoding of status_handle_rsp Roland Schober
2026-11-19  9:53   ` monitor: Decode Periodic Advertising with Responses bluez.test.bot
2026-11-19  8:16 ` [PATCH BlueZ v3 2/9] monitor: Fix data length of LE PA Report decoding Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 3/9] monitor: Fix PHY decoding of LE Ext Create Connection Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 4/9] monitor: Fix advertising handle of LE PA commands Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 5/9] monitor: Fix TX power and CTE Type of LE PA Report Roland Schober
2026-11-19  8:16 ` Roland Schober [this message]
2026-11-19  8:16 ` [PATCH BlueZ v3 7/9] monitor: Split LE PA Report decoding into helpers Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 8/9] monitor: Add PAwR HCI commands decoding Roland Schober
2026-11-19  8:16 ` [PATCH BlueZ v3 9/9] monitor: Add PAwR HCI events decoding Roland Schober

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119081621.112623-7-rolandschober1968@gmail.com \
    --to=rolandschober1968@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox