From dfaecf7d0c1c0cc084c0f7a21f73870926e9ef6e Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 18 Oct 2017 13:27:38 +0300 Subject: [PATCH] avctp: Reintroduce a timeout for the browsing channel The spec suggests to rely on the link supervision timeout to detect when the remote is not responding but this ignores the fact that due to a bug or bad implementation stacks may ignore the request causing the whole request queue to stall. --- profiles/audio/avctp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index f8ec19c9c..174f401d6 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -62,6 +62,7 @@ #define AVC_PRESS_TIMEOUT 2 #define CONTROL_TIMEOUT AVC_PRESS_TIMEOUT +#define BROWSING_TIMEOUT 10 #define QUIRK_NO_RELEASE 1 << 0 @@ -810,9 +811,17 @@ static int process_browsing(void *data) { struct avctp_browsing_req *req = data; struct avctp_pending_req *p = req->p; + int ret; - return avctp_browsing_send(p->chan, p->transaction, AVCTP_COMMAND, + ret = avctp_browsing_send(p->chan, p->transaction, AVCTP_COMMAND, req->operands, req->operand_count); + if (ret < 0) + return ret; + + p->timeout = g_timeout_add_seconds(BROWSING_TIMEOUT, req_timeout, + p->chan); + + return 0; } static gboolean process_queue(void *user_data) -- 2.47.3