2024-02-01 19:10:31

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 1/8] client/mgmt: Add missing settings strings

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

This adds "iso-broadcaster" and "sync-receiver" which were missing.
---
client/mgmt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/client/mgmt.c b/client/mgmt.c
index 62167727c1c0..44bf4d2019ea 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -359,6 +359,8 @@ static const char *settings_str[] = {
"wide-band-speech",
"cis-central",
"cis-peripheral",
+ "iso-broadcaster",
+ "sync-receiver"
};

static const char *settings2str(uint32_t settings)
--
2.43.0



2024-02-01 19:10:40

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 2/8] bap: Fix passing ep instead of setup to config_cb

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

config_cb expects setup pointer not ep.
---
profiles/audio/bap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 7faa6be7f90b..7e87d12d02f1 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -948,7 +948,7 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
&setup->qos, setup->caps);

setup->id = bt_bap_stream_config(setup->stream, &setup->qos,
- setup->caps, config_cb, ep);
+ setup->caps, config_cb, setup);
if (!setup->id) {
DBG("Unable to config stream");
setup_free(setup);
--
2.43.0


2024-02-01 19:10:49

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 5/8] bap: Fix crash when a broadcast strean setup is pending

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

This fixes the following crash when a broadcast stream setup is
pending and the device is remove:

bluetoothd[37]: src/device.c:device_free() 0x89a500
bluetoothd[37]: GLib: Invalid file descriptor.
bluetoothd[37]: ++++++++ backtrace ++++++++
bluetoothd[37]: #1 g_logv+0x270 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557e3120]
bluetoothd[37]: #2 g_log+0x93 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557e3403]
bluetoothd[37]: #3 g_io_channel_error_from_errno+0x4a (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557cd9da]
bluetoothd[37]: #4 g_io_unix_close+0x53 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb55839d53]
bluetoothd[37]: #5 g_io_channel_shutdown+0x10f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557cdf7f]
bluetoothd[37]: #6 g_io_channel_unref+0x39 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557ce1e9]
bluetoothd[37]: #7 g_source_unref_internal+0x24f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557db79f]
bluetoothd[37]: #8 g_main_context_dispatch+0x288 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557dd638]
bluetoothd[37]: #9 g_main_context_iterate.isra.0+0x318 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb5583b6b8]
bluetoothd[37]: #10 g_main_loop_run+0x7f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557dcaff]
bluetoothd[37]: #11 mainloop_run+0x15 (src/shared/mainloop-glib.c:68) [0x662e65]
bluetoothd[37]: #12 mainloop_run_with_signal+0x128 (src/shared/mainloop-notify.c:190) [0x663368]
bluetoothd[37]: #13 main+0x154b (src/main.c:1454) [0x41521b]
bluetoothd[37]: #14 __libc_start_call_main+0x7a (/usr/lib64/libc.so.6) [0x7feb54e1fb8a]
bluetoothd[37]: #15 __libc_start_main@@GLIBC_2.34+0x8b (/usr/lib64/libc.so.6) [0x7feb54e1fc4b]
bluetoothd[37]: #16 _start+0x25 (src/main.c:1197) [0x416305]
bluetoothd[37]: +++++++++++++++++++++++++++
---
profiles/audio/bap.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 7e87d12d02f1..26fd465bf560 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -974,6 +974,9 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
setup->id = 0;
}

+ if (ep->data->service)
+ service_set_connecting(ep->data->service);
+
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

@@ -2437,6 +2440,11 @@ static int bap_bcast_probe(struct btd_service *service)
return -EINVAL;
}

+ if (!bt_bap_attach(data->bap, NULL)) {
+ error("BAP unable to attach");
+ return -EINVAL;
+ }
+
bap_data_add(data);

data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service,
@@ -2644,6 +2652,7 @@ static struct btd_profile bap_bcast_profile = {
.remote_uuid = BCAAS_UUID_STR,
.device_probe = bap_bcast_probe,
.device_remove = bap_bcast_remove,
+ .disconnect = bap_disconnect,
.auto_connect = false,
.experimental = true,
};
--
2.43.0


2024-02-01 19:10:58

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 6/8] shared/bap: Fix not being able to reconfigure Broadcast Source

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

This fixes not being able to reconfigure broadcast source due to it
being in Releasing:

