Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2009 08:29:51 +0100
From:      Marcin Cieslak <saper@system.pl>
To:        freebsd-ports@freebsd.org
Subject:   comms/gammu: preliminary patch to talk SDP 
Message-ID:  <gkhftf$ogn$1@ger.gmane.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070807010003080108040708
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

Attached please find a preliminary support to make gammu discover the 
Bluetooth RFCOMM channel number using sdp(3).

The patch currently has a hard-coded search for the "OBEX File Transfer" 
class, as I have some trouble understanding reasons for logic behind
"bluetooth_checkservicename()" function (in common/device/devfunc.c).

This code correctly parses SDP response and extracts the RFCOMM channel
for the desired protocol. I have basically copied the code from
sdpcontrol(8) to do this.

I am unable to test this further as I cannot figure out the correct way
to talk to my phone (My Nokia refuses to talk on the OBEX File
Transfer RFCOMM channel #10 despite being advertised via SDP), but this
code delivers the expected channel number to the Bluetooth connect(2) call.

Probably it can be made usable for most of the people in a short time
therefore I thought somebody will be able to pick it from there.

Btw, the maintainer's email address (bsm@...) bounces.

--Marcin


--------------070807010003080108040708
Content-Type: text/x-diff;
 name="gammu-sdp.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gammu-sdp.diff"

===> Generating patch
===> Viewing diff with more
diff -ruN --exclude=CVS /usr/ports/comms/gammu/files/patch-CMakeLists.txt /usr/home/saper/FreeBSD/ports/gammu/files/patch-CMakeLists.txt
--- /usr/ports/comms/gammu/files/patch-CMakeLists.txt	2007-12-16 21:59:51.000000000 +0100
+++ /usr/home/saper/FreeBSD/ports/gammu/files/patch-CMakeLists.txt	2009-01-13 05:00:37.883255000 +0100
@@ -1,6 +1,32 @@
---- CMakeLists.txt.orig	2007-08-08 16:30:55.000000000 +0400
-+++ CMakeLists.txt	2007-08-21 00:18:05.000000000 +0400
-@@ -601,7 +604,7 @@
+--- CMakeLists.txt.orig	2008-12-19 10:31:54.000000000 +0100
++++ CMakeLists.txt	2009-01-13 05:00:34.875317481 +0100
+@@ -204,7 +204,11 @@
+         find_package (FBSDBluetooth)
+         if (FBSD_BLUE_FOUND)
+             set(BLUETOOTH_FOUND ON)
+-            set(BLUETOOTH_SEARCH FALSE)
++            if (FBSD_SDP_FOUND)
++	        set(BLUETOOTH_SEARCH TRUE)
++            else (FBSD_SDP_FOUND)
++	        set(BLUETOOTH_SEARCH FALSE)
++            endif (FBSD_SDP_FOUND)
+         endif (FBSD_BLUE_FOUND)
+         find_package (OSXBluetooth)
+         if (OSX_BLUE_FOUND)
+@@ -282,6 +286,12 @@
+     endif (NOT "${FBSD_BLUE_LIBRARIES}" STREQUAL "")
+ endif (FBSD_BLUE_FOUND)
+ 
++if (FBSD_SDP_FOUND)
++    if (NOT "${FBSD_SDP_LIBRARIES}" STREQUAL "")
++        set (GAMMU_LIBS "${GAMMU_LIBS} -l${FBSD_SDP_LIBRARIES}")
++    endif (NOT "${FBSD_SDP_LIBRARIES}" STREQUAL "")
++endif (FBSD_SDP_FOUND)
++
+ if (ICONV_FOUND)
+     if (NOT "${ICONV_LIBRARIES}" STREQUAL "")
+         set (GAMMU_LIBS "${GAMMU_LIBS} -l${ICONV_LIBRARIES}")
+@@ -721,7 +731,7 @@
  set (INSTALL_DOC_DIR "share/doc/gammu" CACHE STRING "Path for documentation installation")
  mark_as_advanced (INSTALL_DOC_DIR)
  
diff -ruN --exclude=CVS /usr/ports/comms/gammu/files/patch-FindFBSDBluetooth.cmake /usr/home/saper/FreeBSD/ports/gammu/files/patch-FindFBSDBluetooth.cmake
--- /usr/ports/comms/gammu/files/patch-FindFBSDBluetooth.cmake	1970-01-01 01:00:00.000000000 +0100
+++ /usr/home/saper/FreeBSD/ports/gammu/files/patch-FindFBSDBluetooth.cmake	2009-01-13 05:04:56.330885000 +0100
@@ -0,0 +1,47 @@
+--- cmake/FindFBSDBluetooth.cmake.orig	2007-09-03 04:06:48.000000000 +0200
++++ cmake/FindFBSDBluetooth.cmake	2009-01-13 05:04:44.992120772 +0100
+@@ -10,7 +10,7 @@
+ 
+ if (NOT DEFINED FBSD_BLUE_FOUND)
+     if (NOT CROSS_MINGW)
+-        find_path(FBSD_BLUE_INCLUDE_DIR NAMES bluetooth.h
++        find_path(FBSD_BLUE_INCLUDE_DIR NAMES bluetooth.h sdp.h
+            PATHS
+            /usr/include
+            /usr/local/include
+@@ -22,14 +22,33 @@
+            /usr/local/lib
+         )
+ 
++        find_path(FBSD_SDP_INCLUDE_DIR NAMES sdp.h
++           PATHS
++           /usr/include
++           /usr/local/include
++        )
++
++        find_library(FBSD_SDP_LIBRARIES NAMES sdp
++           PATHS
++           /usr/lib
++           /usr/local/lib
++        )
++
+         if(FBSD_BLUE_INCLUDE_DIR AND FBSD_BLUE_LIBRARIES)
+            set(FBSD_BLUE_FOUND TRUE CACHE INTERNAL "FreeBSD Bluetooth found")
+            message(STATUS "Found FreeBSD Bluetooth: ${FBSD_BLUE_INCLUDE_DIR}, ${FBSD_BLUE_LIBRARIES}")
++           if(FBSD_SDP_INCLUDE_DIR AND FBSD_SDP_LIBRARIES)
++               set(FBSD_SDP_FOUND TRUE CACHE INTERNAL "FreeBSD SDP found")
++               message(STATUS "Found FreeBSD SDP: ${FBSD_SDP_INCLUDE_DIR}, ${FBSD_SDP_LIBRARIES}")
++           else(FBSD_SDP_INCLUDE_DIR AND FBSD_SDP_LIBRARIES)
++               set(FBSD_SDP_FOUND FALSE CACHE INTERNAL "FreeBSD SDP not found")
++               message(STATUS "FreeBSD SDP not found.")
++           endif(FBSD_SDP_INCLUDE_DIR AND FBSD_SDP_LIBRARIES)
+         else(FBSD_BLUE_INCLUDE_DIR AND FBSD_BLUE_LIBRARIES)
+-           set(FBSD_BLUE_FOUND FALSE CACHE INTERNAL "FreeBSD Bluetooth found")
++           set(FBSD_BLUE_FOUND FALSE CACHE INTERNAL "FreeBSD Bluetooth not found")
+            message(STATUS "FreeBSD Bluetooth not found.")
+         endif(FBSD_BLUE_INCLUDE_DIR AND FBSD_BLUE_LIBRARIES)
+ 
+-        mark_as_advanced(FBSD_BLUE_INCLUDE_DIR FBSD_BLUE_LIBRARIES)
++        mark_as_advanced(FBSD_BLUE_INCLUDE_DIR FBSD_BLUE_LIBRARIES FBSD_SDP_INCLUDE_DIR FBSD_SDP_LIBRARIES)
+     endif (NOT CROSS_MINGW)
+ endif (NOT DEFINED FBSD_BLUE_FOUND)
diff -ruN --exclude=CVS /usr/ports/comms/gammu/files/patch-bluetooth /usr/home/saper/FreeBSD/ports/gammu/files/patch-bluetooth
--- /usr/ports/comms/gammu/files/patch-bluetooth	2007-08-11 19:10:28.000000000 +0200
+++ /usr/home/saper/FreeBSD/ports/gammu/files/patch-bluetooth	2009-01-13 07:40:15.920566688 +0100
@@ -1,66 +1,425 @@
---- common/device/bluetoth/bluez.c.orig	2007-03-10 19:47:59.000000000 +0300
-+++ common/device/bluetoth/bluez.c	2007-06-29 20:00:48.000000000 +0400
-@@ -23,6 +23,8 @@
- #ifdef GSM_ENABLE_BLUETOOTHDEVICE
- #ifdef GSM_ENABLE_BLUEZ
- 
-+#define BDADDR_ANY NG_HCI_BDADDR_ANY
-+
- #include <stdlib.h>
- #include <stdio.h>
- #include <fcntl.h>
-@@ -31,11 +33,7 @@
- #include <sys/socket.h>
+--- common/device/bluetoth/blue_fbsd.c.orig	2008-08-05 11:49:08.000000000 +0200
++++ common/device/bluetoth/blue_fbsd.c	2009-01-13 07:39:51.240082825 +0100
+@@ -1,4 +1,5 @@
+ /* Based on some work from Bluez (www.bluez.org)
++
+  * (C) 2000-2001 Qualcomm Incorporated
+  * (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
+  * (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+@@ -33,16 +34,19 @@
  #include <sys/time.h>
  #include <unistd.h>
--#include <bluetooth/bluetooth.h>
--#include <bluetooth/rfcomm.h>
--#include <bluetooth/sdp.h>
--#include <bluetooth/sdp_lib.h>
--#include <bluetooth/hci_lib.h>
-+#include <bluetooth.h>
+ #include <bluetooth.h>
++#ifdef BLUETOOTH_RF_SEARCHING
++#include <uuid.h>
++#include <sdp.h>
++#endif
  
  #include "../../gsmcomon.h"
  #include "../devfunc.h"
-@@ -44,7 +42,7 @@
- GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device)
+ #include "bluetoth.h"
+ 
+-GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device)
++GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, const char *device)
  {
  	GSM_Device_BlueToothData 	*d = &s->Device.Data.BlueTooth;
--	struct sockaddr_rc 		laddr, raddr;
-+	struct sockaddr_rfcomm 		laddr, raddr;
- 	bdaddr_t			bdaddr;
+ 	struct sockaddr_rfcomm 		laddr, raddr;
+-	bdaddr_t			bdaddr;
  	int 				fd;
  
-@@ -53,15 +51,15 @@
+ 	memset(&laddr, 0, sizeof(laddr));
+@@ -50,13 +54,20 @@
  
  	smprintf(s, "Connecting to RF channel %i\n",port);
  
--	fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
-+	fd = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
++	raddr.rfcomm_family 	= AF_BLUETOOTH;
++	raddr.rfcomm_channel 	= port;
++	if (bt_aton(device, &raddr.rfcomm_bdaddr) < 1) {
++		smprintf(s, "Invalid address specified: %s\n", device);
++		return ERR_DEVICEOPENERROR;
++	}
++
+ 	fd = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
  	if (fd < 0) {
  		dbgprintf("Can't create socket\n");
  		return ERR_DEVICENODRIVER;
  	}
  
--	bacpy(&laddr.rc_bdaddr, BDADDR_ANY);
--	laddr.rc_family 	= AF_BLUETOOTH;
--	laddr.rc_channel 	= 0;
-+	bacpy(&laddr.rfcomm_bdaddr, BDADDR_ANY);
-+	laddr.rfcomm_family 	= AF_BLUETOOTH;
-+	laddr.rfcomm_channel 	= 0;
- 
- 	if (bind(fd, (struct sockaddr *)&laddr, sizeof(laddr)) < 0) {
- 		dbgprintf("Can't bind socket\n");
-@@ -70,9 +68,9 @@
- 	}
+-	bacpy(&laddr.rfcomm_bdaddr, NG_HCI_BDADDR_ANY);
++	memcpy(&laddr.rfcomm_bdaddr, NG_HCI_BDADDR_ANY, sizeof(bdaddr_t));
+ 	laddr.rfcomm_family 	= AF_BLUETOOTH;
+ 	laddr.rfcomm_channel 	= 0;
  
- 	str2ba(device, &bdaddr);
--	bacpy(&raddr.rc_bdaddr, &bdaddr);
--	raddr.rc_family 	= AF_BLUETOOTH;
--	raddr.rc_channel 	= port;
-+	bacpy(&raddr.rfcomm_bdaddr, &bdaddr);
-+	raddr.rfcomm_family 	= AF_BLUETOOTH;
-+	raddr.rfcomm_channel 	= port;
+@@ -66,11 +77,6 @@
+ 		return ERR_DEVICEOPENERROR;
+ 	}
  
+-	str2ba(device, &bdaddr);
+-	bacpy(&raddr.rfcomm_bdaddr, &bdaddr);
+-	raddr.rfcomm_family 	= AF_BLUETOOTH;
+-	raddr.rfcomm_channel 	= port;
+-
  	if (connect(fd, (struct sockaddr *)&raddr, sizeof(raddr)) < 0) {
- 		dbgprintf("Can't connect\n");
+ 		smprintf(s, "Can't connect (%d, %s)\n", errno, strerror(errno));
+ 		close(fd);
+@@ -82,133 +88,243 @@
+ }
+ 
+ #ifdef BLUETOOTH_RF_SEARCHING
+-#warning This code is not ported to FreeBSD stack!
+-
+-static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, uuid_t *group)
++GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
+ {
+-	sdp_session_t			*sess;
+-	sdp_record_t 			*rec;
+-	sdp_list_t			*attrid, *search, *seq, *next, *proto;
+-	sdp_data_t			*d;
+-	bdaddr_t			interface;
+-	uint32_t			range = 0x0000ffff;
+-	char				str[20];
+-	int				channel,dd;
+-	char 				name[1000];
+-	int				score, bestscore = 0;
+-	int				found = -1;
+-	uuid_t subgroup;
+-
+-	bacpy(&interface,NG_HCI_BDADDR_ANY);
+-
+-	ba2str(bdaddr, str);
+-	smprintf(s,"Device %s", str);
+-
+-	/* Try to read name */
+-	dd = hci_open_dev(0);
+-	if (dd < 0) return ERR_UNKNOWN;
+-	memset(name, 0, sizeof(name));
+-	if (hci_read_remote_name(dd, bdaddr, sizeof(name), name, 100000) >= 0) {
+-	    smprintf(s, " (\"%s\")", name);
+-	}
+-	close(dd);
+-	smprintf(s,"\n");
+-
+-	/* Connect to device */
+-	sess = sdp_connect(&interface, bdaddr, SDP_RETRY_IF_BUSY);
+-	if (!sess) {
+-		smprintf(s, "Failed to connect to SDP server on %s: %s\n", str, strerror(errno));
+-		return ERR_TIMEOUT;
+-	}
+-
+-	/* List available channels */
+-	attrid = sdp_list_append(0, &range);
+-	search = sdp_list_append(0, group);
+-	if (sdp_service_search_attr_req(sess, search, SDP_ATTR_REQ_RANGE, attrid, &seq)) {
+-		smprintf(s, "Service Search failed: %s\n", strerror(errno));
+-		sdp_close(sess);
+-		return ERR_UNKNOWN;
+-	}
+-	sdp_list_free(attrid, 0);
+-	sdp_list_free(search, 0);
+-
+-	for (; seq; seq = next) {
+-		rec 	= (sdp_record_t *) seq->data;
++	bdaddr_t			remote;
++	uint8_t				buffer[1024];
++	void				*ss   = NULL;
+ 
+-		/* Get channel info */
+-		if (sdp_get_access_protos(rec, &proto) == 0) {
+-			channel = sdp_get_proto_port(proto, RFCOMM_UUID);
+-			sdp_list_foreach(proto, (sdp_list_func_t)sdp_list_free, 0);
+-			sdp_list_free(proto, 0);
+-		} else {
+-			goto next_seq;
+-		}
+-		smprintf(s, "   Channel %i", channel);
++	uint8_t				*valptr, *dumpptr;
++	int				i;
++	uint8_t				v;
+ 
+-		/* Get service name and check it */
+-		d = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
+-		if (d) {
+-			score = bluetooth_checkservicename(s, d->val.str);
+-			smprintf(s," - \"%s\" (score=%d)\n", d->val.str, score);
+-			if (score > bestscore) {
+-				found = channel;
+-				bestscore = score;
+-			}
+-		} else {
+-			smprintf(s,"\n");
+-		}
++	uint8_t const			*start, *end, *param_end;
++	uint32_t			type, prot_type, param_type;
++	uint32_t			len, prot_len, param_len;
++	int				param;
++        union {
++                uint8_t         uint8;
++                uint16_t        uint16;
++                uint32_t        uint32;
++                uint64_t        uint64;
++                int128_t        int128;
++        }				prot_value, param_value;
++ 
++
++	uint8_t				channel;
++	uint16_t			serv  = SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER;
++        uint32_t			attr  = SDP_ATTR_RANGE(
++		SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST,
++		SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST);
++	sdp_attr_t			proto = { SDP_ATTR_INVALID, 0, sizeof(buffer), buffer };
++	
+ 
+-		/* Descent to subroups */
+-		memset(&subgroup, 0, sizeof(subgroup));
+-    		if (sdp_get_group_id(rec, &subgroup) != -1) {
+-			if (subgroup.value.uuid16 != group->value.uuid16) {
+-				bluetooth_checkdevice(s, bdaddr, &subgroup);
+-			}
+-		}
+-
+-next_seq:
+-		next = seq->next;
+-		free(seq);
+-		sdp_record_free(rec);
++	if (bt_aton(s->CurrentConfig->Device, &remote) < 1) {
++		smprintf(s, "Cannot parse MAC address: %s\n", s->CurrentConfig->Device);
++		return ERR_UNKNOWN;
+ 	}
+-	sdp_close(sess);
++	smprintf(s, "Device %s\n", s->CurrentConfig->Device);
+ 
+-	if (found != -1) {
+-		return bluetooth_connect(s, found, str);
++	if ((ss = sdp_open(NG_HCI_BDADDR_ANY, &remote)) == NULL) {
++		smprintf(s, "Error opening SDP: %s\n", strerror(errno));
++		return ERR_UNKNOWN;
++	}
++	if (sdp_error(ss) != 0) {
++		smprintf(s, "Error connecting to SDP: %d\n", sdp_error(ss));
++		return ERR_UNKNOWN;
++	}
++	if (sdp_search(ss, 1, &serv, 1, &attr, 1, &proto) != 0) {
++		smprintf(s, "SDP search failed: %d\n", sdp_error(ss));
++		return ERR_UNKNOWN;
++	}
++	if (proto.flags != SDP_ATTR_OK) {
++		smprintf(s, "SDP service not found: %d\n", proto.flags);
++		return ERR_NOTSUPPORTED;
++	}
++	valptr = (uint8_t *)proto.value;
++	dumpptr = (uint8_t *)proto.value;
++	smprintf(s, "SDP response vlen=%d\n", proto.vlen);
++	smprintf(s, "SDP response: ");
++	for (i = 0; i < proto.vlen; i ++) {
++		SDP_GET8(v, dumpptr);
++		smprintf(s, "%02x ", v);
+ 	}
++	smprintf(s, "\n");
+ 
+-	return ERR_NOTSUPPORTED;
+-}
++	start = (uint8_t const *)proto.value;
++	end = start + proto.vlen;
++	if (end - start < 2) {
++		smprintf(s, "Invalid Protocol Descriptor List. " \
++                                "Too short, len=%zd\n", end - start);
++		return ERR_NOTSUPPORTED;
++	}
+ 
+-GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
+-{
+-	inquiry_info			ii[20];
+-	uint8_t				count = 0;
+-	int				i;
+-	GSM_Error			error = ERR_TIMEOUT;
+-	struct hci_dev_info		di;
+-	uuid_t group;
+-
+-	memset(&group, 0, sizeof(group));
+-	/* We're looking only for rfcomm channels */
+-	sdp_uuid16_create(&group, RFCOMM_UUID);
+-
+-	if (hci_devinfo(0, &di) < 0) return ERR_DEVICENOTWORK;
+-
+-	if (strcmp(s->CurrentConfig->Device, "/dev/ttyS1") == 0) {
+-		dbgprintf("Searching for devices\n");
+-		if (sdp_general_inquiry(ii, 20, 8, &count) < 0) {
+-			return ERR_UNKNOWN;
++        SDP_GET8(type, start);
++        switch (type) {
++        case SDP_DATA_SEQ8:
++                SDP_GET8(len, start);
++                break;
++
++        case SDP_DATA_SEQ16:
++                SDP_GET16(len, start);
++                break;
++
++        case SDP_DATA_SEQ32:
++                SDP_GET32(len, start);
++                break;
++
++        default:
++                smprintf(s, "Invalid Protocol Descriptor List. " \
++                                "Not a sequence, type=%#x\n", type);
++		return ERR_NOTSUPPORTED;
++                /* NOT REACHED */
++        }
++
++	while (start < end) {
++                SDP_GET8(type, start);
++                switch (type) {
++                case SDP_DATA_SEQ8:
++                        SDP_GET8(prot_len, start);
++                        break;
++
++                case SDP_DATA_SEQ16:
++                        SDP_GET16(prot_len, start);
++                        break;
++
++                case SDP_DATA_SEQ32:
++                        SDP_GET32(prot_len, start);
++                        break;
++
++                default:
++                        smprintf(s, "Invalid Protocol Descriptor List. " \
++                                        "Not a sequence, type=%#x\n", type);
++			return ERR_NOTSUPPORTED;
++                        /* NOT REACHED */
++                }
++
++                /* print_protocol_descriptor(start, start + len); */
++		param_end = start + prot_len;
++
++		/* Get Protocol UUID */
++		SDP_GET8(prot_type, start);
++		switch (prot_type) {
++		case SDP_DATA_UUID16:
++			SDP_GET16(prot_value.uint16, start);
++			break;
++
++		case SDP_DATA_UUID32:
++			SDP_GET32(prot_value.uint32, start);
++			break;
++
++		case SDP_DATA_UUID128:
++			SDP_GET_UUID128(&prot_value.int128, start);
++			break;
++
++		default:
++			smprintf(s, "Invalid Protocol Descriptor. " \
++					"Not a UUID, type=%#x\n", prot_type);
++			return ERR_NOTSUPPORTED;
++			/* NOT REACHED */
+ 		}
+-	} else {
+-		count = 1;
+-		str2ba(s->CurrentConfig->Device,&ii[0].bdaddr);
+-	}
+-	for (i=0;i<count;i++) {
+-		error = bluetooth_checkdevice(s,&ii[i].bdaddr,&group);
+-		if (error == ERR_NONE) return error;
+-	}
+-	return error;
++		
++
++		/* Protocol specific parameters */
++		for (param = 1; start < param_end; param ++) {
++			SDP_GET8(param_type, start);
++			switch (param_type) {
++			case SDP_DATA_NIL:
++				break;
++
++			case SDP_DATA_UINT8:
++			case SDP_DATA_INT8:
++			case SDP_DATA_BOOL:
++				SDP_GET8(param_value.uint8, start);
++				break;
++
++			case SDP_DATA_UINT16:
++			case SDP_DATA_INT16:
++			case SDP_DATA_UUID16:
++				SDP_GET16(param_value.uint16, start);
++				break;
++
++			case SDP_DATA_UINT32:
++			case SDP_DATA_INT32:
++			case SDP_DATA_UUID32:
++				SDP_GET32(param_value.uint32, start);
++				break;
++
++			case SDP_DATA_UINT64:
++			case SDP_DATA_INT64:
++				SDP_GET64(param_value.uint64, start);
++				break;
++
++			case SDP_DATA_UINT128:
++			case SDP_DATA_INT128:
++				SDP_GET128(&param_value.int128, start);
++				break;
++
++			case SDP_DATA_UUID128:
++				SDP_GET_UUID128(&param_value.int128, start);
++				break;
++
++			case SDP_DATA_STR8:
++			case SDP_DATA_URL8:
++				SDP_GET8(param_len, start);
++				start += param_len;
++				break;
++
++			case SDP_DATA_STR16:
++			case SDP_DATA_URL16:
++				SDP_GET16(param_len, start);
++				start += param_len;
++				break;
++
++			case SDP_DATA_STR32:
++			case SDP_DATA_URL32:
++				SDP_GET32(param_len, start);
++				start += param_len;
++				break;
++
++			case SDP_DATA_SEQ8:
++			case SDP_DATA_ALT8:
++				SDP_GET8(param_len, start);
++				start += param_len;
++				break;
++
++			case SDP_DATA_SEQ16:
++			case SDP_DATA_ALT16:
++				SDP_GET16(param_len, start);
++				start += param_len;
++				break;
++
++			case SDP_DATA_SEQ32:
++			case SDP_DATA_ALT32:
++				SDP_GET32(param_len, start);
++				start += param_len;
++				break;
++
++			default:
++				smprintf(s, "Invalid Protocol Descriptor Parameter. " \
++						"Unknown data type: %#02x\n", param_type);
++				return ERR_NOTSUPPORTED;
++				/* NOT REACHED */
++			}
++	 
++			smprintf(s, "prot_type=0x%02x, prot_value.uint16=0x%02x\n", prot_type, prot_value.uint16);
++			if (prot_type == SDP_DATA_UUID16)
++				if (prot_value.uint16 == SDP_UUID_PROTOCOL_RFCOMM)
++					if (param_type == SDP_DATA_UINT8 ||
++					    param_type == SDP_DATA_INT8) {
++						channel = param_value.uint8;
++						goto found;
++					};
++		}	
++        }
++	smprintf(s, "Protocol descriptor not found for RFCOMM\n");
++	return ERR_NOTSUPPORTED;
++	
++found:
++	return bluetooth_connect(s, channel, s->CurrentConfig->Device);
+ }
+ 
+ #endif
diff -ruN --exclude=CVS /usr/ports/comms/gammu/files/patch-common.CMakeLists.txt /usr/home/saper/FreeBSD/ports/gammu/files/patch-common.CMakeLists.txt
--- /usr/ports/comms/gammu/files/patch-common.CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ /usr/home/saper/FreeBSD/ports/gammu/files/patch-common.CMakeLists.txt	2009-01-13 05:08:25.093546000 +0100
@@ -0,0 +1,14 @@
+--- common/CMakeLists.txt.orig	2009-01-13 05:07:42.623430003 +0100
++++ common/CMakeLists.txt	2009-01-13 05:07:24.000000000 +0100
+@@ -92,6 +92,11 @@
+     include_directories (${FBSD_BLUE_INCLUDE_DIR})
+ endif (FBSD_BLUE_FOUND)
+ 
++if (FBSD_SDP_FOUND)
++    target_link_libraries (libGammu ${FBSD_SDP_LIBRARIES})
++    include_directories (${FBSD_SDP_INCLUDE_DIR})
++endif (FBSD_SDP_FOUND)
++
+ if (OSX_BLUE_FOUND)
+     target_link_libraries (libGammu ${OSX_BLUE_LIBS})
+     include_directories (${OSX_BLUE_INCLUDE_DIR})
===> Done


--------------070807010003080108040708--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?gkhftf$ogn$1>