bluez5: allow disabling sink or source endpoints

Add option bluez5.roles that selects which endpoints (A2DP, BAP, HFP,
HSP) will be enabled.

This extends and deprecates bluez5.headset-roles.
This commit is contained in:
Pauli Virtanen 2023-03-16 20:40:17 +02:00
parent a49d2d41af
commit fa3ee2e20b
2 changed files with 49 additions and 3 deletions

View file

@ -40,6 +40,7 @@ static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.native");
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
#define PROP_KEY_ROLES "bluez5.roles"
#define PROP_KEY_HEADSET_ROLES "bluez5.headset-roles"
#define HFP_CODEC_SWITCH_INITIAL_TIMEOUT_MSEC 5000
@ -2706,8 +2707,11 @@ static int parse_headset_roles(struct impl *backend, const struct spa_dict *info
const char *str;
int profiles = SPA_BT_PROFILE_NULL;
if (info == NULL ||
(str = spa_dict_lookup(info, PROP_KEY_HEADSET_ROLES)) == NULL)
if (!info)
goto fallback;
if ((str = spa_dict_lookup(info, PROP_KEY_ROLES)) == NULL &&
(str = spa_dict_lookup(info, PROP_KEY_HEADSET_ROLES)) == NULL)
goto fallback;
profiles = spa_bt_profiles_from_json_array(str);