diff --git a/audio/control.c b/audio/control.c
index 57a4edc..9202966 100644
--- a/audio/control.c
+++ b/audio/control.c
operands[0] & 0x7F, status);
}
+/* handle vendordep pdu inside an avctp packet */
+static int handle_vendordep_pdu(struct control *control,
+ struct avrcp_header *avrcp,
+ int operand_count)
+{
+ struct avrcp_spec_avc_pdu *pdu = (void *)(avrcp) +
+ AVRCP_SPECAVCPDU_HEADER_LENGTH;
+
+ /* Reply with REJECT msg with error code 0x0
+ * (Invalid Command) as defined in AVRCP spec (6.15.1) */
+ avrcp->code = CTYPE_REJECTED;
+
+ pdu->packet_type = 0;
+ pdu->rsvd = 0;
+ pdu->params[0] = 0; /* invalid command */
+ pdu->params_len = htons(1);
+
+ return AVRCP_HEADER_LENGTH + AVRCP_SPECAVCPDU_HEADER_LENGTH + 1;
+}
+
static void avctp_disconnected(struct audio_device *dev)
{
struct control *control = dev->control;
"OP_UNITINFO" : "OP_SUBUNITINFO");
} else if (avctp->cr == AVCTP_COMMAND &&
avrcp->opcode == OP_VENDORDEP) {
- /* Reply with REJECT msg with error code 0x0
- * (Invalid Command) as defined in AVRCP spec (6.15.1) */
- struct avrcp_spec_avc_pdu *pdu = (void *) operands;
-
+ int r_size;
+ operand_count -= 3;
avctp->cr = AVCTP_RESPONSE;
- avrcp->code = CTYPE_REJECTED;
-
- pdu->packet_type = 0;
- pdu->rsvd = 0;
- pdu->params[0] = 0; /* invalid command */
- pdu->params_len = htons(1);
-
- packet_size = sizeof(struct avctp_header)
- + sizeof(struct avrcp_header)
- + sizeof(struct avrcp_spec_avc_pdu)
- + 1;
+ r_size = handle_vendordep_pdu(control, avrcp, operand_count);
+ packet_size = AVCTP_HEADER_LENGTH + r_size;
} else {
avctp->cr = AVCTP_RESPONSE;
avrcp->code = CTYPE_REJECTED;