2012-09-04 11:15:54

by Mikel Astiz

[permalink] [raw]
Subject: [PATCH v0 1/3] audio: Remove unused function

From: Mikel Astiz <[email protected]>

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



2012-09-04 12:51:36

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v0 1/3] audio: Remove unused function

Hi Mikel,

On Tue, Sep 04, 2012, Mikel Astiz wrote:
> From: Mikel Astiz <[email protected]>
>
> 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

2012-09-04 11:15:56

by Mikel Astiz

[permalink] [raw]
Subject: [PATCH v0 3/3] audio: Handle error in gateway_request_stream()

From: Mikel Astiz <[email protected]>

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


2012-09-04 11:15:55

by Mikel Astiz

[permalink] [raw]
Subject: [PATCH v0 2/3] audio: Fix gateway in connecting state forever

From: Mikel Astiz <[email protected]>

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