Decodes below AVRCP browsing packets,
1) Get Item Attibutes
2) Search Item
3) General Reject
Bharat Panda (3):
monitor: Add Support for AVRCP GetItemAttributes
monitor: Add support for AVRCP Search
monitor: Add support for AVRCP GeneralReject
monitor/avctp.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 173 insertions(+)
--
1.9.1
Hi Bharat,
On Tue, Apr 21, 2015 at 3:05 PM, Bharat Panda <[email protected]> wrote:
> Decodes below AVRCP browsing packets,
>
> 1) Get Item Attibutes
> 2) Search Item
> 3) General Reject
>
> Bharat Panda (3):
> monitor: Add Support for AVRCP GetItemAttributes
> monitor: Add support for AVRCP Search
> monitor: Add support for AVRCP GeneralReject
>
> monitor/avctp.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 173 insertions(+)
>
> --
> 1.9.1
Applied, thanks.
--
Luiz Augusto von Dentz
Support for AVRCP GeneralReject added to btmon.
---
monitor/avctp.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index ccafc80..e03e527 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1954,6 +1954,30 @@ static bool avrcp_media_element_item(struct avctp_frame *avctp_frame,
return true;
}
+static bool avrcp_general_reject(struct avctp_frame *avctp_frame)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint8_t status, indent = 2;
+
+ if (avctp_frame->hdr & 0x02)
+ goto response;
+
+ print_field("%*cPDU Malformed", indent, ' ');
+ packet_hexdump(frame->data, frame->size);
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", indent, ' ',
+ status, error2str(status));
+
+ return true;
+}
+
+
static bool avrcp_search_item(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -2282,6 +2306,9 @@ static bool avrcp_browsing_packet(struct avctp_frame *avctp_frame)
case AVRCP_SEARCH:
avrcp_search_item(avctp_frame);
break;
+ case AVRCP_GENERAL_REJECT:
+ avrcp_general_reject(avctp_frame);
+ break;
default:
packet_hexdump(frame->data, frame->size);
}
--
1.9.1
Support for AVRCP Search item added to btmon.
Channel: 65 len 17 ctrl 0x0000 [PSM 27 mode 3] {chan 1}
I-frame: Unsegmented TxSeq 0 ReqSeq 0
AVCTP Browsing: Command: type 0x00 label 0 PID 0x110e
AVRCP: Search: len 0x0007
CharsetID: 0x006a (UTF-8)
Length: 0x0003 (3)
String: New
---
monitor/avctp.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 95475a0..ccafc80 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1954,6 +1954,72 @@ static bool avrcp_media_element_item(struct avctp_frame *avctp_frame,
return true;
}
+static bool avrcp_search_item(struct avctp_frame *avctp_frame)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint32_t items;
+ uint16_t charset, namelen, uidcounter;
+ uint8_t status, indent = 2;
+
+ if (avctp_frame->hdr & 0x02)
+ goto response;
+
+ if (frame->size < 4) {
+ printf("PDU Malformed\n");
+ packet_hexdump(frame->data, frame->size);
+ return false;
+ }
+
+ if (!l2cap_frame_get_be16(frame, &charset))
+ return false;
+
+ print_field("%*cCharsetID: 0x%04x (%s)", indent, ' ',
+ charset, charset2str(charset));
+
+ if (!l2cap_frame_get_be16(frame, &namelen))
+ return false;
+
+ print_field("%*cLength: 0x%04x (%u)", indent, ' ', namelen, namelen);
+
+ printf("%*cString: ", indent+8, ' ');
+ for (; namelen > 0; namelen--) {
+ uint8_t c;
+
+ if (!l2cap_frame_get_u8(frame, &c))
+ return false;
+
+ printf("%1c", isprint(c) ? c : '.');
+ }
+
+ printf("\n");
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", indent, ' ',
+ status, error2str(status));
+
+ if (frame->size == 1)
+ return false;
+
+ if (!l2cap_frame_get_be16(frame, &uidcounter))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", indent, ' ',
+ uidcounter, uidcounter);
+
+ if (!l2cap_frame_get_be32(frame, &items))
+ return false;
+
+ print_field("%*cNumber of Items: 0x%04x (%u)", indent, ' ',
+ items, items);
+
+ return true;
+}
+
static bool avrcp_get_item_attributes(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -2213,6 +2279,9 @@ static bool avrcp_browsing_packet(struct avctp_frame *avctp_frame)
case AVRCP_GET_ITEM_ATTRIBUTES:
avrcp_get_item_attributes(avctp_frame);
break;
+ case AVRCP_SEARCH:
+ avrcp_search_item(avctp_frame);
+ break;
default:
packet_hexdump(frame->data, frame->size);
}
--
1.9.1
Support for decoding AVRCP GetItemAttributes added to btmon.
Channel: 65 len 26 ctrl 0x0102 [PSM 27 mode 3] {chan 1}
I-frame: Unsegmented TxSeq 1 ReqSeq 1
AVCTP Browsing: Command: type 0x00 label 0 PID 0x110e
AVRCP: GetItemAttributes: len 0x0010
Scope: 0x01 (Media Player Virtual Filesystem)
UID: 0x0000000000000001 (1)
UIDCounter: 0x0000 (0)
AttributeCount: 0x01 (1)
AttributeID: 0x00000001 (Title)
---
monitor/avctp.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index f4f3250..95475a0 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1954,6 +1954,80 @@ static bool avrcp_media_element_item(struct avctp_frame *avctp_frame,
return true;
}
+static bool avrcp_get_item_attributes(struct avctp_frame *avctp_frame)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint64_t uid;
+ uint16_t uidcounter;
+ uint8_t scope, count, status, indent = 2;
+
+ if (avctp_frame->hdr & 0x02)
+ goto response;
+
+ if (frame->size < 12) {
+ print_field("%*cPDU Malformed", indent, ' ');
+ packet_hexdump(frame->data, frame->size);
+ return false;
+ }
+
+ if (!l2cap_frame_get_u8(frame, &scope))
+ return false;
+
+ print_field("%*cScope: 0x%02x (%s)", indent, ' ',
+ scope, scope2str(scope));
+
+ if (!l2cap_frame_get_be64(frame, &uid))
+ return false;
+
+ print_field("%*cUID: 0x%016" PRIx64 " (%" PRIu64 ")", indent,
+ ' ', uid, uid);
+
+ if (!l2cap_frame_get_be16(frame, &uidcounter))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", indent, ' ',
+ uidcounter, uidcounter);
+
+ if (!l2cap_frame_get_u8(frame, &count))
+ return false;
+
+ print_field("%*cAttributeCount: 0x%02x (%u)", indent, ' ',
+ count, count);
+
+ for (; count > 0; count--) {
+ uint32_t attr;
+
+ if (!l2cap_frame_get_be32(frame, &attr))
+ return false;
+
+ print_field("%*cAttributeID: 0x%08x (%s)", indent, ' ',
+ attr, mediattr2str(attr));
+ }
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", indent, ' ',
+ status, error2str(status));
+
+ if (frame->size == 1)
+ return false;
+
+ if (!l2cap_frame_get_u8(frame, &count))
+ return false;
+
+ print_field("%*cAttributeCount: 0x%02x (%u)", indent, ' ',
+ count, count);
+
+ if (!avrcp_attribute_entry_list(avctp_frame, indent, count))
+ return false;
+
+ return true;
+}
+
static bool avrcp_get_folder_items(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -2136,6 +2210,9 @@ static bool avrcp_browsing_packet(struct avctp_frame *avctp_frame)
case AVRCP_GET_FOLDER_ITEMS:
avrcp_get_folder_items(avctp_frame);
break;
+ case AVRCP_GET_ITEM_ATTRIBUTES:
+ avrcp_get_item_attributes(avctp_frame);
+ break;
default:
packet_hexdump(frame->data, frame->size);
}
--
1.9.1