linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/5] Added structs for AVRCP baseline messages
@ 2011-08-11 14:13 David Stockwell
  0 siblings, 0 replies; only message in thread
From: David Stockwell @ 2011-08-11 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: lucas.demarchi, luiz.dentz, david_stockwell

Added structs for AVRCP baseline messages:
  UnitInfo, SubUnitInfo, Passthrough and Vendor Dependent

Based on Release 4.96
---
 audio/control.c |   92 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/audio/control.c b/audio/control.c
index 188297a..8ddcc10 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -282,6 +282,98 @@ struct avrcp_spec_avc_pdu {
 #error "Unknown byte order"
 #endif
 
+/* structs for AVRCP UnitInfo, SubUnitInfo, and Passthrough messages. */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct	avrcp_unitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		ext_code;
+	uint8_t		unit:3;
+	uint8_t		unit_type:5;
+	uint8_t		company_id[3];
+} __attribute__ ((packed));
+
+struct	avrcp_subunit {
+	uint8_t		subunit_id_max:3;
+	uint8_t		subunit_type:5;
+} __attribute__ ((packed));
+
+struct	avrcp_subunitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		extension:3;
+	uint8_t		_rs1:1;
+	uint8_t		page:3;
+	uint8_t		_rs0:1;
+	struct avrcp_subunit subunit[4];
+} __attribute__ ((packed));
+
+struct	avrcp_passthru {
+	struct avrcp_header	hdr;
+	uint8_t		key:7;
+	uint8_t		key_state:1;
+	uint8_t		op_len;	/* =length(company_id+op_data) */
+	uint8_t		company_id[3];
+	uint8_t		op_data[];
+} __attribute__ ((packed));
+
+struct	avrcp_vendor_dep {
+	struct avrcp_header	hdr;
+	uint8_t		company_id[3];
+	uint8_t		pdu_id;
+	uint8_t		packet_type:2;
+	uint8_t		_reserved:6;
+	uint16_t	length;
+	uint8_t		pdu_data[];
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct	avrcp_unitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		ext_code;
+	uint8_t		unit_type:5;
+	uint8_t		unit:3;
+	uint8_t		company_id[3];
+} __attribute__ ((packed));
+
+struct	avrcp_subunit {
+	uint8_t		subunit_type:5;
+	uint8_t		subunit_id_max:3;
+} __attribute__ ((packed));
+
+struct	avrcp_subunitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		_rs0:1;
+	uint8_t		page:3;
+	uint8_t		_rs1:1;
+	uint8_t		extension:3;
+	struct avrcp_subunit subunit[4];
+} __attribute__ ((packed));
+
+struct	avrcp_passthru {
+	struct avrcp_header	hdr;
+	uint8_t		key_state:1;
+	uint8_t		key:7;
+	uint8_t		op_len;	/* =length(company_id+op_data) */
+	uint8_t		company_id[3];
+	uint8_t		op_data[];
+} __attribute__ ((packed));
+
+struct	avrcp_vendor_dep {
+	struct avrcp_header	hdr;
+	uint8_t		company_id[3];
+	uint8_t		pdu_id;
+	uint8_t		_reserved:6;
+	uint8_t		packet_type:2;
+	uint16_t	length;
+	uint8_t		pdu_data[];
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 struct avctp_state_callback {
 	avctp_state_cb cb;
 	void *user_data;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-11 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 14:13 [PATCH 2/5] Added structs for AVRCP baseline messages David Stockwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).