Skip to contentSkip to conversation

monitor/avctp: Decode player features

PATCH Applied Luiz Augusto von Dentz 1 participant 2 messages Oct 13, 2015 – Oct 14, 2015 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/1 monitor/avctp: Decode player features

From: Luiz Augusto von Dentz <[email protected]>

This decodes the bits related to browsing channel which is useful to debug:

Quoted 1 line

ACL Data RX: Handle 256 flags 0x02 dlen 68

      Channel: 69 len 64 ctrl 0x0100 [PSM 27 mode 3] {chan 5}
      I-frame: Unsegmented TxSeq 0 ReqSeq 1
      AVCTP Browsing: Response: type 0x00 label 0 PID 0x110e
        AVRCP: GetFolderItems: len 0x0036
          Status: 0x04 (Success)
          UIDCounter: 0x0000 (0)
          NumOfItems: 0x0001 (1)
          Item: 0x01 (Media Player)
          Length: 0x002e (46)
          PlayerID: 0x0001 (1)
          PlayerType: 0x0001 (Audio)
          PlayerSubType: 0x00000000 (None)
          PlayStatus: 0x01 (PLAYING)
          Features: 0x00000000003700050000000000000000
            Advanced Control Player
            Browsing
            NowPlaying
---
 monitor/avctp.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
monitor/avctp.c +41 -0
index d06640e..232365e 100644
@@ -1813,6 +1813,45 @@ response:
 	return true;
 }
 
+
+static struct {
+	const char *str;
+	bool reserved;
+} features_table[] = {
+	/* Ignore passthrough bits */
+	[58] = { "Advanced Control Player" },
+	[59] = { "Browsing" },
+	[60] = { "Searching" },
+	[61] = { "AddToNowPlaying" },
+	[62] = { "Unique UIDs" },
+	[63] = { "OnlyBrowsableWhenAddressed" },
+	[64] = { "OnlySearchableWhenAddressed" },
+	[65] = { "NowPlaying" },
+	[66] = { "UIDPersistency" },
+	/* 67-127 reserved */
+	[67 ... 127] = { .reserved = true },
+};
+
+static void print_features(uint8_t features[16], uint8_t indent)
+{
+	int i;
+
+	for (i = 0; i < 127; i++) {
+		if (!(features[i / 8] & (1 << (i % 8))))
+			continue;
+
+		if (features_table[i].reserved) {
+			print_text(COLOR_WHITE_BG, "Unknown bit %u", i);
+			continue;
+		}
+
+		if (!features_table[i].str)
+			continue;
+
+		print_field("%*c%s", indent, ' ', features_table[i].str);
+	}
+}
+
 static bool avrcp_media_player_item(struct avctp_frame *avctp_frame,
 							uint8_t indent)
 {
@@ -1856,6 +1895,8 @@ static bool avrcp_media_player_item(struct avctp_frame *avctp_frame,
 
 	printf("\n");
 
+	print_features(features, indent + 2);
+
 	if (!l2cap_frame_get_be16(frame, &charset))
 		return false;
 
Signature · 1 line
2.4.3
author maintainer Applied
#1 lore raw

Hi,

Quoted 87 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This decodes the bits related to browsing channel which is useful to debug:

Quoted 1 line

ACL Data RX: Handle 256 flags 0x02 dlen 68

      Channel: 69 len 64 ctrl 0x0100 [PSM 27 mode 3] {chan 5}
      I-frame: Unsegmented TxSeq 0 ReqSeq 1
      AVCTP Browsing: Response: type 0x00 label 0 PID 0x110e
        AVRCP: GetFolderItems: len 0x0036
          Status: 0x04 (Success)
          UIDCounter: 0x0000 (0)
          NumOfItems: 0x0001 (1)
          Item: 0x01 (Media Player)
          Length: 0x002e (46)
          PlayerID: 0x0001 (1)
          PlayerType: 0x0001 (Audio)
          PlayerSubType: 0x00000000 (None)
          PlayStatus: 0x01 (PLAYING)
          Features: 0x00000000003700050000000000000000
            Advanced Control Player
            Browsing
            NowPlaying
---
 monitor/avctp.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
monitor/avctp.c +41 -1
index d06640e..232365e 100644
@@ -1813,6 +1813,45 @@ response:
        return true;
 }
 
+
+static struct {
+       const char *str;
+       bool reserved;
+} features_table[] = {
+       /* Ignore passthrough bits */
+       [58] = { "Advanced Control Player" },
+       [59] = { "Browsing" },
+       [60] = { "Searching" },
+       [61] = { "AddToNowPlaying" },
+       [62] = { "Unique UIDs" },
+       [63] = { "OnlyBrowsableWhenAddressed" },
+       [64] = { "OnlySearchableWhenAddressed" },
+       [65] = { "NowPlaying" },
+       [66] = { "UIDPersistency" },
+       /* 67-127 reserved */
+       [67 ... 127] = { .reserved = true },
+};
+
+static void print_features(uint8_t features[16], uint8_t indent)
+{
+       int i;
+
+       for (i = 0; i < 127; i++) {
+               if (!(features[i / 8] & (1 << (i % 8))))
+                       continue;
+
+               if (features_table[i].reserved) {
+                       print_text(COLOR_WHITE_BG, "Unknown bit %u", i);
+                       continue;
+               }
+
+               if (!features_table[i].str)
+                       continue;
+
+               print_field("%*c%s", indent, ' ', features_table[i].str);
+       }
+}
+
 static bool avrcp_media_player_item(struct avctp_frame *avctp_frame,
                                                        uint8_t indent)
 {
@@ -1856,6 +1895,8 @@ static bool avrcp_media_player_item(struct avctp_frame *avctp_frame,
 
        printf("\n");
 
+       print_features(features, indent + 2);
+
        if (!l2cap_frame_get_be16(frame, &charset))
                return false;
 
--
Quoted 1 line

2.4.3

Applied.

Signature · 1 line
Luiz Augusto von Dentz