From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1] monitor: Add decoding support for Public Broadcast Announcements
Date: Mon, 27 Apr 2026 15:22:23 -0400 [thread overview]
Message-ID: <20260427192223.2875358-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds support for decoding Public Broadcast Announcements (PBP).
---
monitor/packet.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/monitor/packet.c b/monitor/packet.c
index ff0b1cac2f5f..820191e0f7f5 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -3615,7 +3615,7 @@ static void print_ltv(const char *str, void *user_data)
print_field("%s: %s", label, str);
}
-static void print_base_annoucement(const uint8_t *data, uint8_t data_len)
+static void print_base_announcement(const uint8_t *data, uint8_t data_len)
{
struct iovec iov;
struct bt_hci_le_pa_base_data *base_data;
@@ -3714,7 +3714,7 @@ done:
print_hex_field(" Data", iov.iov_base, iov.iov_len);
}
-static void print_broadcast_annoucement(const uint8_t *data, uint8_t data_len)
+static void print_broadcast_announcement(const uint8_t *data, uint8_t data_len)
{
uint32_t bid;
@@ -3727,12 +3727,52 @@ static void print_broadcast_annoucement(const uint8_t *data, uint8_t data_len)
print_field("Broadcast ID: %u (0x%06x)", bid, bid);
}
+static const struct bitfield_data pbp_feat_table[] = {
+ { 0, "Encryption" },
+ { 1, "Standard Quality" },
+ { 2, "High Quality" },
+ {}
+};
+
+static void print_pbp_announcement(const uint8_t *data, uint8_t data_len)
+{
+ struct iovec iov, meta;
+ uint8_t feat;
+ uint8_t len;
+
+ iov.iov_base = (void *) data;
+ iov.iov_len = data_len;
+
+ if (util_iov_pull_u8(&iov, &feat)) {
+ print_text(COLOR_ERROR, " invalid features");
+ return;
+ }
+
+ print_field("Features: 0x%02x", feat);
+ print_bitfield(4, feat, pbp_feat_table);
+
+ if (util_iov_pull_u8(&iov, &len)) {
+ print_text(COLOR_ERROR, " invalid metadata length");
+ return;
+ }
+
+ if (!len)
+ return;
+
+ meta.iov_base = util_iov_pull_mem(&iov, len);
+ meta.iov_len = len;
+
+ bt_bap_debug_metadata(meta.iov_base, meta.iov_len, print_ltv,
+ " Metadata");
+}
+
static const struct service_data_decoder {
uint16_t uuid;
void (*func)(const uint8_t *data, uint8_t data_len);
} service_data_decoders[] = {
- { 0x1851, print_base_annoucement },
- { 0x1852, print_broadcast_annoucement }
+ { 0x1851, print_base_announcement },
+ { 0x1852, print_broadcast_announcement },
+ { 0x1856, print_pbp_announcement }
};
static void print_service_data(const uint8_t *data, uint8_t data_len)
--
2.53.0
next reply other threads:[~2026-04-27 19:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 19:22 Luiz Augusto von Dentz [this message]
2026-04-27 21:10 ` [BlueZ,v1] monitor: Add decoding support for Public Broadcast Announcements bluez.test.bot
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=20260427192223.2875358-1-luiz.dentz@gmail.com \
--to=luiz.dentz@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