SHA256
1
0
forked from pool/pulseaudio
pulseaudio/0007-bluetooth-prefer-headset-HFP-HF-connection-with-nati.patch
Takashi Iwai 236e29d4cf Accepting request 877714 from home:tiwai:branches:multimedia:libs
- Upstream fixes for supporting HFP in native backend (bsc#1167940):
  0001-bluetooth-use-consistent-profile-names.patch
  0002-bluetooth-separate-HSP-and-HFP.patch
  0003-bluetooth-add-correct-HFP-rfcomm-negotiation.patch
  0004-bluetooth-make-native-the-default-backend.patch
  0005-bluetooth-enable-module-bluez5-discover-argument-ena.patch
  0006-bluetooth-fix-headset-auto-ofono-handover.patch
  0007-bluetooth-prefer-headset-HFP-HF-connection-with-nati.patch
  0008-bluetooth-complete-bluetooth-profile-separation.patch
  0009-bluetooth-use-device-flag-to-prevent-assertion-failu.patch
  0010-bluetooth-rename-enable_hs_role-to-enable_shared_pro.patch
  0011-bluetooth-clean-up-rfcomm_write-usage.patch

OBS-URL: https://build.opensuse.org/request/show/877714
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=234
2021-03-08 12:50:38 +00:00

57 lines
2.3 KiB
Diff

From 815dd2d6278f17591fa04966b0e4c5a8b102cf0b Mon Sep 17 00:00:00 2001
From: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
Date: Fri, 29 Jan 2021 09:28:36 +0300
Subject: [PATCH 07/11] bluetooth: prefer headset HFP HF connection with native
backend
When HFP HF support is enabled in native backend, peer HFP HF profile connection
is preferred over same peer HSP HS profile connection if peer supports both
profiles.
Enforce the preference by rejecting HSP HS profile connections from such peer.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
---
src/modules/bluetooth/backend-native.c | 10 ++++++++++
src/modules/bluetooth/module-bluez5-device.c | 10 ----------
2 files changed, 10 insertions(+), 10 deletions(-)
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -645,6 +645,16 @@ static DBusMessage *profile_new_connecti
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);
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -2072,16 +2072,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;