2014-08-08 13:42:33

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 1/2] android/a2dp: Improve avdtp_close function

With this patch avdtp_close does avdtp_abort under the hood in case
stream is not yet in OPEN state.
---
android/avdtp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/android/avdtp.c b/android/avdtp.c
index 89f4860..85ef94b 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -3244,14 +3244,15 @@ int avdtp_close(struct avdtp *session, struct avdtp_stream *stream,
if (!g_slist_find(session->streams, stream))
return -EINVAL;

- if (stream->lsep->state < AVDTP_STATE_OPEN)
- return -EINVAL;
-
if (stream->close_int == TRUE) {
error("avdtp_close: rejecting since close is already initiated");
return -EINVAL;
}

+ /* If stream is not yet in the OPEN state, let's use ABORT_CMD */
+ if (stream->lsep->state < AVDTP_STATE_OPEN)
+ return avdtp_abort(session, stream);
+
if (immediate && session->req && stream == session->req->stream)
return avdtp_abort(session, stream);

--
1.8.4



2014-08-08 14:29:07

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/a2dp: Improve avdtp_close function

Hi Lukasz,

On Fri, Aug 08, 2014, Lukasz Rymanowski wrote:
> With this patch avdtp_close does avdtp_abort under the hood in case
> stream is not yet in OPEN state.
> ---
> android/avdtp.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)

Both patches have been applied. Thanks.

Johan

2014-08-08 13:42:34

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 2/2] android/a2dp: Fix for PTS testcase

This patch is a fix for PTS TC_SRC_REL_BV_01_I
PTS expects us to CLOSE stream not to ABORT the stream when
disconnecting A2DP.
---
android/avdtp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/avdtp.c b/android/avdtp.c
index 85ef94b..3985fb3 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -2180,7 +2180,8 @@ void avdtp_shutdown(struct avdtp *session)
for (l = session->streams; l; l = g_slist_next(l)) {
struct avdtp_stream *stream = l->data;

- if (stream->abort_int || avdtp_abort(session, stream) == 0)
+ if (stream->abort_int ||
+ avdtp_close(session, stream, TRUE) == 0)
aborting = true;
}

--
1.8.4