Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1] monitor: Fix printing subpages bits after all subpages
Date: Fri, 10 Jul 2026 14:50:12 -0400	[thread overview]
Message-ID: <20260710185012.699301-1-luiz.dentz@gmail.com> (raw)

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes printing the decoded subpage bitfields after all subpages
rather then after the subpage itself:

before:

        Features[1/0][8]:
        00 03 00 00 00 00 00 00                          ........
        Features[1/1][8]:
        00 00 00 00 00 00 00 00                          ........
        Features[1/2][8]:
        00 00 00 00 00 00 00 00                          ........
          Shorter Connection Intervals
          Shorter Connection Intervals (Host Support)

after:

        Features[1/0][8]:
        00 03 00 00 00 00 00 00                          ........
          Shorter Connection Intervals
          Shorter Connection Intervals (Host Support)
---
 monitor/packet.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index e62ad4cfb337..ba6ff8e8e551 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -2925,17 +2925,29 @@ static const struct bitfield_data features_msft[] = {
 
 static void print_features_subpage(uint8_t page, uint8_t subpages,
 					const uint8_t *features_array,
-					uint64_t *features)
+					uint64_t *features,
+					const struct bitfield_data *table)
 {
 	int i, j;
 	char str[18];
 
 	for (i = 0; i < subpages; i++) {
+		uint64_t mask;
+
 		for (j = 0; j < 8; j++)
 			features[i] |= ((uint64_t) features_array[i * 8 + j])
 					<< (j * 8);
 		sprintf(str, "Features[%u/%u]", page, i);
 		print_hex_field(str, &features_array[i * 8], 8);
+
+		if (!table)
+			continue;
+
+		mask = print_bitfield(2, features[i], table);
+		if (mask)
+			print_text(COLOR_UNKNOWN_FEATURE_BIT,
+				"  Unknown features (0x%16.16" PRIx64 ")",
+				mask);
 	}
 }
 
@@ -2943,16 +2955,13 @@ static void print_features(uint8_t page, const uint8_t *features_array,
 								uint8_t type)
 {
 	const struct bitfield_data *features_table = NULL;
-	uint64_t mask, features[3] = {};
+	uint64_t features[3] = {};
 	uint8_t subpages = 1;
-	int i;
 
 	/* LE pages 1-10 are 192 bits (24 octets) each */
 	if (type == 0x01 && page)
 		subpages = 3;
 
-	print_features_subpage(page, subpages, features_array, features);
-
 	switch (type) {
 	case 0x00:
 		switch (page) {
@@ -2985,16 +2994,8 @@ static void print_features(uint8_t page, const uint8_t *features_array,
 		break;
 	}
 
-	if (!features_table)
-		return;
-
-	for (i = 0; i < subpages; i++) {
-		mask = print_bitfield(2, features[i], features_table);
-		if (mask)
-			print_text(COLOR_UNKNOWN_FEATURE_BIT,
-				"  Unknown features (0x%16.16" PRIx64 ")",
-				mask);
-	}
+	print_features_subpage(page, subpages, features_array, features,
+							features_table);
 }
 
 void packet_print_features_lmp(const uint8_t *features, uint8_t page)
@@ -11065,7 +11066,7 @@ static const struct opcode_data opcode_table[] = {
 				"LE Read Minimum Supported Connection Interval",
 				null_cmd, 0, true, le_read_conn_interval_rsp,
 				sizeof(struct bt_hci_rsp_le_read_conn_interval),
-				true },
+				false },
 	{ }
 };
 
-- 
2.54.0


             reply	other threads:[~2026-07-10 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 18:50 Luiz Augusto von Dentz [this message]
2026-07-10 20:45 ` [BlueZ,v1] monitor: Fix printing subpages bits after all subpages 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=20260710185012.699301-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