Skip to contentSkip to conversation

avrcp start

Bluez-devel Brad Midgley 2 participants 5 messages Nov 29, 2005 – Nov 30, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi

I've started an avrcp receiver in the btsco cvs.

I hope it doesn't seem like a case of extreme laziness to put the sdp stuff in sdptool. I suppose I should get serious and put it in my app too. Did I write the patch right with regard to protocol names, etc?

Also, is there a separate UUID for AVRCP? I only found AVCTP UUID definitions, but it seems like PID in the AVCTP header needs to indicate AVRCP specifically.

With the changes above, I got my headset to connect but it seems to put in the value "0e11" for the pid in the first AVRCP packet I got out of it.

Brad

Index: tools/sdptool.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/sdptool.c,v
retrieving revision 1.35

sdptool.c +61 -0
diff -u -r1.35 sdptool.c
@@ -2052,6 +2052,65 @@
 	return ret;
 }
 
+static int add_avrcp(sdp_session_t *session, svc_info_t *si)
+{
+	sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+	uuid_t root_uuid, l2cap, avdtp, a2snk;
+	sdp_profile_desc_t profile[1];
+	sdp_list_t *aproto, *proto[2];
+	sdp_record_t record;
+	sdp_data_t *psm, *version;
+	uint16_t lp = 0x0019, ver = 0x0100;
+	int ret = 0;
+
+	memset((void *)&record, 0, sizeof(sdp_record_t));
+	record.handle = 0xffffffff;
+	sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+	root = sdp_list_append(0, &root_uuid);
+	sdp_set_browse_groups(&record, root);
+
+	sdp_uuid16_create(&a2snk, AV_REMOTE_TARGET_SVCLASS_ID);
+	svclass_id = sdp_list_append(0, &a2snk);
+	sdp_set_service_classes(&record, svclass_id);
+
+	sdp_uuid16_create(&profile[0].uuid, AV_REMOTE_TARGET_PROFILE_ID);
+	profile[0].version = 0x0100;
+	pfseq = sdp_list_append(0, &profile[0]);
+	sdp_set_profile_descs(&record, pfseq);
+
+	sdp_uuid16_create(&l2cap, L2CAP_UUID);
+	proto[0] = sdp_list_append(0, &l2cap);
+	psm = sdp_data_alloc(SDP_UINT16, &lp);
+	proto[0] = sdp_list_append(proto[0], psm);
+	apseq = sdp_list_append(0, proto[0]);
+
+	sdp_uuid16_create(&avdtp, AVDTP_UUID);
+	proto[1] = sdp_list_append(0, &avdtp);
+	version = sdp_data_alloc(SDP_UINT16, &ver);
+	proto[1] = sdp_list_append(proto[1], version);
+	apseq = sdp_list_append(apseq, proto[1]);
+
+	aproto = sdp_list_append(0, apseq);
+	sdp_set_access_protos(&record, aproto);
+
+	sdp_set_info_attr(&record, "AVRCP TG", 0, 0);
+
+	if (sdp_device_record_register(session, &interface, &record, SDP_RECORD_PERSIST) < 0) {
+		printf("Service Record registration failed\n");
+		ret = -1;
+		goto done;
+	}
+
+	printf("AVRCP service registered\n");
+
+done:
+	sdp_list_free(proto[0], 0);
+	sdp_list_free(proto[1], 0);
+	sdp_list_free(apseq, 0);
+	sdp_list_free(aproto, 0);
+	return ret;
+}
+
 static unsigned char syncml_uuid[] = {	0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00,
 					0x80, 0x00, 0x00, 0x02, 0xEE, 0x00, 0x00, 0x02 };
 
@@ -2350,6 +2409,8 @@
 	{ "A2SRC",	AUDIO_SOURCE_SVCLASS_ID,	add_a2source	},
 	{ "A2SNK",	AUDIO_SINK_SVCLASS_ID,		add_a2sink	},
 
+	{ "AVRCP",      AV_REMOTE_TARGET_SVCLASS_ID,    add_avrcp       },
+
 	{ "SYNCML",	0,				add_syncml,	syncml_uuid	},
 	{ "ACTIVESYNC",	0,				add_activesync,	async_uuid	},
 	{ "HOTSYNC",	0,				add_hotsync,	hotsync_uuid	},
