From: Nick Pelly <npelly@google.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command.
Date: Fri, 27 Mar 2009 13:23:57 -0700 [thread overview]
Message-ID: <35c90d960903271323w6f206741ya366a11464461235@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2009-03-27 20:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-27 20:23 Nick Pelly [this message]
2009-03-27 20:48 ` [PATCH] AVDTP Qualification: Use GENERAL_REJECT instead of REJECT for unknown command Johan Hedberg
2009-03-27 20:49 ` Johan Hedberg
2009-03-27 21:13 ` Nick Pelly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35c90d960903271323w6f206741ya366a11464461235@mail.gmail.com \
--to=npelly@google.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox