summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/device/bluetoth/bluez.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/device/bluetoth/bluez.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/device/bluetoth/bluez.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gammu/emb/common/device/bluetoth/bluez.c b/gammu/emb/common/device/bluetoth/bluez.c
index 8a4807e..e7e8adf 100644
--- a/gammu/emb/common/device/bluetoth/bluez.c
+++ b/gammu/emb/common/device/bluetoth/bluez.c
@@ -1,4 +1,13 @@
-/* Based on work by Marcel Holtmann and other authors of Bluez */
+/* 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>
+ * GNU GPL version 2
+ */
+/* based on some Marcel Holtmann work from Gnokii (www.gnokii.org)
+ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
+ * GNU GPL version 2 or later
+ */
#include "../../gsmstate.h"
@@ -81,7 +90,7 @@ static void print_service_desc(void *value, void *user)
case SDP_UUID16:
case SDP_UUID32:
case SDP_UUID128:
- proto = 1;//sdp_uuid_to_proto(&p->val.uuid);
+ proto = sdp_uuid_to_proto(&p->val.uuid);
break;
case SDP_UINT8:
if (proto == RFCOMM_UUID) {
@@ -104,13 +113,13 @@ void print_access_protos(value, user)
static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, struct search_context *context)
{
sdp_session_t *sess;
- sdp_list_t *attrid, *search, *seq, *next, *proto = 0;
- uint32_t range = 0x0000ffff;
- char str[20];
sdp_record_t *rec;
+ sdp_list_t *attrid, *search, *seq, *next, *proto = 0;
sdp_data_t *d;
bdaddr_t interface;
+ uint32_t range = 0x0000ffff;
struct search_context subcontext;
+ char str[20];
int channel,channel2;
bacpy(&interface,BDADDR_ANY);
@@ -142,10 +151,10 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
if (!context->tree) {
d = sdp_data_get(rec,SDP_ATTR_SVCNAME_PRIMARY);
- if (false) {
+ if (sdp_get_access_protos(rec,&proto) == 0) {
channel = -1;
sdp_list_foreach(proto,print_access_protos,&channel);
- //sdp_list_free(proto,(sdp_free_func_t)sdp_data_free);
+ sdp_list_free(proto,(sdp_free_func_t)sdp_data_free);
}
smprintf(s,"Channel %i",channel);
if (d) smprintf(s," - \"%s\"",d->val.str);
@@ -162,13 +171,13 @@ static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, st
next = seq->next;
free(seq);
- //sdp_record_free(rec);
+ sdp_record_free(rec);
}
sdp_close(sess);
if (channel2 != -1) return bluetooth_connect(s, channel2, str);
- return ERR_UNKNOWN;
+ return ERR_NOTSUPPORTED;
}
GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
@@ -180,7 +189,7 @@ GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
GSM_Error error = ERR_NOTSUPPORTED;
memset(&context, '\0', sizeof(struct search_context));
- //sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP);
+ sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP);
if (!strcmp(s->CurrentConfig->Device,"/dev/ttyS1")) {
dbgprintf("Searching for devices\n");