maintainer
#1 lore raw

Hi Brad,

Quoted 6 lines

I've started an avrcp receiver in the btsco cvs.

I hope it doesn't seem like a case of extreme laziness to put the sdp stuff in sdptool. I suppose I should get serious and put it in my app too. Did I write the patch right with regard to protocol names, etc?

Quoted 6 lines

Also, is there a separate UUID for AVRCP? I only found AVCTP UUID definitions, but it seems like PID in the AVCTP header needs to indicate AVRCP specifically.

With the changes above, I got my headset to connect but it seems to put in the value "0e11" for the pid in the first AVRCP packet I got out of it.

you actually copied to much from on of the A2DP record handlers. The specification definces the AVRCP CT service record like this:

        Attribute 0x0000 - ServiceRecordHandle
                UINT32 0x00010000
        Attribute 0x0001 - ServiceClassIDList
                Sequence
                        UUID16 0x110e - RemoteControl
        Attribute 0x0004 - ProtocolDescriptorList
                Sequence
                        Sequence
                                UUID16 0x0100 - L2CAP
                                UINT16 0x0017
                        Sequence
                                UUID16 0x0017 - AVCTP
                                UINT16 0x0100
        Attribute 0x0005 - BrowseGroupList
                Sequence
                        UUID16 0x1002 - PublicBrowseGroup
        Attribute 0x0009 - BluetoothProfileDescriptorList
                Sequence
                        Sequence
                                UUID16 0x110e - RemoteControl
                                UINT16 0x0100
        Attribute 0x0100
                String AVRCP CT
        Attribute 0x0311
                UINT16 0x000f

You need the supported features attribute. The correct PSM and protocol and profile descriptors. The AVRCP TG looks like this:

        Attribute 0x0000 - ServiceRecordHandle
                UINT32 0x00010001
        Attribute 0x0001 - ServiceClassIDList
                Sequence
                        UUID16 0x110c - RemoteControlTarget
        Attribute 0x0004 - ProtocolDescriptorList
                Sequence
                        Sequence
                                UUID16 0x0100 - L2CAP
                                UINT16 0x0017
                        Sequence
                                UUID16 0x0017 - AVCTP
                                UINT16 0x0100
        Attribute 0x0005 - BrowseGroupList
                Sequence
                        UUID16 0x1002 - PublicBrowseGroup
        Attribute 0x0009 - BluetoothProfileDescriptorList
                Sequence
                        Sequence
                                UUID16 0x110e - RemoteControl
                                UINT16 0x0100
        Attribute 0x0100
                String AVRCP TG
        Attribute 0x0311
                UINT16 0x000f

Functions for both records are in the CVS now.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Marcel

Quoted 6 lines

you actually copied to much from on of the A2DP record handlers. The specification definces the AVRCP CT service record like this:
You need the supported features attribute. The correct PSM and protocol and profile descriptors.

Functions for both records are in the CVS now.

thanks for straightening it out on sdp.

so I am making progress like I did with hammering out a2dp but i'm a little stuck. I am not finding constants for anything they talk about in AVRCP. Things like play/track back/track forward operands, opcodes for using passthrough, what the significance of "sub unit type 9" is... am I missing something? None of it appears in assigned numbers either.

brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

guys

Quoted 2 lines

little stuck. I am not finding constants for anything they talk about in AVRCP. Things like play/track back/track forward operands, opcodes

i just found the snippet in the docs about how they piggyback on 1394 for a lot of this stuff, so now i'm digging there. if nothing else, i'll look for the constants in the linux 1394 headers.

brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#4 lore raw

Hi Brad,

Quoted 6 lines
Quoted 2 lines

little stuck. I am not finding constants for anything they talk about in AVRCP. Things like play/track back/track forward operands, opcodes

i just found the snippet in the docs about how they piggyback on 1394 for a lot of this stuff, so now i'm digging there. if nothing else, i'll look for the constants in the linux 1394 headers.

if I am not mistaken, they refer to a document that you might can get if you ask nicely. However it is not part of the Bluetooth specification.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel