From 58a2c3c0b6f5f96f1905d1f7b4ffb7fa69142ebb Mon Sep 17 00:00:00 2001 From: Vikrampal Yadav Date: Wed, 13 Aug 2014 17:35:17 +0530 Subject: [PATCH] monitor: Add AVRCP ListPlayerApplicationSettingAttributes support Support for decoding AVRCP ListPlayerApplicationSettingAttributes added in Bluetooth monitor. --- monitor/avctp.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/monitor/avctp.c b/monitor/avctp.c index 4f8783786..9df8e7596 100644 --- a/monitor/avctp.c +++ b/monitor/avctp.c @@ -150,6 +150,13 @@ #define AVRCP_PACKET_TYPE_CONTINUING 0x02 #define AVRCP_PACKET_TYPE_END 0x03 +/* player attributes */ +#define AVRCP_ATTRIBUTE_ILEGAL 0x00 +#define AVRCP_ATTRIBUTE_EQUALIZER 0x01 +#define AVRCP_ATTRIBUTE_REPEAT_MODE 0x02 +#define AVRCP_ATTRIBUTE_SHUFFLE 0x03 +#define AVRCP_ATTRIBUTE_SCAN 0x04 + static const char *ctype2str(uint8_t ctype) { switch (ctype & 0x0f) { @@ -404,6 +411,24 @@ static const char *pt2str(uint8_t pt) } } +static const char *attr2str(uint8_t attr) +{ + switch (attr) { + case AVRCP_ATTRIBUTE_ILEGAL: + return "Illegal"; + case AVRCP_ATTRIBUTE_EQUALIZER: + return "Equalizer ON/OFF Status"; + case AVRCP_ATTRIBUTE_REPEAT_MODE: + return "Repeat Mode Status"; + case AVRCP_ATTRIBUTE_SHUFFLE: + return "Shuffle ON/OFF Status"; + case AVRCP_ATTRIBUTE_SCAN: + return "Scan ON/OFF Status"; + default: + return "Unknown"; + } +} + static void avrcp_passthrough_packet(const struct l2cap_frame *frame) { } @@ -457,6 +482,22 @@ static void avrcp_list_player_attributes(const struct l2cap_frame *frame, uint8_t ctype, uint8_t len, uint8_t indent) { + uint8_t num; + int i; + + if (len == 0) + return; + + num = *((uint8_t *) frame->data); + print_field("%*cAttributeCount: 0x%02x", (indent - 8), ' ', num); + + for (i = 0; num > 0; num--, i++) { + uint8_t attr; + + attr = *((uint8_t *) (frame->data + 1 + i)); + print_field("%*cAttributeID: 0x%02x (%s)", (indent - 8), ' ', + attr, attr2str(attr)); + } } static void avrcp_list_player_values(const struct l2cap_frame *frame, -- 2.47.3