* [PATCH] device: fix reporting of Connected state for PAN
@ 2013-06-10 11:55 Gustavo Padovan
2013-06-17 11:03 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Padovan @ 2013-06-10 11:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emilio Pozuelo Monfort, Gustavo Padovan
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] device: fix reporting of Connected state for PAN
2013-06-10 11:55 [PATCH] device: fix reporting of Connected state for PAN Gustavo Padovan
@ 2013-06-17 11:03 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-06-17 11:03 UTC (permalink / raw)
To: Gustavo Padovan
Cc: linux-bluetooth@vger.kernel.org, Emilio Pozuelo Monfort,
Gustavo Padovan
Hi Gustavo,
On Mon, Jun 10, 2013 at 2:55 PM, Gustavo Padovan <gustavo@padovan.org> wrote:
> 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
I believe I fixed a similar problem already thus the problem might be
fixed, but perhaps you want to rebase it and resend as it seems a
cleaner/more readable code.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-17 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 11:55 [PATCH] device: fix reporting of Connected state for PAN Gustavo Padovan
2013-06-17 11:03 ` Luiz Augusto von Dentz
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).