summaryrefslogtreecommitdiff
path: root/audio/avrcp.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2012-03-07 17:23:14 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-13 13:50:19 +0200
commitcff8c39fb53a931e406891391fb8e7e3c52678ae (patch)
tree88edc1c24a0a119f21ad210fe524251e34f4b149 /audio/avrcp.c
parente8e323e1fbd097672ad37580019055ec1ed752b3 (diff)
downloadbluez-cff8c39fb53a931e406891391fb8e7e3c52678ae.tar.gz
avrcp: Add error code for rejected vendor command
Fix response for any vendor commands when there are no players registered. According to the specification responses should be REJECTED with error code. "For error response PDU the response parameter is always the error code independent of the response format defined for ACCEPTED PDU response for the corresponding PDU command." (source: section 4.7.9 of AVRCP 1.3 specification)
Diffstat (limited to 'audio/avrcp.c')
-rw-r--r--audio/avrcp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/audio/avrcp.c b/audio/avrcp.c
index 4573133c2..8eba04642 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1092,6 +1092,21 @@ err_metadata:
return AVRCP_HEADER_LENGTH + 1;
}
+size_t avrcp_handle_vendor_reject(uint8_t *code, uint8_t *operands)
+{
+ struct avrcp_header *pdu = (void *) operands;
+ uint32_t company_id = get_company_id(pdu->company_id);
+
+ *code = AVC_CTYPE_REJECTED;
+ pdu->params_len = htons(1);
+ pdu->params[0] = E_INTERNAL;
+
+ DBG("rejecting AVRCP PDU 0x%02X, company 0x%06X len 0x%04X",
+ pdu->pdu_id, company_id, pdu->params_len);
+
+ return AVRCP_HEADER_LENGTH + 1;
+}
+
static struct avrcp_server *find_server(GSList *list, const bdaddr_t *src)
{
for (; list; list = list->next) {