summaryrefslogtreecommitdiff
path: root/monitor/avctp.c
diff options
context:
space:
mode:
authorVikrampal Yadav <vikram.pal@samsung.com>2015-01-07 13:53:20 +0530
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-01-12 10:10:50 -0200
commitc96bf1ba217cd3fbc3726cd7181f69d069917f08 (patch)
tree60b64f9dac203202fef6863dee8480c301eb995e /monitor/avctp.c
parentde132d1c4998624597788ca3dbb50e43f339b252 (diff)
downloadbluez-c96bf1ba217cd3fbc3726cd7181f69d069917f08.tar.gz
monitor: Add AVRCP SetBrowsedPlayer support
Support for decoding AVRCP SetBrowsedPlayer added in Bluetooth monitor. Channel: 65 len 12 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: SetBrowsedPlayer: len 0x0002 PlayerID: 0x0001 (1)
Diffstat (limited to 'monitor/avctp.c')
-rw-r--r--monitor/avctp.c86
1 files changed, 85 insertions, 1 deletions
diff --git a/monitor/avctp.c b/monitor/avctp.c
index af91eccc5..0a1e92d55 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1637,11 +1637,95 @@ static bool avrcp_control_packet(struct avctp_frame *avctp_frame)
}
}
+static bool avrcp_set_browsed_player(struct avctp_frame *avctp_frame)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint32_t items;
+ uint16_t id, uids, charset;
+ uint8_t status, folders, indent = 2;
+
+ if (avctp_frame->hdr & 0x02)
+ goto response;
+
+ if (!l2cap_frame_get_be16(frame, &id))
+ return false;
+
+ print_field("%*cPlayerID: 0x%04x (%u)", indent, ' ', id, id);
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", indent, ' ', status,
+ error2str(status));
+
+ if (!l2cap_frame_get_be16(frame, &uids))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", indent, ' ', uids, uids);
+
+ if (!l2cap_frame_get_be32(frame, &items))
+ return false;
+
+ print_field("%*cNumber of Items: 0x%08x (%u)", indent, ' ',
+ items, items);
+
+ if (!l2cap_frame_get_be16(frame, &charset))
+ return false;
+
+ print_field("%*cCharsetID: 0x%04x (%s)", indent, ' ', charset,
+ charset2str(charset));
+
+ if (!l2cap_frame_get_u8(frame, &folders))
+ return false;
+
+ print_field("%*cFolder Depth: 0x%02x (%u)", indent, ' ', folders,
+ folders);
+
+ for (; folders > 0; folders--) {
+ uint8_t len;
+
+ if (!l2cap_frame_get_u8(frame, &len))
+ return false;
+
+ printf("Folder: ");
+ for (; len > 0; len--) {
+ uint8_t c;
+
+ if (!l2cap_frame_get_u8(frame, &c))
+ return false;
+
+ printf("%1c", isprint(c) ? c : '.');
+ }
+ printf("\n");
+ }
+
+ return true;
+}
+
static bool avrcp_browsing_packet(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint16_t len;
+ uint8_t pduid;
+
+ if (!l2cap_frame_get_u8(frame, &pduid))
+ return false;
+
+ if (!l2cap_frame_get_be16(frame, &len))
+ return false;
+
+ print_field("AVRCP: %s: len 0x%04x", pdu2str(pduid), len);
+
+ switch (pduid) {
+ case AVRCP_SET_BROWSED_PLAYER:
+ avrcp_set_browsed_player(avctp_frame);
+ break;
+ default:
+ packet_hexdump(frame->data, frame->size);
+ }
- packet_hexdump(frame->data, frame->size);
return true;
}