Blame SOURCES/0001-audio-Permit-concurrent-use-of-AG-and-HF-roles.patch

19062e
From 2f92669697152848f2fae584d45fde5d80ea6eb8 Mon Sep 17 00:00:00 2001
19062e
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Dalleau?=
19062e
 <frederic.dalleau@linux.intel.com>
19062e
Date: Fri, 22 Jun 2012 16:11:25 +0200
19062e
Subject: [PATCH] audio: Permit concurrent use of AG and HF roles
19062e
19062e
If a device supports both HF and AG roles, then if a SCO connection
19062e
related to AG profile happens, the connection is rejected because HF is
19062e
not connected. One consequence is pulseaudio failing to load bluetooth
19062e
module.
19062e
---
19062e
 audio/main.c | 9 +++++++--
19062e
 1 file changed, 7 insertions(+), 2 deletions(-)
19062e
19062e
diff --git a/audio/main.c b/audio/main.c
19062e
index 5c751af..a48c8b8 100644
19062e
--- a/audio/main.c
19062e
+++ b/audio/main.c
19062e
@@ -102,7 +102,7 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
19062e
 	if (device->headset) {
19062e
 		if (headset_get_state(device) < HEADSET_STATE_CONNECTED) {
19062e
 			DBG("Refusing SCO from non-connected headset");
19062e
-			goto drop;
19062e
+			goto gateway;
19062e
 		}
19062e
 
19062e
 		if (!headset_get_hfp_active(device)) {
19062e
@@ -115,7 +115,11 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
19062e
 			goto drop;
19062e
 
19062e
 		headset_set_state(device, HEADSET_STATE_PLAYING);
19062e
-	} else if (device->gateway) {
19062e
+		goto connect;
19062e
+	}
19062e
+
19062e
+gateway:
19062e
+	if (device->gateway) {
19062e
 		if (!gateway_is_connected(device)) {
19062e
 			DBG("Refusing SCO from non-connected AG");
19062e
 			goto drop;
19062e
@@ -126,6 +130,7 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
19062e
 	} else
19062e
 		goto drop;
19062e
 
19062e
+connect:
19062e
 	sk = g_io_channel_unix_get_fd(chan);
19062e
 	fcntl(sk, F_SETFL, 0);
19062e
 
19062e
-- 
19062e
1.8.0.1
19062e