Fix PulseAudio interaction on resume (#1534857)

This commit is contained in:
Bastien Nocera 2018-02-09 15:53:11 +01:00
parent ea68f85bf1
commit 07c07a183a
3 changed files with 120 additions and 1 deletions

View File

@ -0,0 +1,71 @@
From cd5853c6b3e930eab1c90510d42e0d1c631b682d Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 9 Feb 2018 12:53:13 +0200
Subject: [PATCH 1/2] core: Fixes order InterfaceAdded
Registering on the callback of MGMT_OP_READ_ADV_FEATURES causes
InterfacesAdded to be reschedule after the device objects which causes
tools such as PulseAudio to consider it invalid.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1534857
---
src/advertising.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/advertising.c b/src/advertising.c
index 94a8c4050..970c3d87b 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1032,14 +1032,6 @@ static void read_adv_features_callback(uint8_t status, uint16_t length,
if (manager->max_ads == 0)
return;
- if (!g_dbus_register_interface(btd_get_dbus_connection(),
- adapter_get_path(manager->adapter),
- LE_ADVERTISING_MGR_IFACE, methods,
- NULL, properties, manager, NULL)) {
- error("Failed to register " LE_ADVERTISING_MGR_IFACE);
- return;
- }
-
/* Reset existing instances */
if (feat->num_instances)
remove_advertising(manager, 0);
@@ -1061,19 +1053,29 @@ static struct btd_adv_manager *manager_create(struct btd_adapter *adapter)
}
manager->mgmt_index = btd_adapter_get_index(adapter);
+ manager->clients = queue_new();
+ manager->supported_flags = MGMT_ADV_FLAG_LOCAL_NAME;
+
+ if (!g_dbus_register_interface(btd_get_dbus_connection(),
+ adapter_get_path(manager->adapter),
+ LE_ADVERTISING_MGR_IFACE, methods,
+ NULL, properties, manager, NULL)) {
+ error("Failed to register " LE_ADVERTISING_MGR_IFACE);
+ goto fail;
+ }
if (!mgmt_send(manager->mgmt, MGMT_OP_READ_ADV_FEATURES,
manager->mgmt_index, 0, NULL,
read_adv_features_callback, manager, NULL)) {
error("Failed to read advertising features");
- manager_destroy(manager);
- return NULL;
+ goto fail;
}
- manager->clients = queue_new();
- manager->supported_flags = MGMT_ADV_FLAG_LOCAL_NAME;
-
return manager;
+
+fail:
+ manager_destroy(manager);
+ return NULL;
}
struct btd_adv_manager *btd_adv_manager_new(struct btd_adapter *adapter)
--
2.14.3

View File

@ -0,0 +1,41 @@
From 502df5778437dbbd73aff0d673aca6ba3235c667 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 9 Feb 2018 12:53:15 +0200
Subject: [PATCH 2/2] shared/gatt-client: Reset callbacks when unregistering
If user application is unregistering a notification handler its
callbacks shall not be called even CCC write is still holding a
reference to notify_data.
---
src/shared/gatt-client.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 8083ff719..1285c37ef 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1212,7 +1212,9 @@ static void complete_notify_request(void *data)
struct notify_data *notify_data = data;
notify_data->att_id = 0;
- notify_data->callback(0, notify_data->user_data);
+
+ if (notify_data->callback)
+ notify_data->callback(0, notify_data->user_data);
}
static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable,
@@ -3157,6 +3159,10 @@ bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
/* Remove data if it has been queued */
queue_remove(notify_data->chrc->reg_notify_queue, notify_data);
+ /* Reset callbacks */
+ notify_data->callback = NULL;
+ notify_data->notify = NULL;
+
complete_unregister_notify(notify_data);
return true;
}
--
2.14.3

View File

@ -1,7 +1,7 @@
Name: bluez
Summary: Bluetooth utilities
Version: 5.48
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
URL: http://www.bluez.org/
@ -31,6 +31,10 @@ Patch121: 0002-systemd-Add-PrivateTmp-and-NoNewPrivileges-options.patch
Patch122: 0003-systemd-Add-more-filesystem-lockdown.patch
Patch123: 0004-systemd-More-lockdown.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1534857
Patch200: 0001-core-Fixes-order-InterfaceAdded.patch
Patch201: 0002-shared-gatt-client-Reset-callbacks-when-unregisterin.patch
BuildRequires: git-core
BuildRequires: dbus-devel >= 1.6
BuildRequires: glib2-devel
@ -265,6 +269,9 @@ make check
%{_userunitdir}/obex.service
%changelog
* Fri Feb 09 2018 Bastien Nocera <bnocera@redhat.com> - 5.48-4
- Fix PulseAudio interaction on resume (#1534857)
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.48-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild