obexapp & openobex-current

Iain Hibbert plunky at rya-online.net
Tue Jun 21 17:28:04 UTC 2011


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?


--- /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;

More information about the freebsd-bluetooth mailing list