diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index 15a05ef39..7b70345d5 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -641,6 +641,16 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *m, goto fail; } + if (pa_bluetooth_discovery_get_enable_native_hfp_hf(b->discovery)) { + if (p == PA_BLUETOOTH_PROFILE_HSP_HS && pa_hashmap_get(d->uuids, PA_BLUETOOTH_UUID_HFP_HF)) { + /* If peer connecting to HSP Audio Gateway supports HFP HF profile + * reject this connection to force it to connect to HSP Audio Gateway instead. + */ + pa_log_info("HFP HF enabled in native backend and is supported by peer, rejecting HSP HS peer connection"); + goto fail; + } + } + pa_assert_se(dbus_message_iter_next(&arg_i)); pa_assert(dbus_message_iter_get_arg_type(&arg_i) == DBUS_TYPE_UNIX_FD); diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index ea42c7f0c..6a10dadd2 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2103,16 +2103,6 @@ static int add_card(struct userdata *u) { PA_HASHMAP_FOREACH(uuid, d->uuids, state) { pa_bluetooth_profile_t profile; - if (!enable_native_hfp_hf && pa_streq(uuid, PA_BLUETOOTH_UUID_HFP_HF)) { - pa_log_info("device supports HFP but disabling profile as requested"); - continue; - } - - if (has_both && pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS)) { - pa_log_info("device support HSP and HFP, selecting HFP only"); - continue; - } - if (uuid_to_profile(uuid, &profile) < 0) continue;