bluetoothd[37]: src/shared/bap.c:stream_set_state_broadcast() stream
0x8919e0 dir 0x00: streaming -> releasing
bluetoothd[37]: profiles/audio/bap.c:setup_new() ep 0x8802d0 setup
0x88d3e0
bluetoothd[37]: src/shared/bap.c:bt_bap_stream_new() Unable to find
unused ASE
---
src/shared/bap.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index ce8d35f86af3..f2d2ca09bb24 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1379,6 +1379,7 @@ static void stream_set_state_broadcast(struct bt_bap_stream *stream,
break;
case BT_ASCS_ASE_STATE_RELEASING:
bap_stream_io_detach(stream);
+ stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_QOS);
break;
}

--
2.43.0


2024-02-01 19:11:01

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 8/8] shared/bap: Make broadcast disable and release more consistent

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

This makes bt_bap_stream_disable and bt_bap_stream_release use disabling
and releasing states to be more consistent with their procedures.
---
src/shared/bap.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index f2d2ca09bb24..ac17eea13556 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1377,10 +1377,14 @@ static void stream_set_state_broadcast(struct bt_bap_stream *stream,
case BT_ASCS_ASE_STATE_IDLE:
bap_stream_detach(stream);
break;
- case BT_ASCS_ASE_STATE_RELEASING:
+ case BT_ASCS_ASE_STATE_DISABLING:
bap_stream_io_detach(stream);
stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_QOS);
break;
+ case BT_ASCS_ASE_STATE_RELEASING:
+ bap_stream_io_detach(stream);
+ stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_IDLE);
+ break;
}

bt_bap_unref(bap);
@@ -5064,7 +5068,7 @@ unsigned int bt_bap_stream_disable(struct bt_bap_stream *stream,

case BT_BAP_STREAM_TYPE_BCAST:
stream_set_state_broadcast(stream,
- BT_BAP_STREAM_STATE_RELEASING);
+ BT_BAP_STREAM_STATE_DISABLING);
return 1;
}

@@ -5161,11 +5165,8 @@ unsigned int bt_bap_stream_release(struct bt_bap_stream *stream,

/* If stream is broadcast, no BT_ASCS_RELEASE is required */
if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_BCAST) {
- if (!bap_stream_valid(stream)) {
- stream_set_state_broadcast(stream,
- BT_BAP_STREAM_STATE_IDLE);
- stream = NULL;
- }
+ stream_set_state_broadcast(stream,
+ BT_BAP_STREAM_STATE_RELEASING);
return 0;
}

--
2.43.0


2024-02-01 19:11:10

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 3/8] device: Don't remove object if a service is connecting

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

If a service is connecting just restart the timer to give it more time
to complete the connection or disconnect.
---
src/device.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/src/device.c b/src/device.c
index afd073c6c2a5..1db96d9a672c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3276,6 +3276,13 @@ static bool device_disappeared(gpointer user_data)
{
struct btd_device *dev = user_data;

+ /* If there are services connecting restart the timer to give more time
+ * for the service to either complete the connection or disconnect.
+ */
+ if (find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTING))
+ return TRUE;
+
dev->temporary_timer = 0;

btd_adapter_remove_device(dev->adapter, dev);
--
2.43.0


2024-02-01 19:11:13

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 7/8] transport: Fix crash when disable bcast stream

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

bt_bap_stream_disable does cause the stream to go to releasing state
removing the owner in the process so calling bap_disable_complete
passing the existing owner would likely cause a crash.
---
profiles/audio/transport.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 796017a4c6de..bd8960ef74fd 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -1532,7 +1532,8 @@ static guint transport_bap_suspend(struct media_transport *transport,
id = bt_bap_stream_disable(bap->stream, bap->linked, func, owner);

if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) {
- bap_disable_complete(bap->stream, 0x00, 0x00, owner);
+ if (transport->owner == owner)
+ bap_disable_complete(bap->stream, 0x00, 0x00, owner);
return 0;
}

--
2.43.0


2024-02-01 19:37:43

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v2 4/8] shared/bap: Allow using bt_bap_attach for broadcast

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

This enables use of bt_bap_attach for broadcast by checking if there is
a client or ATT instance.
---
src/shared/bap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 851d6a5facc3..ce8d35f86af3 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -4156,7 +4156,8 @@ bool bt_bap_attach(struct bt_bap *bap, struct bt_gatt_client *client)
queue_foreach(bap_cbs, bap_attached, bap);

if (!client) {
- bap_attach_att(bap, bap->att);
+ if (bap->att)
+ bap_attach_att(bap, bap->att);
return true;
}

