mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
bluetooth: separate HSP and HFP
When all headsets supported both HSP and HFP, life was good and we only needed to implement HSP in the native backend. Unfortunately some headsets have started supporting HFP only. Unfortuantely, we can't simply switch to HFP only because that might break older HSP only headsets meaning we need to support both HSP and HFP separately. This patch separates them from a joint profile to being two separate ones. The older one retains the headset_head_unit name, meaning any saved parameters will still select this (keeping us backward compatible). It also introduces a new headset_handsfree. For headsets that support both HSP and HFP, the two profiles will become separately visible and selectable. This will only matter once we start adding features to HFP that HSP can't support (like wideband audio). Signed-off-by: <James.Bottomley@HansenPartnership.com> --- v6: - merge profile switching fixes patch from Rodrigo Araujo v5: - rename option to enable_native_hfp_hf - don't call profile_done for HFP_HF unless it was initialised v3: - Update for PA 11.0 v2: - fold in review feedback - add global disable option for not registering HFP v3: - change parameter to enable_profile_hfp - update device_supports_profile to be aware of hfp/hsp exclusivity - change parameter to enable_profile_hfp_hf bluetooth: separate HSP and HFP (to me merged with this patch) Hi. First, just to say that your patches are going great. Finally I can use the microphone of my HFP only headset (a version of a Bluedio T2+). So far, I've only encontered one problem: the auto_switch option of module_bluetooth_policy stops working. Dug through the code and I think you missed a few spots were you have to hangle the new headset_handsfree profile in module_bluetooth_policy.c Applying the following after applying your v5 patches fixed the issue for me, now when I start making a VOIP call the profile switches to headset_handsfree and the mic works automatically, and when the call finishes it reverts back to a2dp. Thanks and best regards. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
This commit is contained in:
parent
709909a1fc
commit
66ed99a13d
6 changed files with 112 additions and 19 deletions
|
|
@ -156,7 +156,7 @@ static void card_set_profile(struct userdata *u, pa_card *card, bool revert_to_a
|
|||
if (!pa_streq(profile->name, "a2dp_sink"))
|
||||
continue;
|
||||
} else {
|
||||
if (!pa_streq(profile->name, "headset_head_unit"))
|
||||
if (!pa_streq(profile->name, "headset_head_unit") && !pa_streq(profile->name, "headset_handsfree"))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ static void switch_profile(pa_card *card, bool revert_to_a2dp, void *userdata) {
|
|||
return;
|
||||
|
||||
/* Skip card if does not have active hsp profile */
|
||||
if (!pa_streq(card->active_profile->name, "headset_head_unit"))
|
||||
if (!pa_streq(card->active_profile->name, "headset_head_unit") && !pa_streq(card->active_profile->name, "headset_handsfree"))
|
||||
return;
|
||||
|
||||
/* Skip card if already has active a2dp profile */
|
||||
|
|
@ -203,7 +203,7 @@ static void switch_profile(pa_card *card, bool revert_to_a2dp, void *userdata) {
|
|||
return;
|
||||
|
||||
/* Skip card if already has active hsp profile */
|
||||
if (pa_streq(card->active_profile->name, "headset_head_unit"))
|
||||
if (pa_streq(card->active_profile->name, "headset_head_unit") || pa_streq(card->active_profile->name, "headset_handsfree"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +358,9 @@ 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_streq(profile->name, "a2dp_sink") ||
|
||||
pa_streq(profile->name, "headset_head_unit") ||
|
||||
pa_streq(profile->name, "headset_handsfree"))
|
||||
return PA_HOOK_OK;
|
||||
|
||||
is_active_profile = card->active_profile == profile;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue