Skip to contentSkip to conversation

sdp patch

Bluez-devel Simon Vogl 2 participants 4 messages Feb 24, 2004 2 messages not in the archive Bluetooth drivers

lore
Share & tools
lore

Simon Vogl

author
#0 lore raw

Hi,
in my quest to turn my computer into a handsfree device, I may propose the following patch to sdp:

include/sdp.h Tue Feb 24 09:12:27 2004 renamed from include/sdp.h Tue Jun 10 18:51:07 2003 +5 -0
diff -ur sdp-cvs/include/sdp.h sdp/include/sdp.h
@@ -94,6 +94,8 @@
 #define GN_SVCLASS_ID                          0x1117
 #define IMAGING_SVCLASS_ID             0x111a
 #define IMAGING_RESPONDER_SVCLASS_ID   0x111b
+#define HANDSFREE_SVCLASS_ID            0x111e
+#define HANDSFREE_AUDIO_GW_SVCLASS_ID   0x111f
 #define HID_SVCLASS_ID                 0x1124
 #define CIP_SVCLASS_ID                 0x1128
 #define PNP_INFO_SVCLASS_ID            0x1200
@@ -123,6 +125,7 @@
 #define GN_PROFILE_ID                          0x1117
 #define IMAGING_PROFILE_ID             0x111a
 #define IMAGING_RESPONDER_PROFILE_ID   0x111b
+#define HANDSFREE_PROFILE_ID            0x111e
 #define HID_PROFILE_ID                 0x1124
 #define CIP_PROFILE_ID                 0x1128
 
@@ -160,6 +163,8 @@
 #define SDP_ATTR_MAX_NET_ACCESSRATE     0x030C
 #define SDP_ATTR_IP4_SUBNET            0x030D
 #define SDP_ATTR_IP6_SUBNET            0x030E
+#define SDP_SUPPORTED_FEATURES          0x0311
+
 
 /*
  * These identifiers are based on the SDP spec stating that
tools/listattr.c Mon Feb 23 16:13:14 2004 renamed from tools/listattr.c Fri Sep 19 17:04:22 2003 +2 -0
@@ -209,6 +209,8 @@
   { 0x1118, "DirectPrinting (BPP)", NULL, 0 },
   { 0x1119, "ReferencePrinting (BPP)", NULL, 0 },
   /* ... */
+  { 0x111e, "Handsfree", NULL, 0 },
+  { 0x111f, "HandsfreeAudioGateway", NULL, 0 },
   { 0x1120, "DirectPrintingReferenceObjectsService (BPP)", NULL, 0 },
   { 0x1121, "ReflectedUI (BPP)", NULL, 0 },
   { 0x1122, "BasicPrinting (BPP)", NULL, 0 },

Only in sdp/tools: listattr.o
Only in sdp/tools: sdptool

tools/sdptool.c Mon Feb 23 16:40:22 2004 renamed from tools/sdptool.c Sun Jul 27 20:15:22 2003 +4 -0
diff -ur sdp-cvs/tools/sdptool.c sdp/tools/sdptool.c
@@ -438,6 +438,68 @@
        return ret;
 }
 
