Diff between 7cdfddada0609d0df5cfe3fe3a2fba6355e53d26 and 4987ddbccb0ba35e4cfa36478c054c4d3c441f88

Changed Files

File Additions Deletions Status
profiles/audio/avctp.c +13 -4 modified

Full Patch

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 0807be1..daf39a7 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -61,6 +61,8 @@
  */
 #define AVC_PRESS_TIMEOUT	2
 
+#define CONTROL_TIMEOUT		AVC_PRESS_TIMEOUT
+
 #define QUIRK_NO_RELEASE 1 << 0
 
 /* Message types */
@@ -754,10 +756,18 @@ static int process_control(void *data)
 {
 	struct avctp_control_req *req = data;
 	struct avctp_pending_req *p = req->p;
+	int ret;
 
-	return avctp_send(p->chan, p->transaction, AVCTP_COMMAND, req->code,
-					req->subunit, req->op,
-					req->operands, req->operand_count);
+	ret = avctp_send(p->chan, p->transaction, AVCTP_COMMAND, req->code,
+			req->subunit, req->op, req->operands,
+			req->operand_count);
+	if (ret < 0)
+		return ret;
+
+	p->timeout = g_timeout_add_seconds(CONTROL_TIMEOUT, req_timeout,
+								p->chan);
+
+	return 0;
 }
 
 static int process_browsing(void *data)
@@ -791,7 +801,6 @@ static gboolean process_queue(void *user_data)
 		return FALSE;
 
 	chan->p = p;
-	p->timeout = g_timeout_add_seconds(2, req_timeout, chan);
 
 	return FALSE;