Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2011 17:52:44 +0100 (BST)
From:      Iain Hibbert <plunky@rya-online.net>
To:        freebsd-bluetooth@freebsd.org
Subject:   obexapp & openobex-current
Message-ID:  <alpine.NEB.2.00.1106211735230.14756@galant.ukfsn.org>

next in thread | raw e-mail | index | archive | help
Hi,

openobex is aiming towards a 2.0 release so I thought I'd try it out.. I
have forwarded a set of patches for some build failures on NetBSD which
may also help for FreeBSD, but after that I have another issue

The issue I found was that obexapp when linked with openobex-current fails
to run in server mode.  I traced the problem to the custom transport
backend does not have any method for setting a local address, which is
implied by OBEX_ServerRegister passing one, but in truth there was never
any actual point in passing an address here since a custom transport is
responsible for its own addressing.

The documentation was perhaps lacking before, but the following appears in
the comments for OBEX_ServerRegister now;

	Bind a server socket to an Obex service. Common transport have
	specialised version of this function.
	If you want to call the listen callback of the custom transport,
	use NULL for saddr and 0 for addrlen.

and so, changing server.c as below allows to the server to run just fine
without any side effects, and I think that should be ok for earlier
openobex versions too?

iain

--- /home/plunky/misc/orig/obexapp/server.c	2010-01-08 18:31:22.000000000 +0000
+++ server.c	2011-06-21 15:47:47.000000000 +0100
@@ -119,7 +119,6 @@ obexapp_server(obex_t *handle)
 {
 	context_p		 context = (context_p) OBEX_GetUserData(handle);
 	int			 error = -1;
-	struct sockaddr_rfcomm	 addr;

 	context->ss = sdp_open_local(NULL);
 	if (context->ss == NULL) {
@@ -141,14 +140,7 @@ obexapp_server(obex_t *handle)
 		goto done;
 	}

-	memset(&addr, 0, sizeof(addr));
-	addr.rfcomm_len = sizeof(addr);
-	addr.rfcomm_family = AF_BLUETOOTH;
-	addr.rfcomm_channel = context->channel;
-	memcpy(&addr.rfcomm_bdaddr, &context->laddr, sizeof(context->laddr));
-
-	if (OBEX_ServerRegister(handle, (struct sockaddr *) &addr,
-			sizeof(addr)) < 0) {
+	if (OBEX_ServerRegister(handle, NULL, 0) < 0) {
 		log_err("%s(): OBEX_ServerRegister failed", __func__);
 		goto done;
 	}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.NEB.2.00.1106211735230.14756>