+static int add_hf(sdp_session_t *session, svc_info_t *si)
+{
+       sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+       uuid_t root_uuid, svclass_uuid, ga_svclass_uuid, l2cap_uuid, rfco=

mm_uuid,feat_uuid;

+       sdp_profile_desc_t profile;
+       sdp_list_t *aproto, *proto[2];
+       sdp_record_t record;
+       uint8_t u8 =3D si->channel? si->channel: 3;
+       uint16_t u16 =3D 0x31;
+       sdp_data_t *channel, *features;
+       int ret =3D 0;
+
+       memset((void *)&record, 0, sizeof(sdp_record_t));
+       record.handle =3D 0xffffffff;
+       sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+       root =3D sdp_list_append(0, &root_uuid);
+       sdp_set_browse_groups(&record, root);
+
+       sdp_uuid16_create(&svclass_uuid, HANDSFREE_SVCLASS_ID);
+       svclass_id =3D sdp_list_append(0, &svclass_uuid);
+       sdp_uuid16_create(&ga_svclass_uuid, GENERIC_AUDIO_SVCLASS_ID);
+       svclass_id =3D sdp_list_append(svclass_id, &ga_svclass_uuid);
+       sdp_set_service_classes(&record, svclass_id);
+
+       sdp_uuid16_create(&profile.uuid, HANDSFREE_PROFILE_ID);
+       profile.version =3D 0x0101;
+       pfseq =3D sdp_list_append(0, &profile);
+       sdp_set_profile_descs(&record, pfseq);
+
+       sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
+       proto[0] =3D sdp_list_append(0, &l2cap_uuid);
+       apseq =3D sdp_list_append(0, proto[0]);
+
+       sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
+       proto[1] =3D sdp_list_append(0, &rfcomm_uuid);
+       channel =3D sdp_data_alloc(SDP_UINT8, &u8);
+       proto[1] =3D sdp_list_append(proto[1], channel);
+       apseq =3D sdp_list_append(apseq, proto[1]);

+
+ features =3D sdp_data_alloc(SDP_UINT16, &u16);
+ sdp_attr_add(&record, SDP_SUPPORTED_FEATURES, features);
+
+ aproto =3D sdp_list_append(0, apseq);
+ sdp_set_access_protos(&record, aproto);
+
+ sdp_set_info_attr(&record, "", 0, 0);
+
+ if (0 > sdp_record_register(session, &record, SDP_RECORD_PERSIST)=
) {

+               printf("Service Record registration failed\n");
+               ret =3D -1;
+               goto end;
+       }
+       printf("Handsfree service registered\n");
+end:
+       sdp_data_free(channel);
+       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 int add_fax(sdp_session_t *session, svc_info_t *si)
 {
        sdp_list_t *svclass_id, *pfseq, *apseq, *root;
@@ -848,6 +910,8 @@
        { "HID",   HID_SVCLASS_ID,            add_hid   },
        { "CIP",   CIP_SVCLASS_ID,            add_cip   },
        { "CTP",   CORDLESS_TELEPHONY_SVCLASS_ID, add_ctp },

+ { "HF", HANDSFREE_SVCLASS_ID, add_hf },

        { 0 }

};

BTW, no, I still don't get audio data (although the device connects the s= co
channel)
Simon

--=20
_______________________________________________________________________
Dr. Simon Vogl
Institut f=C3=BCr Pervasive Computing, Johannes Kepler Universit=C3=A4t L= inz
Altenberger Stra=C3=9Fe 69, A-4040 Linz, Austria

Tel: +43 732 2468-8517, Fax: +43 732 2468-8426
mailto: [email protected], http://www.soft.uni-linz.ac.at/

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Simon,

Quoted 2 lines

in my quest to turn my computer into a handsfree device, I may propose the following patch to sdp:

your patch fails against the current CVS.

Hunk #1 FAILED at 94.
Hunk #2 FAILED at 125.
Hunk #3 FAILED at 163.
3 out of 3 hunks FAILED -- saving rejects to file include/sdp.h.rej patching file tools/listattr.c
Hunk #1 FAILED at 209.
1 out of 1 hunk FAILED -- saving rejects to file tools/listattr.c.rej patching file tools/sdptool.c
Hunk #1 FAILED at 438.
patch: **** malformed patch at line 122:

Regards

Marcel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#3 lore raw
In reply to a message not in the archive

Hi Simon,

Quoted 1 line

sorry for this - here it is again (tested against a freshly updated cvs tree):

I don't know what CVS checkout you use, but it still fails.

patching file include/sdp.h
Hunk #1 FAILED at 94.
Hunk #2 FAILED at 125.
Hunk #3 FAILED at 163.
3 out of 3 hunks FAILED -- saving rejects to file include/sdp.h.rej patching file tools/listattr.c
Hunk #1 FAILED at 209.
1 out of 1 hunk FAILED -- saving rejects to file tools/listattr.c.rej patching file tools/sdptool.c
Hunk #1 FAILED at 438.
Hunk #2 FAILED at 911.
2 out of 2 hunks FAILED -- saving rejects to file tools/sdptool.c.rej

Regards

Marcel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#5 lore raw
In reply to a message not in the archive

Hi Simon,

Quoted 6 lines

hmm, I tested with
cd sdp; patch -p1 <../foo
and it worked like a charm.

Are there different branches in the sourceforge cvs? (nb that i am only an anonymous user ;)

we don't use any branches and I always apply it to an anonymous checkout first, before I commit it. Please do a new and clean checkout.

Regards

Marcel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel