Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix add disconnect watch in connecting state
@ 2010-11-04 13:20 Daniel Örstadius
  2010-11-04 18:16 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Örstadius @ 2010-11-04 13:20 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-Fix-add-disconnect-watch-in-connecting-state.patch --]
[-- Type: text/x-patch, Size: 948 bytes --]

From f705532320bdfb47a06df72c6d031ca096834a3a Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Wed, 3 Nov 2010 14:12:29 +0200
Subject: [PATCH] Fix add disconnect watch in connecting state

If disconnect_cb is added only in the connected state, the callback
will not be triggered if Device.Disconnected is called during a
connection setup and the RFCOMM channel of HFP will not be cleanly
disconnected.
---
 audio/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/device.c b/audio/device.c
index 9554c7b..2e75538 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -231,7 +231,7 @@ static void device_set_state(struct audio_device *dev, audio_state_t new_state)
 							priv->dc_id);
 			priv->dc_id = 0;
 		}
-	} else if (new_state == AUDIO_STATE_CONNECTED)
+	} else
 		priv->dc_id = device_add_disconnect_watch(dev->btd_dev,
 						disconnect_cb, dev, NULL);
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix add disconnect watch in connecting state
  2010-11-04 13:20 [PATCH] Fix add disconnect watch in connecting state Daniel Örstadius
@ 2010-11-04 18:16 ` Johan Hedberg
  2010-11-05  8:59   ` Daniel Örstadius
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2010-11-04 18:16 UTC (permalink / raw)
  To: Daniel Örstadius; +Cc: linux-bluetooth

Hi Daniel,

On Thu, Nov 04, 2010, Daniel Örstadius wrote:
> If disconnect_cb is added only in the connected state, the callback
> will not be triggered if Device.Disconnected is called during a
> connection setup and the RFCOMM channel of HFP will not be cleanly
> disconnected.
> ---
>  audio/device.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/audio/device.c b/audio/device.c
> index 9554c7b..2e75538 100644
> --- a/audio/device.c
> +++ b/audio/device.c
> @@ -231,7 +231,7 @@ static void device_set_state(struct audio_device *dev, audio_state_t new_state)
>  							priv->dc_id);
>  			priv->dc_id = 0;
>  		}
> -	} else if (new_state == AUDIO_STATE_CONNECTED)
> +	} else
>  		priv->dc_id = device_add_disconnect_watch(dev->btd_dev,
>  						disconnect_cb, dev, NULL);
>  

This doesn't seem quite right to me. Aren't you now adding a disconnect
callback twice: once for CONNECTING and a second time for CONNECTED? It
seems like you should only add it when new_state == CONNECTING, right?

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix add disconnect watch in connecting state
  2010-11-04 18:16 ` Johan Hedberg
@ 2010-11-05  8:59   ` Daniel Örstadius
  2010-11-05  9:18     ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Örstadius @ 2010-11-05  8:59 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

On Thu, Nov 4, 2010 at 8:16 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> This doesn't seem quite right to me. Aren't you now adding a disconnect
> callback twice: once for CONNECTING and a second time for CONNECTED? It
> seems like you should only add it when new_state == CONNECTING, right?
>

Yes, that seems right, attaching updated patch.

/Daniel

[-- Attachment #2: 0001-Fix-add-disconnect-watch-in-connecting-state.patch --]
[-- Type: text/x-patch, Size: 948 bytes --]

From e42ce63878f368893e5e119d27a5477dd430f9ae Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Fri, 5 Nov 2010 10:49:41 +0200
Subject: [PATCH] Fix add disconnect watch in connecting state

If disconnect_cb is not added until the connected state, the
callback will not be triggered if Device.Disconnected is called
while the audio profiles are still connecting.
---
 audio/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/device.c b/audio/device.c
index 9554c7b..eff8231 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -231,7 +231,7 @@ static void device_set_state(struct audio_device *dev, audio_state_t new_state)
 							priv->dc_id);
 			priv->dc_id = 0;
 		}
-	} else if (new_state == AUDIO_STATE_CONNECTED)
+	} else if (new_state == AUDIO_STATE_CONNECTING)
 		priv->dc_id = device_add_disconnect_watch(dev->btd_dev,
 						disconnect_cb, dev, NULL);
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix add disconnect watch in connecting state
  2010-11-05  8:59   ` Daniel Örstadius
@ 2010-11-05  9:18     ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2010-11-05  9:18 UTC (permalink / raw)
  To: Daniel Örstadius; +Cc: linux-bluetooth

Hi Daniel,

On Fri, Nov 05, 2010, Daniel Örstadius wrote:
> On Thu, Nov 4, 2010 at 8:16 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> > This doesn't seem quite right to me. Aren't you now adding a disconnect
> > callback twice: once for CONNECTING and a second time for CONNECTED? It
> > seems like you should only add it when new_state == CONNECTING, right?
> >
> 
> Yes, that seems right, attaching updated patch.

Thanks. The patch is now in the upstream tree.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-05  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 13:20 [PATCH] Fix add disconnect watch in connecting state Daniel Örstadius
2010-11-04 18:16 ` Johan Hedberg
2010-11-05  8:59   ` Daniel Örstadius
2010-11-05  9:18     ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox