Commit 6f25f0ee authored by pali's avatar pali
Browse files

bluetooth: policy: Reflect a2dp profile names

In next patches, codec name is appended end the end of a2dp profile names.
parent d055e4b5
......@@ -85,7 +85,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
if (!s)
return PA_HOOK_OK;
if (u->enable_a2dp_source && pa_streq(s, "a2dp_source"))
if (u->enable_a2dp_source && pa_startswith(s, "a2dp_source"))
role = "music";
else if (u->enable_ag && pa_streq(s, "headset_audio_gateway"))
role = "phone";
......@@ -154,7 +154,7 @@ static void card_set_profile(struct userdata *u, pa_card *card, bool revert_to_a
/* Check for correct profile based on revert_to_a2dp */
if (revert_to_a2dp) {
if (!pa_streq(profile->name, "a2dp_sink"))
if (!pa_startswith(profile->name, "a2dp_sink"))
continue;
} else {
if (!pa_streq(profile->name, "headset_head_unit"))
......@@ -196,11 +196,11 @@ static void switch_profile(pa_card *card, bool revert_to_a2dp, void *userdata) {
return;
/* Skip card if already has active a2dp profile */
if (pa_streq(card->active_profile->name, "a2dp_sink"))
if (pa_startswith(card->active_profile->name, "a2dp_sink"))
return;
} else {
/* Skip card if does not have active a2dp profile */
if (!pa_streq(card->active_profile->name, "a2dp_sink"))
if (!pa_startswith(card->active_profile->name, "a2dp_sink"))
return;
/* Skip card if already has active hsp profile */
......@@ -307,7 +307,7 @@ static pa_hook_result_t card_init_profile_hook_callback(pa_core *c, pa_card *car
/* Ignore card if has already set other initial profile than a2dp */
if (card->active_profile &&
!pa_streq(card->active_profile->name, "a2dp_sink"))
!pa_startswith(card->active_profile->name, "a2dp_sink"))
return PA_HOOK_OK;
/* Set initial profile to hsp */
......@@ -359,7 +359,7 @@ static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_prof
return PA_HOOK_OK;
/* Do not automatically switch profiles for headsets, just in case */
if (pa_streq(profile->name, "a2dp_sink") || pa_streq(profile->name, "headset_head_unit"))
if (pa_startswith(profile->name, "a2dp_sink") || pa_streq(profile->name, "headset_head_unit"))
return PA_HOOK_OK;
is_active_profile = card->active_profile == profile;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment