Skip to contentSkip to conversation

monitor: Fix instance where BN is printed as PTO

PATCH Applied Luiz Augusto von Dentz 3 participants 5 messages Oct 9, 2025 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/3 monitor: Fix instance where BN is printed as PTO

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

This fixes 2 instance where BN is printed as PTO.

---
 monitor/packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
monitor/packet.c +2 -2
index d0cf7c5630c6..dd808deaa79f 100644
@@ -12503,7 +12503,7 @@ static void le_big_sync_estabilished_evt(struct timeval *tv, uint16_t index,
 	print_usec_interval("Transport Latency", evt->latency);
 	print_field("NSE: %u", evt->nse);
 	print_field("BN: %u", evt->bn);
-	print_field("PTO: %u", evt->bn);
+	print_field("PTO: %u", evt->pto);
 	print_field("IRC: %u", evt->irc);
 	print_field("Maximum PDU: %u", evt->max_pdu);
 	print_slot_125("ISO Interval", evt->interval);
@@ -12548,7 +12548,7 @@ static void le_big_info_evt(struct timeval *tv, uint16_t index,
 	print_field("NSE: %u", evt->nse);
 	print_slot_125("ISO Interval", evt->iso_interval);
 	print_field("BN: %u", evt->bn);
-	print_field("PTO: %u", evt->bn);
+	print_field("PTO: %u", evt->pto);
 	print_field("IRC: %u", evt->irc);
 	print_field("Maximum PDU: %u", evt->max_pdu);
 	print_usec_interval("SDU Interval", evt->sdu_interval);
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH 2/3 client/player: Fix prompting for bcode when one is already set

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

If bcode is non-zeroed it means it already has been set so there is no reason to ask the user to overwrite it, also fixes the assumption that only strings could be entered as bcode rather than a byte array.

---
 client/player.c | 67 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 51 insertions(+), 16 deletions(-)
client/player.c +51 -16
index bb193dafeba0..a8d05cf175c9 100644
@@ -5263,17 +5263,26 @@ static void set_bcode_cb(const DBusError *error, void *user_data)
 static void set_bcode(const char *input, void *user_data)
 {
 	struct transport_select_args *args = user_data;
-	char *bcode;
+	uint8_t *bcode = NULL;
+	size_t len = 0;
 
 	if (!strcasecmp(input, "n") || !strcasecmp(input, "no"))
-		bcode = g_new0(char, 16);
-	else
-		bcode = g_strdup(input);
+		bcode = g_new0(uint8_t, 16);
+	else {
+		bcode = str2bytearray((char *) input, &len);
+		/* If the input is not 16 bytes, perhaps it was entered as
+		 * string so just use it instead.
+		 */
+		if (len != 16) {
+			bcode = (uint8_t *)strdup(input);
+			len = strlen(input);
+		}
+	}
 
 	if (g_dbus_proxy_set_property_dict(args->proxy, "QoS",
 				set_bcode_cb, user_data,
 				NULL, "BCode", DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
-				strlen(bcode), bcode, NULL) == FALSE) {
+				len, bcode, NULL) == FALSE) {
 		bt_shell_printf("Setting broadcast code failed\n");
 		g_free(bcode);
 		free_transport_select_args(args);
@@ -5295,9 +5304,11 @@ static void transport_select(struct transport_select_args *args)
 
 static void transport_set_bcode(struct transport_select_args *args)
 {
-	DBusMessageIter iter, array, entry, value;
-	unsigned char encryption;
+	DBusMessageIter iter, array;
+	unsigned char encryption = 0;
 	const char *key;
+	uint8_t *bcode, zeroed_bcode[16] = {};
+	int bcode_len = 0;
 
 	if (g_dbus_proxy_get_property(args->proxy, "QoS", &iter) == FALSE) {
 		free_transport_select_args(args);
@@ -5308,24 +5319,48 @@ static void transport_set_bcode(struct transport_select_args *args)
 
 	while (dbus_message_iter_get_arg_type(&array) !=
 						DBUS_TYPE_INVALID) {
+		DBusMessageIter entry, value, array_value;
+		int var;
+
 		dbus_message_iter_recurse(&array, &entry);
 		dbus_message_iter_get_basic(&entry, &key);
 
+		dbus_message_iter_next(&entry);
+		dbus_message_iter_recurse(&entry, &value);
+
+		var = dbus_message_iter_get_arg_type(&value);
+
 		if (!strcasecmp(key, "Encryption")) {
-			dbus_message_iter_next(&entry);
-			dbus_message_iter_recurse(&entry, &value);
+			if (var != DBUS_TYPE_BYTE)
+				break;
+
 			dbus_message_iter_get_basic(&value, &encryption);
-			if (encryption == 1) {
-				bt_shell_prompt_input("",
-					"Enter brocast code[value/no]:",
-					set_bcode, args);
-				return;
-			}
-			break;
+		} else if (!strcasecmp(key, "BCode")) {
+			if (var != DBUS_TYPE_ARRAY)
+				break;
+
+			dbus_message_iter_recurse(&value, &array_value);
+			dbus_message_iter_get_fixed_array(&array_value, &bcode,
+								&bcode_len);
+
+			if (bcode_len != 16 || !memcmp(bcode, zeroed_bcode, 16))
+				bcode_len = 0;
 		}
+
 		dbus_message_iter_next(&array);
 	}
 
+	/* Only attempt to set bcode if encryption is enabled and
+	 * bcode is not already set.
+	 */
+	if (encryption == 1 && !bcode_len) {
+		const char *path = g_dbus_proxy_get_path(args->proxy);
+
+		bt_shell_prompt_input(path, "Enter bcode[value/no]:",
+					set_bcode, args);
+		return;
+	}
+
 	/* Go straight to selecting transport, if Broadcast Code
 	 * is not required.
 	 */
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH 3/3 bass: Fix restricting the BIS indexes to 1 as assistant

In reply to Luiz Augusto von Dentz

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

MediaAssistant are created per BIS which creates a problem since MediaAssistant.Push could only push one index at the time, so instead of always using the index use 0xFFFFFF (no preference) and leave it up to the delegator to decide.

---
 profiles/audio/bass.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
profiles/audio/bass.c +4 -1
index b7d39165fb13..70ef6f932ec7 100644
@@ -1034,7 +1034,10 @@ static DBusMessage *push(DBusConnection *conn, DBusMessage *msg,
 		util_iov_append(&iov, &meta_len, sizeof(meta_len));
 	}
 
-	bis_sync = (1 << (assistant->bis - 1));
+	/* Use 0xFFFFFFFF to indicate no preference (any BIS index) to allow
+	 * delegators to sync with BIG with multiple BIS
+	 */
+	bis_sync = 0xFFFFFFFF;
 	meta_len = assistant->meta->iov_len;
 
 	util_iov_append(&iov, &bis_sync, sizeof(bis_sync));
Signature · 1 line
2.51.0
#3 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=1009812

---Test result---

Test Summary:

CheckPatch                    PENDING   0.34 seconds
GitLint                       PENDING   0.34 seconds
BuildEll                      PASS      20.16 seconds
BluezMake                     PASS      2730.75 seconds
MakeCheck                     PASS      19.88 seconds
MakeDistcheck                 PASS      185.30 seconds
CheckValgrind                 PASS      237.90 seconds
CheckSmatch                   WARNING   310.25 seconds
bluezmakeextell               PASS      128.86 seconds
IncrementalBuild              PENDING   0.29 seconds
ScanBuild                     PASS      921.82 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: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1931:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3822:52: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

---
Regards,
Linux Bluetooth

#4 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 Thu, 9 Oct 2025 12:21:09 -0400 you wrote:

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

This fixes 2 instance where BN is printed as PTO.

---
 monitor/packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
- [BlueZ,v1,1/3] monitor: Fix instance where BN is printed as PTO

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1067426bec48
  - [BlueZ,v1,2/3] client/player: Fix prompting for bcode when one is already set
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=411e3e0e4695
  - [BlueZ,v1,3/3] bass: Fix restricting the BIS indexes to 1 as assistant
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4be24398f9ef

You are awesome, thank you!

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