All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH hcidump] AVRCP: Add parsing for SetBrowsedPlayer PDU
@ 2012-07-18 11:11 Luiz Augusto von Dentz
  2012-07-19 12:16 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2012-07-18 11:11 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 parser/avrcp.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/parser/avrcp.c b/parser/avrcp.c
index dfa9ee7..4925c40 100644
--- a/parser/avrcp.c
+++ b/parser/avrcp.c
@@ -1264,6 +1264,76 @@ response:
 	printf("Status: 0x%02x (%s)\n", status, error2str(status));
 }
 
+static void avrcp_set_browsed_player(int level, struct frame *frm,
+						uint8_t ctype, uint16_t len)
+{
+	uint32_t items;
+	uint16_t id, uids, charset;
+	uint8_t status, folders;
+
+	p_indent(level, frm);
+
+	if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+		goto response;
+
+	if (len < 2) {
+		printf("PDU Malformed\n");
+		raw_dump(level, frm);
+		return;
+	}
+
+	id = get_u16(frm);
+	printf("PlayerID: 0x%04x (%u)", id, id);
+	return;
+
+response:
+	if (len != 1 && len < 10) {
+		printf("PDU Malformed\n");
+		raw_dump(level, frm);
+		return;
+	}
+
+	status = get_u8(frm);
+	printf("Status: 0x%02x (%s)\n", status, error2str(status));
+
+	if (len == 1)
+		return;
+
+	p_indent(level, frm);
+
+	uids = get_u16(frm);
+	printf("UIDCounter: 0x%04x (%u)", uids, uids);
+
+	p_indent(level, frm);
+
+	items = get_u32(frm);
+	printf("Number of Items: 0x%04x (%u)", items, items);
+
+	p_indent(level, frm);
+
+	charset = get_u16(frm);
+	printf("CharsetID: 0x%04x (%s)\n", charset, charset2str(charset));
+
+	p_indent(level, frm);
+
+	folders = get_u8(frm);
+	printf("Folder Depth: 0x%02x (%u)", folders, folders);
+
+	for (; folders > 0; folders--) {
+		uint16_t len;
+
+		p_indent(level, frm);
+
+		len = get_u8(frm);
+		printf("Folder: ");
+		for (; len > 0; len--) {
+			uint8_t c = get_u8(frm);
+			printf("%1c", isprint(c) ? c : '.');
+		}
+		printf("\n");
+	}
+}
+
 static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
 {
 	uint8_t pduid, pt;
@@ -1336,6 +1406,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_SET_BROWSED_PLAYER:
+		avrcp_set_browsed_player(level + 1, frm, ctype, len);
+		break;
 	default:
 		raw_dump(level, frm);
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH hcidump] AVRCP: Add parsing for SetBrowsedPlayer PDU
  2012-07-18 11:11 [PATCH hcidump] AVRCP: Add parsing for SetBrowsedPlayer PDU Luiz Augusto von Dentz
@ 2012-07-19 12:16 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-07-19 12:16 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Wed, Jul 18, 2012, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> ---
>  parser/avrcp.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-19 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 11:11 [PATCH hcidump] AVRCP: Add parsing for SetBrowsedPlayer PDU Luiz Augusto von Dentz
2012-07-19 12:16 ` Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.