From f34a87fe38347e4c85291ec4455c812e754a6de4 Mon Sep 17 00:00:00 2001 From: Alexander Sarmanow Date: Fri, 30 Jan 2026 16:39:25 +0100 Subject: [PATCH] bluez5: bap: add support for per adapter broadcast config By setting the hci handle (e.g. hci0) of the desired adapter, the BIG config will only applied on that adapter. In case no "adapter" entry in the config is given, it will be applied on all adapters. Signed-off-by: Alexander Sarmanow --- doc/dox/config/pipewire-props.7.md | 1 + spa/plugins/bluez5/bluez5-dbus.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/dox/config/pipewire-props.7.md b/doc/dox/config/pipewire-props.7.md index 52ac3e369..9cf3943ed 100644 --- a/doc/dox/config/pipewire-props.7.md +++ b/doc/dox/config/pipewire-props.7.md @@ -1211,6 +1211,7 @@ PipeWire Opus Pro audio profile duplex max bitrate. PipeWire Opus Pro audio profile duplex frame duration (1/10 ms). @PAR@ monitor-prop bluez5.bcast_source.config = [] # JSON +For a per-adapter configuration of multiple BIGs use an "adapter" entry in the BIG with the HCI device name (e.g. hci0). \parblock Example: ``` diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 6b5fb173e..0bb5a1a88 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -194,6 +194,7 @@ struct spa_bt_bis { }; #define BROADCAST_CODE_LEN 16 +#define HCI_DEV_NAME_LEN 8 struct spa_bt_big { struct spa_list link; @@ -202,6 +203,7 @@ struct spa_bt_big { struct spa_list bis_list; int big_id; int sync_factor; + char adapter[HCI_DEV_NAME_LEN]; }; /* @@ -6244,8 +6246,20 @@ static void configure_bcast_source(struct spa_bt_monitor *monitor, { struct spa_bt_big *big; struct spa_bt_bis *bis; + char *pos; /* Configure each BIS from a BIG */ spa_list_for_each(big, &monitor->bcast_source_config_list, link) { + /* Apply per adapter configuration if BIG has an adapter value stated, + * otherwise apply the BIG config angnostically to each adapter + */ + if (strlen(big->adapter) > 0) { + pos = strstr(object_path, big->adapter); + if (pos == NULL) + continue; + + spa_log_debug(monitor->log, "configuring BIG for adapter=%s", big->adapter); + } + spa_list_for_each(bis, &big->bis_list, link) { configure_bis(monitor, codec, conn, object_path, interface_name, big, bis, local_endpoint); @@ -6989,6 +7003,7 @@ static void parse_broadcast_source_config(struct spa_bt_monitor *monitor, const char bis_key[256]; char qos_key[256]; char bcode[BROADCAST_CODE_LEN + 3]; + char adapter[HCI_DEV_NAME_LEN + 3]; int cursor; int big_id = 0; struct spa_json it[3], it_array[4]; @@ -7024,6 +7039,13 @@ static void parse_broadcast_source_config(struct spa_bt_monitor *monitor, const goto parse_failed; memcpy(big_entry->broadcast_code, bcode, strlen(bcode)); spa_log_debug(monitor->log, "big_entry->broadcast_code %s", big_entry->broadcast_code); + } else if (spa_streq(key, "adapter")) { + if (spa_json_get_string(&it[1], adapter, sizeof(adapter)) <= 0) + goto parse_failed; + if (strlen(adapter) > HCI_DEV_NAME_LEN) + goto parse_failed; + memcpy(big_entry->adapter, adapter, sizeof(adapter)); + spa_log_debug(monitor->log, "big_entry->adapter %s", big_entry->adapter); } else if (spa_streq(key, "encryption")) { if (spa_json_get_bool(&it[0], &big_entry->encryption) <= 0) goto parse_failed;