public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO
@ 2025-10-09 16:21 Luiz Augusto von Dentz
  2025-10-09 16:21 ` [PATCH BlueZ v1 2/3] client/player: Fix prompting for bcode when one is already set Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2025-10-09 16:21 UTC (permalink / raw)
  To: linux-bluetooth

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

This fixes 2 instance where BN is printed as PTO.
---
 monitor/packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index d0cf7c5630c6..dd808deaa79f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -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);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ v1 2/3] client/player: Fix prompting for bcode when one is already set
  2025-10-09 16:21 [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO Luiz Augusto von Dentz
@ 2025-10-09 16:21 ` Luiz Augusto von Dentz
  2025-10-09 16:21 ` [PATCH BlueZ v1 3/3] bass: Fix restricting the BIS indexes to 1 as assistant Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2025-10-09 16:21 UTC (permalink / raw)
  To: linux-bluetooth

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

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(-)

diff --git a/client/player.c b/client/player.c
index bb193dafeba0..a8d05cf175c9 100644
--- a/client/player.c
+++ b/client/player.c
@@ -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.
 	 */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ v1 3/3] bass: Fix restricting the BIS indexes to 1 as assistant
  2025-10-09 16:21 [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO Luiz Augusto von Dentz
  2025-10-09 16:21 ` [PATCH BlueZ v1 2/3] client/player: Fix prompting for bcode when one is already set Luiz Augusto von Dentz
@ 2025-10-09 16:21 ` Luiz Augusto von Dentz
  2025-10-09 17:44 ` [BlueZ,v1,1/3] monitor: Fix instance where BN is printed as PTO bluez.test.bot
  2025-10-09 19:40 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2025-10-09 16:21 UTC (permalink / raw)
  To: linux-bluetooth

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

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(-)

diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index b7d39165fb13..70ef6f932ec7 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -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));
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [BlueZ,v1,1/3] monitor: Fix instance where BN is printed as PTO
  2025-10-09 16:21 [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO Luiz Augusto von Dentz
  2025-10-09 16:21 ` [PATCH BlueZ v1 2/3] client/player: Fix prompting for bcode when one is already set Luiz Augusto von Dentz
  2025-10-09 16:21 ` [PATCH BlueZ v1 3/3] bass: Fix restricting the BIS indexes to 1 as assistant Luiz Augusto von Dentz
@ 2025-10-09 17:44 ` bluez.test.bot
  2025-10-09 19:40 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-10-09 17:44 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO
  2025-10-09 16:21 [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2025-10-09 17:44 ` [BlueZ,v1,1/3] monitor: Fix instance where BN is printed as PTO bluez.test.bot
@ 2025-10-09 19:40 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2025-10-09 19:40 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu,  9 Oct 2025 12:21:09 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-09 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 16:21 [PATCH BlueZ v1 1/3] monitor: Fix instance where BN is printed as PTO Luiz Augusto von Dentz
2025-10-09 16:21 ` [PATCH BlueZ v1 2/3] client/player: Fix prompting for bcode when one is already set Luiz Augusto von Dentz
2025-10-09 16:21 ` [PATCH BlueZ v1 3/3] bass: Fix restricting the BIS indexes to 1 as assistant Luiz Augusto von Dentz
2025-10-09 17:44 ` [BlueZ,v1,1/3] monitor: Fix instance where BN is printed as PTO bluez.test.bot
2025-10-09 19:40 ` [PATCH BlueZ v1 1/3] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox