linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] audio/source: Fix not notifying service about connection state
Date: Thu,  4 Jul 2013 15:00:45 +0300	[thread overview]
Message-ID: <1372939245-18040-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1372939245-18040-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

btd_service_connecting_complete should be called whenever the service
is connected otherwise the service state will not be consistent.
---
 profiles/audio/source.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 226c372..73c3185 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -165,6 +165,7 @@ static void stream_state_changed(struct avdtp_stream *stream,
 		source->cb_id = 0;
 		break;
 	case AVDTP_STATE_OPEN:
+		btd_service_connecting_complete(source->service, 0);
 		source_set_state(dev, SOURCE_STATE_CONNECTED);
 		break;
 	case AVDTP_STATE_STREAMING:
@@ -183,20 +184,14 @@ static void stream_state_changed(struct avdtp_stream *stream,
 static gboolean stream_setup_retry(gpointer user_data)
 {
 	struct source *source = user_data;
-	int err;
 
 	source->retry_id = 0;
 
-	if (source->stream_state >= AVDTP_STATE_OPEN) {
-		DBG("Stream successfully created, after XCASE connect:connect");
-		err = 0;
-	} else {
+	if (source->stream_state < AVDTP_STATE_OPEN) {
 		DBG("Stream setup failed, after XCASE connect:connect");
-		err = -EIO;
+		btd_service_connecting_complete(source->service, -EIO);
 	}
 
-	btd_service_connecting_complete(source->service, err);
-
 	if (source->connect_id > 0) {
 		a2dp_cancel(source->dev, source->connect_id);
 		source->connect_id = 0;
@@ -213,11 +208,8 @@ static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
 
 	source->connect_id = 0;
 
-	if (stream) {
-		DBG("Stream successfully created");
-		btd_service_connecting_complete(source->service, 0);
+	if (stream)
 		return;
-	}
 
 	avdtp_unref(source->session);
 	source->session = NULL;
-- 
1.8.1.4


  reply	other threads:[~2013-07-04 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 12:00 [PATCH BlueZ 1/2] audio/sink: Fix not notifying service about connection state Luiz Augusto von Dentz
2013-07-04 12:00 ` Luiz Augusto von Dentz [this message]
2013-07-04 12:19 ` Mikel Astiz
2013-07-05 10:20 ` 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=1372939245-18040-2-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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).