Diff between e985e6389fef4181ce5b20ffc806523ee6f082db and 4ec67ee8eb171d9f08b4381847964f3336afa7e5

Changed Files

File Additions Deletions Status
tools/parser/avrcp.c +57 -16 modified

Full Patch

diff --git a/tools/parser/avrcp.c b/tools/parser/avrcp.c
index 029a12a..02e7325 100644
--- a/tools/parser/avrcp.c
+++ b/tools/parser/avrcp.c
@@ -1342,6 +1342,60 @@ response:
 	}
 }
 
+static const char *scope2str(uint8_t scope)
+{
+	switch (scope) {
+	case AVRCP_MEDIA_PLAYER_LIST:
+		return "Media Player List";
+	case AVRCP_MEDIA_PLAYER_VFS:
+		return "Media Player Virtual Filesystem";
+	case AVRCP_MEDIA_SEARCH:
+		return "Search";
+	case AVRCP_MEDIA_NOW_PLAYING:
+		return "Now Playing";
+	default:
+		return "Unknown";
+	}
+}
+
+static void avrcp_play_item_dump(int level, struct frame *frm,
+						uint8_t ctype, uint16_t len)
+{
+	uint64_t uid;
+	uint32_t uidcounter;
+	uint8_t scope, status;
+
+	p_indent(level, frm);
+
+	if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+		goto response;
+
+	if (len < 13) {
+		printf("PDU Malformed\n");
+		raw_dump(level, frm);
+		return;
+	}
+
+	scope = get_u8(frm);
+	printf("Scope: 0x%02x (%s)", scope, scope2str(scope));
+
+	p_indent(level, frm);
+
+	uid = get_u64(frm);
+	printf("UID: 0x%16" PRIx64 " (%" PRIu64 ")\n", uid, uid);
+
+	p_indent(level, frm);
+
+	uidcounter = get_u16(frm);
+	printf("UIDCounter: 0x%04x (%u)\n", uidcounter, uidcounter);
+
+	return;
+
+response:
+	status = get_u8(frm);
+	printf("Status: 0x%02x (%s)\n", status, error2str(status));
+}
+
 static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
 {
 	uint8_t pduid, pt;
@@ -1414,6 +1468,9 @@ static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
 	case AVRCP_SET_ADDRESSED_PLAYER:
 		avrcp_set_addressed_player(level + 1, frm, ctype, len);
 		break;
+	case AVRCP_PLAY_ITEM:
+		avrcp_play_item_dump(level + 1, frm, ctype, len);
+		break;
 	default:
 		raw_dump(level, frm);
 	}
@@ -1507,22 +1564,6 @@ static const char *subunit2str(uint8_t subunit)
 	}
 }
 
-static const char *scope2str(uint8_t scope)
-{
-	switch (scope) {
-	case AVRCP_MEDIA_PLAYER_LIST:
-		return "Media Player List";
-	case AVRCP_MEDIA_PLAYER_VFS:
-		return "Media Player Virtual Filesystem";
-	case AVRCP_MEDIA_SEARCH:
-		return "Search";
-	case AVRCP_MEDIA_NOW_PLAYING:
-		return "Now Playing";
-	default:
-		return "Unknown";
-	}
-}
-
 static const char *playertype2str(uint8_t type)
 {
 	switch (type & 0x0F) {