adapter: Notify adapter drivers of settings changes
PATCH 1/2 adapter: Notify adapter drivers of settings changes
Add a settings_changed callback to adapter drivers, called with the MGMT_SETTING_* bits that changed whenever the adapter's current settings change. The media driver needs it to follow the CIS and ISO broadcast settings, which the kernel only sets once the controller is up.
--- src/adapter.c | 11 +++++++++++ src/adapter.h | 2 ++ 2 files changed, 13 insertions(+)
src/adapter.c +11 -0
@@ -688,6 +688,17 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)trigger_pairable_timeout (adapter); } + +if (changed_mask) { +GSList *l; + +for (l = adapter->drivers; l; l =g_slist_next (l)) { +struct btd_adapter_driver *driver = l->data; + +if (driver->settings_changed) + driver->settings_changed (adapter, changed_mask); + } + } }static void adapter_set_power_state (struct btd_adapter *adapter,uint32_t value)
src/adapter.h +2 -0
@@ -134,6 +134,8 @@ struct btd_adapter_driver { struct btd_device *device);void (*device_resolved)(struct btd_adapter *adapter,struct btd_device *device); +void (*settings_changed)(struct btd_adapter *adapter, +uint32_t changed);/* Indicates the driver is experimental and shall only be registered * when experimental has been enabled (see: main.conf:Experimental).
base-commit: 1adfe662efeff12997df9ddd0960dbd0de9c8ea7
Signature · 1 line
2.43.0
PATCH 2/2 media: Signal SupportedUUIDs when the adapter's ISO settings change
Media1.SupportedUUIDs lists the LE Audio endpoints only when the adapter has the CIS or ISO broadcast settings, which the kernel sets once the controller is up. An adapter registered before that, such as a USB controller that finishes loading its firmware after bluetoothd started, first lists none, and no PropertiesChanged followed when the settings came on. PipeWire then registered its A2DP endpoints only, and the adapter had no LE Audio until PipeWire was restarted.
Signal SupportedUUIDs from the media driver's settings_changed callback when a CIS or ISO broadcast setting changes.
--- profiles/audio/a2dp.c | 1 + profiles/audio/media.c | 22 ++++++++++++++++++++++ profiles/audio/media.h | 1 + 3 files changed, 24 insertions(+)
profiles/audio/a2dp.c +1 -0
@@ -3893,6 +3893,7 @@ static struct btd_adapter_driver media_driver = { .name = "media", .probe = media_server_probe, .remove = media_server_remove, + .settings_changed = media_settings_changed, };static int a2dp_init (void )
profiles/audio/media.c +22 -0
@@ -3864,6 +3864,28 @@ int media_register(struct btd_adapter *btd_adapter)return 0 ; } +void media_settings_changed (struct btd_adapter *btd_adapter,uint32_t changed) +{ +GSList *l; + +if (!(changed & (MGMT_SETTING_CIS_CENTRAL |MGMT_SETTING_CIS_PERIPHERAL | +MGMT_SETTING_ISO_BROADCASTER | +MGMT_SETTING_ISO_SYNC_RECEIVER ))) +return ; + +for (l = adapters; l; l = l->next) { +struct media_adapter *adapter = l->data; + +if (adapter->btd_adapter == btd_adapter) { +g_dbus_emit_property_changed (btd_get_dbus_connection (), +adapter_get_path (btd_adapter), +MEDIA_INTERFACE , +"SupportedUUIDs" ); +return ; + } + } +} +void media_unregister (struct btd_adapter *btd_adapter) {GSList *l;
profiles/audio/media.h +1 -0
@@ -17,6 +17,7 @@ typedef void (*media_endpoint_cb_t) (struct media_endpoint *endpoint,int media_register (struct btd_adapter *btd_adapter);void media_unregister (struct btd_adapter *btd_adapter); +void media_settings_changed (struct btd_adapter *btd_adapter,uint32_t changed);#ifdef HAVE_A2DP struct a2dp_sep *media_endpoint_get_sep (struct media_endpoint *endpoint);
Signature · 1 line
2.43.0
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/series/1218576/
---Test result---
Test Summary:
CheckPatch FAIL 0.74 seconds GitLint PASS 0.47 seconds BuildEll PASS 21.09 seconds BluezMake PASS 320.55 seconds MakeCheck PASS 3.66 seconds MakeDistcheck PASS 152.04 seconds CheckValgrind PASS 162.57 seconds CheckSmatch PASS 328.49 seconds bluezmakeextell PASS 101.93 seconds TestFunctional PASS 1238.32 seconds IncrementalBuild PASS 323.26 seconds ScanBuild PASS 1218.48 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/2] media: Signal SupportedUUIDs when the adapter's ISO settings change WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#160: FILE: profiles/audio/media.c:3871:
+ if (!(changed & (MGMT_SETTING_CIS_CENTRAL | MGMT_SETTING_CIS_PERIPHERAL |
/home/runner/work/bluez/bluez/src/patch/15010056.patch total: 0 errors, 1 warnings, 42 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.
/home/runner/work/bluez/bluez/src/patch/15010056.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.
https://github.com/bluez/bluez/pull/2870
---
Regards,
Linux Bluetooth