linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: linux-bluetooth@vger.kernel.org
Cc: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: [PATCH] device: fix reporting of Connected state for PAN
Date: Mon, 10 Jun 2013 12:55:07 +0100	[thread overview]
Message-ID: <1370865307-7433-1-git-send-email-gustavo@padovan.org> (raw)

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

The network interface handles the connected state as boolean so we never
get an intermediate state CONNECTING. The old code was preventing the
transition from DISCONNECTED to CONNECTED in network to be signaled in
the Device interface.
---
 src/device.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index 57bfc86..34511bd 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4506,10 +4506,20 @@ static void service_state_changed(struct btd_service *service,
 	struct btd_device *device = btd_service_get_device(service);
 	int err = btd_service_get_error(service);
 
-	if (old_state == BTD_SERVICE_STATE_CONNECTING)
-		device_profile_connected(device, profile, err);
-	else if (old_state == BTD_SERVICE_STATE_DISCONNECTING)
+	switch (new_state) {
+	case BTD_SERVICE_STATE_CONNECTED:
+		if (old_state == BTD_SERVICE_STATE_CONNECTING ||
+				old_state == BTD_SERVICE_STATE_DISCONNECTED)
+			device_profile_connected(device, profile, err);
+		break;
+
+	case BTD_SERVICE_STATE_DISCONNECTED:
 		device_profile_disconnected(device, profile, err);
+		break;
+
+	default:
+		break;
+	}
 }
 
 struct btd_service *btd_device_get_service(struct btd_device *dev,
-- 
1.8.1.4


             reply	other threads:[~2013-06-10 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 11:55 Gustavo Padovan [this message]
2013-06-17 11:03 ` [PATCH] device: fix reporting of Connected state for PAN Luiz Augusto von Dentz

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=1370865307-7433-1-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=emilio.pozuelo@collabora.co.uk \
    --cc=gustavo.padovan@collabora.co.uk \
    --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).