From d2a1f8dae9b8f17caa276788eedd74ed35ab34d7 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 12 Apr 2017 15:06:02 +0300 Subject: [PATCH] audio/avdtp: Increase timeout for Suspend request There have been reports that some device may delay the Suspend response when switching to HFP/SCO. --- profiles/audio/avdtp.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 51ead684a..6b85b0755 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -86,6 +86,7 @@ static unsigned int seids; #define AVDTP_MSG_TYPE_REJECT 0x03 #define REQ_TIMEOUT 6 +#define SUSPEND_TIMEOUT 10 #define ABORT_TIMEOUT 2 #define DISCONNECT_TIMEOUT 1 #define START_TIMEOUT 1 @@ -2538,7 +2539,7 @@ static int send_req(struct avdtp *session, gboolean priority, struct pending_req *req) { static int transaction = 0; - int err; + int err, timeout; if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) { session->io = l2cap_connect(session); @@ -2568,10 +2569,18 @@ static int send_req(struct avdtp *session, gboolean priority, session->req = req; - req->timeout = g_timeout_add_seconds(req->signal_id == AVDTP_ABORT ? - ABORT_TIMEOUT : REQ_TIMEOUT, - request_timeout, - session); + switch (req->signal_id) { + case AVDTP_ABORT: + timeout = ABORT_TIMEOUT; + break; + case AVDTP_SUSPEND: + timeout = SUSPEND_TIMEOUT; + break; + default: + timeout = REQ_TIMEOUT; + } + + req->timeout = g_timeout_add_seconds(timeout, request_timeout, session); return 0; failed: -- 2.47.3