linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v0 1/3] audio: Remove unused function
@ 2012-09-04 11:15 Mikel Astiz
  2012-09-04 11:15 ` [PATCH v0 2/3] audio: Fix gateway in connecting state forever Mikel Astiz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mikel Astiz @ 2012-09-04 11:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

gateway_config_stream() is now unnecessary after the removal of the unix
socket support in commit 1d9d0527cfb6d96a976ede56bd43a2bc16bb5f21.
---
 audio/gateway.c |   16 ----------------
 audio/gateway.h |    2 --
 2 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index c0159a4..77a8cb0 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -858,22 +858,6 @@ unsigned int gateway_request_stream(struct audio_device *dev,
 	return connect_cb_new(gw, cb, user_data);
 }
 
-int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb,
-				void *user_data)
-{
-	struct gateway *gw = dev->gateway;
-	unsigned int id;
-
-	id = connect_cb_new(gw, cb, user_data);
-
-	if (!gw->rfcomm)
-		get_records(dev);
-	else if (cb)
-		g_idle_add(request_stream_cb, dev);
-
-	return id;
-}
-
 gboolean gateway_cancel_stream(struct audio_device *dev, unsigned int id)
 {
 	struct gateway *gw = dev->gateway;
diff --git a/audio/gateway.h b/audio/gateway.h
index 6fde445..0893962 100644
--- a/audio/gateway.h
+++ b/audio/gateway.h
@@ -64,8 +64,6 @@ int gateway_connect_sco(struct audio_device *dev, GIOChannel *chan);
 void gateway_start_service(struct audio_device *device);
 unsigned int gateway_request_stream(struct audio_device *dev,
 			gateway_stream_cb_t cb, void *user_data);
-int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb,
-			void *user_data);
 gboolean gateway_cancel_stream(struct audio_device *dev, unsigned int id);
 int gateway_get_sco_fd(struct audio_device *dev);
 void gateway_suspend_stream(struct audio_device *dev);
-- 
1.7.7.6


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

* [PATCH v0 2/3] audio: Fix gateway in connecting state forever
  2012-09-04 11:15 [PATCH v0 1/3] audio: Remove unused function Mikel Astiz
@ 2012-09-04 11:15 ` Mikel Astiz
  2012-09-04 11:15 ` [PATCH v0 3/3] audio: Handle error in gateway_request_stream() Mikel Astiz
  2012-09-04 12:51 ` [PATCH v0 1/3] audio: Remove unused function Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Mikel Astiz @ 2012-09-04 11:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

If bt_search_service() fails the state should be left unchanged.
Otherwise the gateway state is set forever to GATEWAY_STATE_CONNECTING.

This issue can be easily reproduced if a connection attempt is done
very soon after startup.
---
 audio/gateway.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 77a8cb0..8603038 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -526,11 +526,18 @@ fail:
 static int get_records(struct audio_device *device)
 {
 	uuid_t uuid;
+	int err;
 
-	change_state(device, GATEWAY_STATE_CONNECTING);
 	sdp_uuid16_create(&uuid, HANDSFREE_AGW_SVCLASS_ID);
-	return bt_search_service(&device->src, &device->dst, &uuid,
-				get_record_cb, device, NULL);
+
+	err = bt_search_service(&device->src, &device->dst, &uuid,
+						get_record_cb, device, NULL);
+	if (err < 0)
+		return err;
+
+	change_state(device, GATEWAY_STATE_CONNECTING);
+
+	return 0;
 }
 
 static DBusMessage *ag_connect(DBusConnection *conn, DBusMessage *msg,
-- 
1.7.7.6


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

* [PATCH v0 3/3] audio: Handle error in gateway_request_stream()
  2012-09-04 11:15 [PATCH v0 1/3] audio: Remove unused function Mikel Astiz
  2012-09-04 11:15 ` [PATCH v0 2/3] audio: Fix gateway in connecting state forever Mikel Astiz
@ 2012-09-04 11:15 ` Mikel Astiz
  2012-09-04 12:51 ` [PATCH v0 1/3] audio: Remove unused function Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Mikel Astiz @ 2012-09-04 11:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

gateway_request_stream() should check if the call to get_records() has
succeeded, and fail otherwise.
---
 audio/gateway.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 8603038..0603f12 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -846,9 +846,10 @@ unsigned int gateway_request_stream(struct audio_device *dev,
 	GError *err = NULL;
 	GIOChannel *io;
 
-	if (!gw->rfcomm)
-		get_records(dev);
-	else if (!gw->sco) {
+	if (!gw->rfcomm) {
+		if (get_records(dev) < 0)
+			return 0;
+	} else if (!gw->sco) {
 		io = bt_io_connect(sco_connect_cb, dev, NULL, &err,
 				BT_IO_OPT_SOURCE_BDADDR, &dev->src,
 				BT_IO_OPT_DEST_BDADDR, &dev->dst,
-- 
1.7.7.6


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

* Re: [PATCH v0 1/3] audio: Remove unused function
  2012-09-04 11:15 [PATCH v0 1/3] audio: Remove unused function Mikel Astiz
  2012-09-04 11:15 ` [PATCH v0 2/3] audio: Fix gateway in connecting state forever Mikel Astiz
  2012-09-04 11:15 ` [PATCH v0 3/3] audio: Handle error in gateway_request_stream() Mikel Astiz
@ 2012-09-04 12:51 ` Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-09-04 12:51 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz

Hi Mikel,

On Tue, Sep 04, 2012, Mikel Astiz wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
> 
> gateway_config_stream() is now unnecessary after the removal of the unix
> socket support in commit 1d9d0527cfb6d96a976ede56bd43a2bc16bb5f21.
> ---
>  audio/gateway.c |   16 ----------------
>  audio/gateway.h |    2 --
>  2 files changed, 0 insertions(+), 18 deletions(-)

All three patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2012-09-04 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 11:15 [PATCH v0 1/3] audio: Remove unused function Mikel Astiz
2012-09-04 11:15 ` [PATCH v0 2/3] audio: Fix gateway in connecting state forever Mikel Astiz
2012-09-04 11:15 ` [PATCH v0 3/3] audio: Handle error in gateway_request_stream() Mikel Astiz
2012-09-04 12:51 ` [PATCH v0 1/3] audio: Remove unused function Johan Hedberg

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).