mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -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
|
|
@ -54,6 +54,7 @@ struct transport_data {
|
|||
};
|
||||
|
||||
#define HSP_AG_PROFILE "/Profile/HSPAGProfile"
|
||||
#define HFP_AG_PROFILE "/Profile/HFPAGProfile"
|
||||
#define HSP_HS_PROFILE "/Profile/HSPHSProfile"
|
||||
|
||||
/* RFCOMM channel for HSP headset role
|
||||
|
|
@ -508,6 +509,8 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *m,
|
|||
p = PA_BLUETOOTH_PROFILE_HSP_HS;
|
||||
} else if (pa_streq(handler, HSP_HS_PROFILE)) {
|
||||
p = PA_BLUETOOTH_PROFILE_HFP_AG;
|
||||
} else if (pa_streq(handler, HFP_AG_PROFILE)) {
|
||||
p = PA_BLUETOOTH_PROFILE_HFP_HF;
|
||||
} else {
|
||||
pa_log_error("Invalid handler");
|
||||
goto fail;
|
||||
|
|
@ -585,7 +588,8 @@ static DBusHandlerResult profile_handler(DBusConnection *c, DBusMessage *m, void
|
|||
|
||||
pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
|
||||
|
||||
if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE))
|
||||
if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE)
|
||||
&& !pa_streq(path, HFP_AG_PROFILE))
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
|
||||
|
|
@ -630,6 +634,10 @@ static void profile_init(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile
|
|||
object_name = HSP_HS_PROFILE;
|
||||
uuid = PA_BLUETOOTH_UUID_HSP_HS;
|
||||
break;
|
||||
case PA_BLUETOOTH_PROFILE_HFP_HF:
|
||||
object_name = HFP_AG_PROFILE;
|
||||
uuid = PA_BLUETOOTH_UUID_HFP_AG;
|
||||
break;
|
||||
default:
|
||||
pa_assert_not_reached();
|
||||
break;
|
||||
|
|
@ -649,6 +657,9 @@ static void profile_done(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile
|
|||
case PA_BLUETOOTH_PROFILE_HFP_AG:
|
||||
dbus_connection_unregister_object_path(pa_dbus_connection_get(b->connection), HSP_HS_PROFILE);
|
||||
break;
|
||||
case PA_BLUETOOTH_PROFILE_HFP_HF:
|
||||
dbus_connection_unregister_object_path(pa_dbus_connection_get(b->connection), HFP_AG_PROFILE);
|
||||
break;
|
||||
default:
|
||||
pa_assert_not_reached();
|
||||
break;
|
||||
|
|
@ -691,6 +702,8 @@ pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_d
|
|||
if (enable_hs_role)
|
||||
profile_init(backend, PA_BLUETOOTH_PROFILE_HFP_AG);
|
||||
profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
|
||||
if (pa_bluetooth_discovery_get_enable_native_hfp_hf(y))
|
||||
profile_init(backend, PA_BLUETOOTH_PROFILE_HFP_HF);
|
||||
|
||||
return backend;
|
||||
}
|
||||
|
|
@ -703,6 +716,8 @@ void pa_bluetooth_native_backend_free(pa_bluetooth_backend *backend) {
|
|||
if (backend->enable_hs_role)
|
||||
profile_done(backend, PA_BLUETOOTH_PROFILE_HFP_AG);
|
||||
profile_done(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
|
||||
if (pa_bluetooth_discovery_get_enable_native_hfp_hf(backend->discovery))
|
||||
profile_done(backend, PA_BLUETOOTH_PROFILE_HFP_HF);
|
||||
|
||||
pa_dbus_connection_unref(backend->connection);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue