From 065973eb980f2510f8ded5376dbeefb9172772e3 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Jun 27 2018 08:49:25 +0000 Subject: + bluez-5.50-2 Fix A2DP disconnections with some headsets --- diff --git a/0001-policy-Add-logic-to-connect-a-Sink.patch b/0001-policy-Add-logic-to-connect-a-Sink.patch new file mode 100644 index 0000000..3a3d9a0 --- /dev/null +++ b/0001-policy-Add-logic-to-connect-a-Sink.patch @@ -0,0 +1,72 @@ +From 477ecca127c529611adbc53f08039cefaf86305d Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Tue, 26 Jun 2018 13:37:33 +0300 +Subject: [PATCH] policy: Add logic to connect a Sink + +If HFP/HSP HS connects and the device also supports a Sink connect it +as well since some devices (e.g. Sony MW600) may not connect it +automatically. +--- + plugins/policy.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/plugins/policy.c b/plugins/policy.c +index 1f5a506a2..de51e58b9 100644 +--- a/plugins/policy.c ++++ b/plugins/policy.c +@@ -297,6 +297,42 @@ static void sink_cb(struct btd_service *service, btd_service_state_t old_state, + } + } + ++static void hs_cb(struct btd_service *service, btd_service_state_t old_state, ++ btd_service_state_t new_state) ++{ ++ struct btd_device *dev = btd_service_get_device(service); ++ struct policy_data *data; ++ struct btd_service *sink; ++ ++ /* If the device supports Sink set a timer to connect it as well */ ++ sink = btd_device_get_service(dev, A2DP_SINK_UUID); ++ if (sink == NULL) ++ return; ++ ++ data = policy_get_data(dev); ++ ++ switch (new_state) { ++ case BTD_SERVICE_STATE_UNAVAILABLE: ++ break; ++ case BTD_SERVICE_STATE_DISCONNECTED: ++ break; ++ case BTD_SERVICE_STATE_CONNECTING: ++ break; ++ case BTD_SERVICE_STATE_CONNECTED: ++ /* Check if service initiate the connection then proceed ++ * immediately otherwise set timer ++ */ ++ if (old_state == BTD_SERVICE_STATE_CONNECTING) ++ policy_connect(data, sink); ++ else if (btd_service_get_state(sink) != ++ BTD_SERVICE_STATE_CONNECTED) ++ policy_set_sink_timer(data); ++ break; ++ case BTD_SERVICE_STATE_DISCONNECTING: ++ break; ++ } ++} ++ + static gboolean policy_connect_tg(gpointer user_data) + { + struct policy_data *data = user_data; +@@ -615,6 +651,9 @@ static void service_cb(struct btd_service *service, + controller_cb(service, old_state, new_state); + else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID)) + target_cb(service, old_state, new_state); ++ else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) || ++ g_str_equal(profile->remote_uuid, HSP_HS_UUID)) ++ hs_cb(service, old_state, new_state); + + /* + * Return if the reconnection feature is not enabled (all +-- +2.17.1 + diff --git a/bluez.spec b/bluez.spec index 54c6bfd..5400db6 100644 --- a/bluez.spec +++ b/bluez.spec @@ -1,7 +1,7 @@ Name: bluez Summary: Bluetooth utilities Version: 5.50 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.bluez.org/ @@ -27,6 +27,9 @@ Patch21: 0002-systemd-Add-PrivateTmp-and-NoNewPrivileges-options.patch Patch22: 0003-systemd-Add-more-filesystem-lockdown.patch Patch23: 0004-systemd-More-lockdown.patch +# Fix A2DP disconnection with some headsets +Patch30: 0001-policy-Add-logic-to-connect-a-Sink.patch + BuildRequires: git-core BuildRequires: dbus-devel >= 1.6 BuildRequires: glib2-devel @@ -262,6 +265,10 @@ make check %{_userunitdir}/obex.service %changelog +* Wed Jun 27 2018 Bastien Nocera - 5.50-2 ++ bluez-5.50-2 +- Fix A2DP disconnections with some headsets + * Mon Jun 04 2018 Bastien Nocera - 5.50-1 + bluez-5.50-1 - Update to 5.50