linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
Subject: [PATCH] audio: permit concurrent use of AG and HF roles
Date: Fri, 22 Jun 2012 16:11:25 +0200	[thread overview]
Message-ID: <1340374285-29720-1-git-send-email-frederic.dalleau@linux.intel.com> (raw)

If a device supports both HF and AG roles, then if a SCO connection related
to AG profile happens, the connection is rejected because HF is not connected.
One consequence is pulseaudio failing to load bluetooth module.
---
 audio/main.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/audio/main.c b/audio/main.c
index 5c751af..a48c8b8 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -102,7 +102,7 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
 	if (device->headset) {
 		if (headset_get_state(device) < HEADSET_STATE_CONNECTED) {
 			DBG("Refusing SCO from non-connected headset");
-			goto drop;
+			goto gateway;
 		}
 
 		if (!headset_get_hfp_active(device)) {
@@ -115,7 +115,11 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
 			goto drop;
 
 		headset_set_state(device, HEADSET_STATE_PLAYING);
-	} else if (device->gateway) {
+		goto connect;
+	}
+
+gateway:
+	if (device->gateway) {
 		if (!gateway_is_connected(device)) {
 			DBG("Refusing SCO from non-connected AG");
 			goto drop;
@@ -126,6 +130,7 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
 	} else
 		goto drop;
 
+connect:
 	sk = g_io_channel_unix_get_fd(chan);
 	fcntl(sk, F_SETFL, 0);
 
-- 
1.7.9.5


             reply	other threads:[~2012-06-22 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 14:11 Frédéric Dalleau [this message]
2012-06-28 10:09 ` [PATCH] audio: permit concurrent use of AG and HF roles Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340374285-29720-1-git-send-email-frederic.dalleau@linux.intel.com \
    --to=frederic.dalleau@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).