public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command.
@ 2009-03-27 20:23 Nick Pelly
  2009-03-27 20:48 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Pelly @ 2009-03-27 20:23 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-AVCTP-qualification-Handle-more-error-codes.patch --]
[-- Type: application/octet-stream, Size: 2276 bytes --]

From 50d73f9351d8bf4f032dc3a67e0b5968b9083358 Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@google.com>
Date: Fri, 27 Mar 2009 12:57:45 -0700
Subject: [PATCH 1/2] AVCTP qualification: Handle more error codes.

---
 audio/control.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/audio/control.c b/audio/control.c
index 14dfbf5..f7636d6 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -73,7 +73,9 @@
 /* ctype entries */
 #define CTYPE_CONTROL		0x0
 #define CTYPE_STATUS		0x1
+#define CTYPE_NOT_IMPLEMENTED	0x8
 #define CTYPE_ACCEPTED		0x9
+#define CTYPE_REJECTED		0xA
 #define CTYPE_STABLE		0xC
 
 /* opcodes */
@@ -502,21 +504,21 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond,
 			avrcp->code, avrcp->subunit_type, avrcp->subunit_id,
 			avrcp->opcode, operand_count);
 
-	if (avctp->packet_type == AVCTP_PACKET_SINGLE &&
-			avctp->cr == AVCTP_COMMAND &&
-			avctp->pid == htons(AV_REMOTE_SVCLASS_ID) &&
+	if (avctp->packet_type != AVCTP_PACKET_SINGLE) {
+		avctp->cr = AVCTP_RESPONSE;
+		avrcp->code = CTYPE_NOT_IMPLEMENTED;
+	} else if (avctp->pid != htons(AV_REMOTE_SVCLASS_ID)) {
+		avctp->ipid = 1;
+		avctp->cr = AVCTP_RESPONSE;
+		avrcp->code = CTYPE_REJECTED;
+	} else if (avctp->cr == AVCTP_COMMAND &&
 			avrcp->code == CTYPE_CONTROL &&
 			avrcp->subunit_type == SUBUNIT_PANEL &&
 			avrcp->opcode == OP_PASSTHROUGH) {
 		handle_panel_passthrough(session, operands, operand_count);
 		avctp->cr = AVCTP_RESPONSE;
 		avrcp->code = CTYPE_ACCEPTED;
-		ret = write(sock, buf, packet_size);
-	}
-
-	if (avctp->packet_type == AVCTP_PACKET_SINGLE &&
-			avctp->cr == AVCTP_COMMAND &&
-			avctp->pid == htons(AV_REMOTE_SVCLASS_ID) &&
+	} else if (avctp->cr == AVCTP_COMMAND &&
 			avrcp->code == CTYPE_STATUS &&
 			(avrcp->opcode == OP_UNITINFO
 			|| avrcp->opcode == OP_SUBUNITINFO)) {
@@ -524,8 +526,11 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond,
 		avrcp->code = CTYPE_STABLE;
 		debug("reply to %s", avrcp->opcode == OP_UNITINFO ?
 				"OP_UNITINFO" : "OP_SUBUNITINFO");
-		ret = write(sock, buf, packet_size);
+	} else {
+		avctp->cr = AVCTP_RESPONSE;
+		avrcp->code = CTYPE_REJECTED;
 	}
+	ret = write(sock, buf, packet_size);
 
 	return TRUE;
 
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-27 21:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-27 20:23 [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command Nick Pelly
2009-03-27 20:48 ` Johan Hedberg
2009-03-27 20:49   ` Johan Hedberg
2009-03-27 21:13     ` Nick Pelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox