Diff between 0d0c2f2b8333274c2b05b7524a92aa055617ab12 and e11dc9b16b28b1d5b3a33591c6c6432a8b3de6c6

Changed Files

File Additions Deletions Status
tools/parser/avrcp.c +51 -0 modified

Full Patch

diff --git a/tools/parser/avrcp.c b/tools/parser/avrcp.c
index 2b1cb40..de52d51 100644
--- a/tools/parser/avrcp.c
+++ b/tools/parser/avrcp.c
@@ -150,6 +150,13 @@
 #define AVRCP_STATUS_NO_AVAILABLE_PLAYERS		0x15
 #define AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED		0x16
 
+/* 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) {
@@ -419,6 +426,47 @@ static void avrcp_get_capabilities_dump(int level, struct frame *frm, uint16_t l
 	}
 }
 
+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_list_player_attributes_dump(int level, struct frame *frm,
+								uint16_t len)
+{
+	uint8_t num;
+
+	if (len == 0)
+		return;
+
+	p_indent(level, frm);
+
+	num = get_u8(frm);
+	printf("AttributeCount: 0x%02x\n", num);
+
+	for (; num > 0; num--) {
+		uint8_t attr;
+
+		p_indent(level, frm);
+
+		attr = get_u8(frm);
+		printf("AttributeID: 0x%02x (%s)\n", attr, attr2str(attr));
+	}
+}
+
 static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
 {
 	uint8_t pduid, pt;
@@ -448,6 +496,9 @@ static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
 	case AVRCP_GET_CAPABILITIES:
 		avrcp_get_capabilities_dump(level + 1, frm, len);
 		break;
+	case AVRCP_LIST_PLAYER_ATTRIBUTES:
+		avrcp_list_player_attributes_dump(level + 1, frm, len);
+		break;
 	default:
 		raw_dump(level, frm);
 	}