Skip to contentSkip to conversation

client/player: Fix not setting config target_latency with edpoint.config

PATCH In review Luiz Augusto von Dentz 3 participants 7 messages Jul 31, 2024 – Aug 1, 2024 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/4 client/player: Fix not setting config target_latency with edpoint.config

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

This fixes not setting target_latency with endpoint.config command.

---
 client/player.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
client/player.c +4 -3
index 3c3587f2c..93d6b62e2 100644
@@ -1790,9 +1790,9 @@ static void append_ucast_qos(DBusMessageIter *iter, struct endpoint_config *cfg)
 					DBUS_TYPE_UINT32, &qos->delay);
 
 	if (cfg->target_latency) {
-		bt_shell_printf("TargetLatency 0x%02x\n", qos->target_latency);
+		bt_shell_printf("TargetLatency 0x%02x\n", cfg->target_latency);
 		g_dbus_dict_append_entry(iter, "TargetLatency", DBUS_TYPE_BYTE,
-					&qos->target_latency);
+					&cfg->target_latency);
 	}
 
 	append_io_qos(iter, &qos->io_qos);
@@ -3765,6 +3765,7 @@ static void cmd_config_endpoint(int argc, char *argv[])
 		/* Copy capabilities */
 		util_iov_append(cfg->caps, preset->data.iov_base,
 				preset->data.iov_len);
+		cfg->target_latency = preset->target_latency;
 
 		/* Set QoS parameters */
 		cfg->qos = preset->qos;
@@ -3960,7 +3961,7 @@ static void custom_target_latency(const char *input, void *user_data)
 	else if (!strcasecmp(input, "Balance"))
 		p->target_latency = 0x02;
 	else if (!strcasecmp(input, "High"))
-		p->target_latency = 0x02;
+		p->target_latency = 0x03;
 	else {
 		char *endptr = NULL;
 
Signature · 1 line
2.45.0
author maintainer
#1 lore raw

PATCH 2/4 monitor: Fix crash parsing notification

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

This fixes the following crash caused by notify callback being NULL:

Jump to the invalid address stated on the next line
at 0x0: ???
by 0x1E8375: print_notify (att.c:5420)
by 0x1E9464: att_multiple_vl_rsp (att.c:5463)
by 0x20D39E: att_packet (att.c:5637)
by 0x1B2054: l2cap_frame (l2cap.c:2567)
by 0x1B4A4D: l2cap_packet (l2cap.c:2708)
by 0x19AD43: packet_hci_acldata (packet.c:12522)
by 0x19CF07: packet_monitor (packet.c:4249)
by 0x152405: data_callback (control.c:973)
by 0x2204F6: mainloop_run (mainloop.c:106)
by 0x221017: mainloop_run_with_signal (mainloop-notify.c:189) by 0x14F387: main (main.c:298)
Address 0x0 is not stack'd, malloc'd or (recently) free'd

---
 monitor/att.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
monitor/att.c +2 -1
index a23347ef7..73a616584 100644
@@ -4646,7 +4646,8 @@ static void print_notify(const struct l2cap_frame *frame, uint16_t handle,
 		frame = &clone;
 	}
 
-	handler->notify(frame);
+	if (handler->notify)
+		handler->notify(frame);
 }
 
 static void att_handle_value_notify(const struct l2cap_frame *frame)
Signature · 1 line
2.45.0
author maintainer
#2 lore raw

PATCH 3/4 shared/bap: Fix not setting metadata

In reply to Luiz Augusto von Dentz

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

bt_bap_stream_metatada shall not send Update Metadata if the states don't allow it, instead it shall store it so it can be send later when enabling the stream.

---
 src/shared/bap.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
src/shared/bap.c +11 -2
index 499e740c9..a7217b417 100644
@@ -1971,8 +1971,17 @@ static unsigned int bap_ucast_metadata(struct bt_bap_stream *stream,
 		return 0;
 	}
 
-	return bap_stream_metadata(stream, BT_ASCS_METADATA, data, func,
-					user_data);
+	switch (bt_bap_stream_get_state(stream)) {
+	/* Valid only if ASE_State field = 0x03 (Enabling) */
+	case BT_BAP_STREAM_STATE_ENABLING:
+	 /* or 0x04 (Streaming) */
+	case BT_BAP_STREAM_STATE_STREAMING:
+		return bap_stream_metadata(stream, BT_ASCS_METADATA, data, func,
+						user_data);
+	}
+
+	stream_metadata(stream, data, NULL);
+	return 0;
 }
 
 static uint8_t stream_release(struct bt_bap_stream *stream, struct iovec *rsp)
Signature · 1 line
2.45.0
author maintainer
#3 lore raw

PATCH 4/4 bap: Fix not setting metatada

In reply to Luiz Augusto von Dentz

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

Fix not using bt_bap_stream_metadata when configuring a new stream as the endpoint/client may have set it.

---
 profiles/audio/bap.c | 4 ++++
 1 file changed, 4 insertions(+)
profiles/audio/bap.c +4 -0
index 53f430d66..a2c5a546d 100644
@@ -1523,6 +1523,10 @@ static void setup_config(void *data, void *user_data)
 		return;
 	}
 
+	if (setup->metadata && setup->metadata->iov_len)
+		bt_bap_stream_metadata(setup->stream, setup->metadata, NULL,
+								NULL);
+
 	bt_bap_stream_set_user_data(setup->stream, ep->path);
 }
 
Signature · 1 line
2.45.0
#4 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=875511

---Test result---

Test Summary:

CheckPatch                    PASS      1.87 seconds
GitLint                       FAIL      4.72 seconds
BuildEll                      PASS      25.15 seconds
BluezMake                     PASS      1690.11 seconds
MakeCheck                     PASS      13.56 seconds
MakeDistcheck                 PASS      177.39 seconds
CheckValgrind                 PASS      251.75 seconds
CheckSmatch                   WARNING   352.40 seconds
bluezmakeextell               PASS      119.37 seconds
IncrementalBuild              PASS      6230.29 seconds
ScanBuild                     PASS      981.65 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,1/4] client/player: Fix not setting config target_latency with edpoint.config

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (87>80): "[BlueZ,v1,1/4] client/player: Fix not setting config target_latency with edpoint.config"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures

---
Regards,
Linux Bluetooth

#5 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 Wed, 31 Jul 2024 14:57:15 +0100 you wrote:

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

This fixes not setting target_latency with endpoint.config command.

---
 client/player.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Here is the summary with links:
- [BlueZ,v1,1/4] client/player: Fix not setting config target_latency with edpoint.config

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=549d38852f66

- [BlueZ,v1,2/4] monitor: Fix crash parsing notification (no matching commit)
- [BlueZ,v1,3/4] shared/bap: Fix not setting metadata (no matching commit)
- [BlueZ,v1,4/4] bap: Fix not setting metatada (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#6 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 Wed, 31 Jul 2024 14:57:15 +0100 you wrote:

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

This fixes not setting target_latency with endpoint.config command.

---
 client/player.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Here is the summary with links:
- [BlueZ,v1,1/4] client/player: Fix not setting config target_latency with edpoint.config (no matching commit)
- [BlueZ,v1,2/4] monitor: Fix crash parsing notification

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8a708aa5f046
  - [BlueZ,v1,3/4] shared/bap: Fix not setting metadata
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fe703a0058d8
  - [BlueZ,v1,4/4] bap: Fix not setting metatada
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=998104507ba1

You are awesome, thank you!

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