--
2.43.0


2024-02-01 21:51:30

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v2,1/8] client/mgmt: Add missing settings strings

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=822251

---Test result---

Test Summary:
CheckPatch FAIL 3.56 seconds
GitLint FAIL 2.70 seconds
BuildEll PASS 24.43 seconds
BluezMake PASS 722.71 seconds
MakeCheck PASS 11.91 seconds
MakeDistcheck PASS 166.66 seconds
CheckValgrind PASS 230.68 seconds
CheckSmatch PASS 336.62 seconds
bluezmakeextell PASS 109.02 seconds
IncrementalBuild PASS 5507.46 seconds
ScanBuild PASS 954.89 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,5/8] bap: Fix crash when a broadcast strean setup is pending
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#103:
bluetoothd[37]: #1 g_logv+0x270 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557e3120]

/github/workspace/src/src/13541679.patch total: 0 errors, 1 warnings, 27 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13541679.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2,5/8] bap: Fix crash when a broadcast strean setup is pending

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
11: B1 Line exceeds max length (86>80): "bluetoothd[37]: #1 g_logv+0x270 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557e3120]"
12: B1 Line exceeds max length (84>80): "bluetoothd[37]: #2 g_log+0x93 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557e3403]"
13: B1 Line exceeds max length (108>80): "bluetoothd[37]: #3 g_io_channel_error_from_errno+0x4a (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557cd9da]"
14: B1 Line exceeds max length (94>80): "bluetoothd[37]: #4 g_io_unix_close+0x53 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb55839d53]"
15: B1 Line exceeds max length (101>80): "bluetoothd[37]: #5 g_io_channel_shutdown+0x10f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557cdf7f]"
16: B1 Line exceeds max length (97>80): "bluetoothd[37]: #6 g_io_channel_unref+0x39 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557ce1e9]"
17: B1 Line exceeds max length (103>80): "bluetoothd[37]: #7 g_source_unref_internal+0x24f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557db79f]"
18: B1 Line exceeds max length (103>80): "bluetoothd[37]: #8 g_main_context_dispatch+0x288 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557dd638]"
19: B1 Line exceeds max length (109>80): "bluetoothd[37]: #9 g_main_context_iterate.isra.0+0x318 (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb5583b6b8]"
20: B1 Line exceeds max length (94>80): "bluetoothd[37]: #10 g_main_loop_run+0x7f (/usr/lib64/libglib-2.0.so.0.7600.6) [0x7feb557dcaff]"
22: B1 Line exceeds max length (96>80): "bluetoothd[37]: #12 mainloop_run_with_signal+0x128 (src/shared/mainloop-notify.c:190) [0x663368]"
24: B1 Line exceeds max length (87>80): "bluetoothd[37]: #14 __libc_start_call_main+0x7a (/usr/lib64/libc.so.6) [0x7feb54e1fb8a]"
25: B1 Line exceeds max length (94>80): "bluetoothd[37]: #15 __libc_start_main@@GLIBC_2.34+0x8b (/usr/lib64/libc.so.6) [0x7feb54e1fc4b]"


---
Regards,
Linux Bluetooth

2024-02-02 15:23:16

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v2 1/8] client/mgmt: Add missing settings strings

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Thu, 1 Feb 2024 14:10:09 -0500 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This adds "iso-broadcaster" and "sync-receiver" which were missing.
> ---
> client/mgmt.c | 2 ++
> 1 file changed, 2 insertions(+)

Here is the summary with links:
- [BlueZ,v2,1/8] client/mgmt: Add missing settings strings
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=17623000ef46
- [BlueZ,v2,2/8] bap: Fix passing ep instead of setup to config_cb
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=17c1a9b49490
- [BlueZ,v2,3/8] device: Don't remove object if a service is connecting
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=59bf065b6279
- [BlueZ,v2,4/8] shared/bap: Allow using bt_bap_attach for broadcast
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b983c31d4a76
- [BlueZ,v2,5/8] bap: Fix crash when a broadcast strean setup is pending
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=75095a9901f8
- [BlueZ,v2,6/8] shared/bap: Fix not being able to reconfigure Broadcast Source
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b4aae7f3d92b
- [BlueZ,v2,7/8] transport: Fix crash when disable bcast stream
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8527a218d9b5
- [BlueZ,v2,8/8] shared/bap: Make broadcast disable and release more consistent
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d14e0b5ef150

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html