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

* Re: [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command.
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2009-03-27 20:48 UTC (permalink / raw)
  To: Nick Pelly; +Cc: linux-bluetooth

Hi Nick,

On Fri, Mar 27, 2009, Nick Pelly wrote:
> 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.

This one has been pushed upstream. Thanks.

Johan

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

* Re: [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command.
  2009-03-27 20:48 ` Johan Hedberg
@ 2009-03-27 20:49   ` Johan Hedberg
  2009-03-27 21:13     ` Nick Pelly
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2009-03-27 20:49 UTC (permalink / raw)
  To: Nick Pelly, linux-bluetooth

On Fri, Mar 27, 2009, Johan Hedberg wrote:
> > 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.
> 
> This one has been pushed upstream. Thanks.

Sorry, that was supposed to refer to the other patch. The general reject one
doesn't look right. There's no message type of 0x01 according to AVDTP 1.2. The
way I interpret it is that general reject should use the normal reject message
type.

Johan

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

* Re: [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command.
  2009-03-27 20:49   ` Johan Hedberg
@ 2009-03-27 21:13     ` Nick Pelly
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Pelly @ 2009-03-27 21:13 UTC (permalink / raw)
  To: Nick Pelly, linux-bluetooth

On Fri, Mar 27, 2009 at 1:49 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> On Fri, Mar 27, 2009, Johan Hedberg wrote:
>> > 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.
>>
>> This one has been pushed upstream. Thanks.
>
> Sorry, that was supposed to refer to the other patch. The general reject one
> doesn't look right. There's no message type of 0x01 according to AVDTP 1.2. The
> way I interpret it is that general reject should use the normal reject message
> type.

Here is the information we received from a partner for this patch:

TP-SIG-SMG-BI-28-C

Test Condition
Fields of AVDTP_CMD:
- Transaction_label = TransactionLowerTester = Any value
- Packet_type = 00 (single packet)
- Reserved = 00
- Message_type = 00 (command)
- Signal_Id = 0x3F (Undefined signal id)

Pass verdict
The lower tester receives the AVDTP signaling message with the fields:
Transaction_label = TransactionLowerTester
Packet_type = 00 (single packet)
Message type = 01 (general reject)
Bits 6 and 7 of Octet 1 are both set to ‘0’
Other 6 bits = Set to the invalid signal identifier being rejected (0x3F)


However I can't find this same information in the current version of
the AVDTP test specification. Maybe it was from an older version of
the test spec? I couldn't work out where on bluetooth.org to get older
versions of test specs so I cannot confirm this.

In any case, we were told this change is recommended by the BQE, but
not required. So probably fine to skip this one.

Nick

^ permalink raw reply	[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