pulseaudio/0010-bluetooth-rename-enable_hs_role-to-enable_shared_pro.patch

114 lines
5.2 KiB
Diff
Raw Normal View History

From 0a36c1544d7e995be4528c4dfda43d7de1bbacc5 Mon Sep 17 00:00:00 2001
From: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
Date: Tue, 16 Feb 2021 08:46:19 +0300
Subject: [PATCH 10/11] bluetooth: rename enable_hs_role to
enable_shared_profiles
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
---
src/modules/bluetooth/backend-native.c | 22 +++++++++++-----------
src/modules/bluetooth/bluez5-util.c | 2 +-
src/modules/bluetooth/bluez5-util.h | 8 ++++----
3 files changed, 16 insertions(+), 16 deletions(-)
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -40,7 +40,7 @@ struct pa_bluetooth_backend {
pa_core *core;
pa_dbus_connection *connection;
pa_bluetooth_discovery *discovery;
- bool enable_hs_role;
+ bool enable_shared_profiles;
bool enable_hfp_hf;
PA_LLIST_HEAD(pa_dbus_pending, pending);
@@ -797,8 +797,8 @@ static void profile_done(pa_bluetooth_ba
}
}
-static void native_backend_apply_profile_registration_change(pa_bluetooth_backend *native_backend, bool enable_hs_role) {
- if (enable_hs_role) {
+static void native_backend_apply_profile_registration_change(pa_bluetooth_backend *native_backend, bool enable_shared_profiles) {
+ if (enable_shared_profiles) {
profile_init(native_backend, PA_BLUETOOTH_PROFILE_HSP_AG);
if (native_backend->enable_hfp_hf)
profile_init(native_backend, PA_BLUETOOTH_PROFILE_HFP_HF);
@@ -809,17 +809,17 @@ static void native_backend_apply_profile
}
}
-void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *native_backend, bool enable_hs_role) {
+void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *native_backend, bool enable) {
- if (enable_hs_role == native_backend->enable_hs_role)
+ if (enable == native_backend->enable_shared_profiles)
return;
- native_backend_apply_profile_registration_change(native_backend, enable_hs_role);
+ native_backend_apply_profile_registration_change(native_backend, enable);
- native_backend->enable_hs_role = enable_hs_role;
+ native_backend->enable_shared_profiles = enable;
}
-pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role) {
+pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles) {
pa_bluetooth_backend *backend;
DBusError err;
@@ -837,10 +837,10 @@ pa_bluetooth_backend *pa_bluetooth_nativ
}
backend->discovery = y;
- backend->enable_hs_role = enable_hs_role;
+ backend->enable_shared_profiles = enable_shared_profiles;
backend->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y);
- if (backend->enable_hs_role)
+ if (backend->enable_shared_profiles)
native_backend_apply_profile_registration_change(backend, true);
profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
@@ -853,7 +853,7 @@ void pa_bluetooth_native_backend_free(pa
pa_dbus_free_pending_list(&backend->pending);
- if (backend->enable_hs_role)
+ if (backend->enable_shared_profiles)
native_backend_apply_profile_registration_change(backend, false);
profile_done(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -1040,7 +1040,7 @@ void pa_bluetooth_discovery_set_ofono_ru
if (y->headset_backend != HEADSET_BACKEND_AUTO)
return;
- pa_bluetooth_native_backend_enable_hs_role(y->native_backend, !is_running);
+ pa_bluetooth_native_backend_enable_shared_profiles(y->native_backend, !is_running);
/* If ofono starts running, all devices that might be connected to the HS roles or HFP AG role
* need to be disconnected, so that the devices can be handled by ofono */
--- a/src/modules/bluetooth/bluez5-util.h
+++ b/src/modules/bluetooth/bluez5-util.h
@@ -145,15 +145,15 @@ static inline void pa_bluetooth_ofono_ba
#endif
#ifdef HAVE_BLUEZ_5_NATIVE_HEADSET
-pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role);
+pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles);
void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b);
-void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *b, bool enable_hs_role);
+void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *b, bool enable);
#else
-static inline pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role) {
+static inline pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles) {
return NULL;
}
static inline void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b) {}
-static inline void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *b, bool enable_hs_role) {}
+static inline void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *b, bool enable) {}
#endif
pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,