* [PATCH] Finalize discovery if all stream end points are In Use
@ 2011-06-22 12:47 Peter Hurley
2011-06-23 6:37 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Peter Hurley @ 2011-06-22 12:47 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
When handling the discover response, if all stream end points are
in use, then we must finalize discovery, as no GET_CAPABILITIES
command will be issued.
---
audio/avdtp.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/audio/avdtp.c b/audio/avdtp.c
index ead956e..0650bc3 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -2736,6 +2736,8 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
{
int sep_count, i;
uint8_t getcap_cmd;
+ int ret = 0;
+ gboolean getcap_pending = FALSE;
if (session->version >= 0x0103 && session->server->version >= 0x0103)
getcap_cmd = AVDTP_GET_ALL_CAPABILITIES;
@@ -2748,7 +2750,6 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
struct avdtp_remote_sep *sep;
struct avdtp_stream *stream;
struct seid_req req;
- int ret;
DBG("seid %d type %d media %d in use %d",
resp->seps[i].seid, resp->seps[i].type,
@@ -2774,12 +2775,14 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
ret = send_request(session, TRUE, NULL, getcap_cmd,
&req, sizeof(req));
- if (ret < 0) {
- finalize_discovery(session, -ret);
+ if (ret < 0)
break;
- }
+ getcap_pending = TRUE;
}
+ if (!getcap_pending)
+ finalize_discovery(session, -ret);
+
return TRUE;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Finalize discovery if all stream end points are In Use
2011-06-22 12:47 [PATCH] Finalize discovery if all stream end points are In Use Peter Hurley
@ 2011-06-23 6:37 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2011-06-23 6:37 UTC (permalink / raw)
To: Peter Hurley; +Cc: linux-bluetooth@vger.kernel.org
Hi Peter,
On Wed, Jun 22, 2011 at 3:47 PM, Peter Hurley <peter@hurleysoftware.com> wrote:
> When handling the discover response, if all stream end points are
> in use, then we must finalize discovery, as no GET_CAPABILITIES
> command will be issued.
> ---
> audio/avdtp.c | 11 +++++++----
> 1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/audio/avdtp.c b/audio/avdtp.c
> index ead956e..0650bc3 100644
> --- a/audio/avdtp.c
> +++ b/audio/avdtp.c
> @@ -2736,6 +2736,8 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
> {
> int sep_count, i;
> uint8_t getcap_cmd;
> + int ret = 0;
> + gboolean getcap_pending = FALSE;
>
> if (session->version >= 0x0103 && session->server->version >= 0x0103)
> getcap_cmd = AVDTP_GET_ALL_CAPABILITIES;
> @@ -2748,7 +2750,6 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
> struct avdtp_remote_sep *sep;
> struct avdtp_stream *stream;
> struct seid_req req;
> - int ret;
>
> DBG("seid %d type %d media %d in use %d",
> resp->seps[i].seid, resp->seps[i].type,
> @@ -2774,12 +2775,14 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
>
> ret = send_request(session, TRUE, NULL, getcap_cmd,
> &req, sizeof(req));
> - if (ret < 0) {
> - finalize_discovery(session, -ret);
> + if (ret < 0)
> break;
> - }
> + getcap_pending = TRUE;
> }
>
> + if (!getcap_pending)
> + finalize_discovery(session, -ret);
> +
> return TRUE;
> }
Sounds like a bug to me not an improvement so I suggest you start your
commit message with the word 'Fix ...', patch itself looks good
though.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-23 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-22 12:47 [PATCH] Finalize discovery if all stream end points are In Use Peter Hurley
2011-06-23 6:37 ` 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).