From 170edeacdd0b1d4bd14cd125ef10faf80fafdab9 Mon Sep 17 00:00:00 2001 From: xtraeme Date: Mon, 17 Jul 2006 12:29:57 +0000 Subject: Update to 0.20 (latest stable version): Changes: * Motorola support, tested with models v710/e815 * object caching and directory parsing (for things like ObexFS) * Nokia support via IrDA and Bluetooth * Siemens S65 support * Everything but data goes to stderr for more simple redirection. * VMO converter (gsm and wav) split into seperate package. * Ericsson and Siemens cable support unified (still testing). pkgsrc changes: * NetBSD bluetooth support, thanks to Iain Hibbert for finishing it. --- comms/obexftp/Makefile | 28 ++++-- comms/obexftp/PLIST | 19 ++-- comms/obexftp/distinfo | 26 ++--- comms/obexftp/patches/patch-aa | 70 ++++++++++--- comms/obexftp/patches/patch-ab | 27 ++--- comms/obexftp/patches/patch-ac | 34 +++++-- comms/obexftp/patches/patch-ad | 36 +++++-- comms/obexftp/patches/patch-ae | 25 ++--- comms/obexftp/patches/patch-af | 29 ++++-- comms/obexftp/patches/patch-ag | 27 +++-- comms/obexftp/patches/patch-ah | 13 +++ comms/obexftp/patches/patch-ai | 30 ++++++ comms/obexftp/patches/patch-aj | 218 +++++++++++++++++++++++++++++++++++++++++ comms/obexftp/patches/patch-ak | 63 ++++++++++++ 14 files changed, 540 insertions(+), 105 deletions(-) create mode 100644 comms/obexftp/patches/patch-ah create mode 100644 comms/obexftp/patches/patch-ai create mode 100644 comms/obexftp/patches/patch-aj create mode 100644 comms/obexftp/patches/patch-ak (limited to 'comms') diff --git a/comms/obexftp/Makefile b/comms/obexftp/Makefile index 089461b77d5..d789cf00382 100644 --- a/comms/obexftp/Makefile +++ b/comms/obexftp/Makefile @@ -1,17 +1,33 @@ -# $NetBSD: Makefile,v 1.6 2006/03/04 21:29:05 jlam Exp $ +# $NetBSD: Makefile,v 1.7 2006/07/17 12:29:57 xtraeme Exp $ # -DISTNAME= obexftp-0.10.3 -PKGREVISION= 2 +DISTNAME= obexftp-0.20 CATEGORIES= comms MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=openobex/} +EXTRACT_SUFX= .tar.bz2 -MAINTAINER= pkgsrc-users@NetBSD.org +MAINTAINER= xtraeme@NetBSD.org HOMEPAGE= http://triq.net/obex/ COMMENT= File copying over the Object Exchange (OBEX) protocol -GNU_CONFIGURE= YES -USE_LIBTOOL= YES +GNU_CONFIGURE= yes +USE_TOOLS+= autoconf gmake pkg-config +USE_LIBTOOL= yes + +CONFIGURE_ARGS+= --disable-perl +CONFIGURE_ARGS+= --disable-python +CONFIGURE_ARGS+= --disable-swig + +.include "../../mk/bsd.prefs.mk" + +.if (${OPSYS} == "NetBSD" && exists(/usr/include/bluetooth.h)) +CPPFLAGS+= -DCOMPAT_BLUEZ +.endif + +post-patch: + cd ${WRKSRC} && autoconf .include "../../comms/openobex/buildlink3.mk" +.include "../../converters/libiconv/buildlink3.mk" +.include "../../devel/libusb/buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/comms/obexftp/PLIST b/comms/obexftp/PLIST index 5dbd4ffdf85..42e55d6253f 100644 --- a/comms/obexftp/PLIST +++ b/comms/obexftp/PLIST @@ -1,21 +1,18 @@ -@comment $NetBSD: PLIST,v 1.2 2004/09/22 08:09:21 jlam Exp $ -bin/gsm2vmo +@comment $NetBSD: PLIST,v 1.3 2006/07/17 12:29:57 xtraeme Exp $ bin/obexftp -bin/vmo2gsm -bin/vmo2wav +bin/obexftpd include/bfb/bfb.h include/bfb/bfb_io.h -include/cobexbfb/cobex_bfb.h -include/cobexpe/cobex_pe.h +include/multicobex/multi_cobex.h include/obexftp/client.h include/obexftp/obexftp.h include/obexftp/object.h +include/obexftp/uuid.h lib/libbfb.la -lib/libcobexbfb.la -lib/libcobexpe.la +lib/libmulticobex.la lib/libobexftp.la -man/man1/flexmem.1 +man/man1/obexftp.1 +man/man1/obexftpd.1 @dirrm include/obexftp -@dirrm include/cobexpe -@dirrm include/cobexbfb +@dirrm include/multicobex @dirrm include/bfb diff --git a/comms/obexftp/distinfo b/comms/obexftp/distinfo index 86b094c9338..2120e662dac 100644 --- a/comms/obexftp/distinfo +++ b/comms/obexftp/distinfo @@ -1,12 +1,16 @@ -$NetBSD: distinfo,v 1.2 2005/02/23 16:05:30 agc Exp $ +$NetBSD: distinfo,v 1.3 2006/07/17 12:29:57 xtraeme Exp $ -SHA1 (obexftp-0.10.3.tar.gz) = 7f8756597e4660f71147a60fd5a5dc79a55e6cc6 -RMD160 (obexftp-0.10.3.tar.gz) = 25fae7ba0da9a3925cd0a405611c0f705676b11e -Size (obexftp-0.10.3.tar.gz) = 286083 bytes -SHA1 (patch-aa) = a00bd78a2fe83d7758b7b4b42cf8a09e4167d854 -SHA1 (patch-ab) = 75005d57e2ef1ae2594b2513ab5235018dab0b4f -SHA1 (patch-ac) = e41b1d6b1ede9c27f3e238b708b17acbab953e28 -SHA1 (patch-ad) = cf3ce3b10d4f35cb01f52b89c1d0636bd23ec1f6 -SHA1 (patch-ae) = 8f97189137675fb6ba34ec8253f6e34bf72e111f -SHA1 (patch-af) = a18813e45590ecdc5b7402320f1e3c08daadd788 -SHA1 (patch-ag) = 6183be32c1485854be6732d28b1c87cf73e48211 +SHA1 (obexftp-0.20.tar.bz2) = 0b3a7d2aeb0dbd24d75761a7e59f42f46ea5ef82 +RMD160 (obexftp-0.20.tar.bz2) = ded5cf4d95eac77d5f6ee0a39f3789eb962534ed +Size (obexftp-0.20.tar.bz2) = 351641 bytes +SHA1 (patch-aa) = 7caed98158f6c17c3f3f64f3058f66abcf219559 +SHA1 (patch-ab) = d4693413a992f53f6aca92d9e920185c1b5e4f0e +SHA1 (patch-ac) = d06b6be98745778e2ce8e97762c102d4dbccecfc +SHA1 (patch-ad) = 8c3b99cbc2f45fe039aae000aeebb2d5779355f9 +SHA1 (patch-ae) = 276fa421e2f20784cbcb873b0ce6870bef71d033 +SHA1 (patch-af) = 4de53a6ec0d711f948980cdfdd4adea3928b64bd +SHA1 (patch-ag) = e61fdbba340af591318b1aa3b70272a969e01e70 +SHA1 (patch-ah) = c0fe5bd78e7614a7eb6adb7154676fd9bde7a31c +SHA1 (patch-ai) = 9080e819a0855b591f613a0482e7297332922101 +SHA1 (patch-aj) = c563733a616ec0ad5b94a3ff8de5e3a2e91ccd5b +SHA1 (patch-ak) = 276e1f41d784b50b29c0b2c2e08f47c040ab4ad7 diff --git a/comms/obexftp/patches/patch-aa b/comms/obexftp/patches/patch-aa index 6da3e2c095c..c4403a21c63 100644 --- a/comms/obexftp/patches/patch-aa +++ b/comms/obexftp/patches/patch-aa @@ -1,16 +1,56 @@ -$NetBSD: patch-aa,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-aa,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- bfb/bfb_io.c.orig 2003-04-11 12:34:10.000000000 +0200 -+++ bfb/bfb_io.c -@@ -272,8 +272,10 @@ void bfb_io_close(fd_t fd, int force) - /* Send a break to get out of OBEX-mode */ - #ifdef _WIN32 - if(SetCommBreak(fd) != TRUE) { --#else -+#elif defined(TCSBRKP) - if(ioctl(fd, TCSBRKP, 0) < 0) { -+#else -+ if(tcsendbreak(fd, 0) == -1) { - #endif - DEBUG(1, "Unable to send break!\n"); - } +--- aclocal.m4.orig 2006-05-16 15:50:36.000000000 +0100 ++++ aclocal.m4 +@@ -56,6 +56,9 @@ if test "$ac_bluetooth_enabled" = yes; t + #ifdef __FreeBSD__ + #include + #include ++ #elif defined(__NetBSD__) ++ #include ++ #include + #else /* Linux */ + #include + #include +@@ -65,6 +68,9 @@ if test "$ac_bluetooth_enabled" = yes; t + #ifdef __FreeBSD__ + bdaddr_t bdaddr; + struct sockaddr_rfcomm addr; ++ #elif defined(__NetBSD__) ++ bdaddr_t bdaddr; ++ struct sockaddr_bt addr; + #else /* Linux */ + bdaddr_t bdaddr; + struct sockaddr_rc addr; +@@ -76,6 +82,7 @@ if test "$ac_bluetooth_enabled" = yes; t + AC_DEFINE([HAVE_BLUETOOTH], [1], [Define if system supports Bluetooth and it's enabled]) + BLUETOOTH_CFLAGS="" + BLUETOOTH_LIBS="-lbluetooth" ++ AC_CHECK_LIB(sdp, sdp_open, BLUETOOTH_LIBS="$BLUETOOTH_LIBS -lsdp") + fi + AC_SUBST(BLUETOOTH_CFLAGS) + AC_SUBST(BLUETOOTH_LIBS) +@@ -92,14 +99,22 @@ AC_DEFUN([SDPLIB_CHECK],[ + AC_MSG_CHECKING(for Bluetooth SDP support) + + AC_TRY_COMPILE( [ ++ #ifdef __NetBSD__ ++ #include ++ #include ++ #else + #include ++ #endif + ],[ ++ #ifdef __NetBSD__ ++ sdp_attr_t attr; ++ #else + sdp_list_t sdplist; ++ #endif + ], + am_cv_sdplib_found=yes, + am_cv_sdplib_found=no + ) +- + if test $am_cv_sdplib_found = yes; then + AC_DEFINE(HAVE_SDPLIB,1,[Define if system supports Bluetooth SDP]) + diff --git a/comms/obexftp/patches/patch-ab b/comms/obexftp/patches/patch-ab index fae546a108d..496247e04a0 100644 --- a/comms/obexftp/patches/patch-ab +++ b/comms/obexftp/patches/patch-ab @@ -1,16 +1,19 @@ -$NetBSD: patch-ab,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-ab,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- cobexpe/cobex_pe.c.orig 2003-04-10 00:37:02.000000000 +0200 -+++ cobexpe/cobex_pe.c -@@ -151,7 +151,11 @@ static void cobex_pe_cleanup(cobex_t *c, +--- multicobex/multi_cobex.c.orig 2005-11-24 15:55:11.000000000 +0100 ++++ multicobex/multi_cobex.c 2006-07-09 12:21:14.000000000 +0200 +@@ -49,6 +49,14 @@ + #include + #endif - if(force) { - /* Send a break to get out of OBEX-mode */ -+#ifdef TCSBRKP - if(ioctl(c->fd, TCSBRKP, 0) < 0) { ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include +#else -+ if(tcsendbreak(c->fd, 0) == -1) { ++#include +#endif - DEBUG(1, "Unable to send break!\n"); - } - sleep(1); ++#endif /* HAVE_BLUETOOTH */ ++ + #include + #include "multi_cobex.h" + #include "multi_cobex_private.h" diff --git a/comms/obexftp/patches/patch-ac b/comms/obexftp/patches/patch-ac index abaaf00c69f..014edff2d50 100644 --- a/comms/obexftp/patches/patch-ac +++ b/comms/obexftp/patches/patch-ac @@ -1,12 +1,26 @@ -$NetBSD: patch-ac,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-ac,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- obexftp/client.c.orig 2003-02-16 19:56:31.000000000 +0100 -+++ obexftp/client.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include +--- obexftp/object.h.orig 2005-09-13 16:53:20.000000000 +0200 ++++ obexftp/object.h 2006-07-09 12:45:14.000000000 +0200 +@@ -22,7 +22,21 @@ + #ifndef OBEXFTP_OBJECT_H + #define OBEXFTP_OBJECT_H - /* htons */ - #ifdef _WIN32 ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ + #include ++#include ++ ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else ++#include ++#endif ++#endif /* HAVE_BLUETOOTH */ ++ + #include + + #ifdef __cplusplus diff --git a/comms/obexftp/patches/patch-ad b/comms/obexftp/patches/patch-ad index bae3fbcaa76..c017c183b75 100644 --- a/comms/obexftp/patches/patch-ad +++ b/comms/obexftp/patches/patch-ad @@ -1,12 +1,28 @@ -$NetBSD: patch-ad,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-ad,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- obexftp/dirtraverse.c.orig 2003-01-15 23:52:47.000000000 +0100 -+++ obexftp/dirtraverse.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include +--- obexftp/client.h.orig 2006-01-11 16:22:51.000000000 +0100 ++++ obexftp/client.h 2006-07-09 12:39:10.000000000 +0200 +@@ -22,9 +22,23 @@ + #ifndef OBEXFTP_CLIENT_H + #define OBEXFTP_CLIENT_H + ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ + #include #include - #include - #ifdef _WIN32 ++#include + #include ++ ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else ++#include ++#endif ++#endif /* HAVE_BLUETOOTH */ ++ + #include + #ifndef OBEX_TRANS_USB + #define OBEX_TRANS_USB 6 diff --git a/comms/obexftp/patches/patch-ae b/comms/obexftp/patches/patch-ae index 43c12b34c07..a39ed4d091d 100644 --- a/comms/obexftp/patches/patch-ae +++ b/comms/obexftp/patches/patch-ae @@ -1,12 +1,15 @@ -$NetBSD: patch-ae,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-ae,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- obexftp/obexftp_io.c.orig 2003-01-15 23:52:12.000000000 +0100 -+++ obexftp/obexftp_io.c -@@ -24,6 +24,7 @@ - #include - #include /* FIXME: libraries shouldn't do this */ - #include -+#include - - #include - #include +--- obexftp/client.c.orig 2006-07-09 12:37:02.000000000 +0200 ++++ obexftp/client.c 2006-07-09 12:38:10.000000000 +0200 +@@ -48,6 +48,10 @@ + #ifdef __FreeBSD__ + #include + #include ++#elif defined(__NetBSD__) ++#include ++#include ++#include + #else /* Linux */ + #include + #include diff --git a/comms/obexftp/patches/patch-af b/comms/obexftp/patches/patch-af index 813d91e37c1..b4aaadb53e2 100644 --- a/comms/obexftp/patches/patch-af +++ b/comms/obexftp/patches/patch-af @@ -1,12 +1,23 @@ -$NetBSD: patch-af,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-af,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- vmo/gsm2vmo.c.orig 2003-02-17 22:55:47.000000000 +0100 -+++ vmo/gsm2vmo.c -@@ -32,6 +32,7 @@ - #include +--- obexftp/obexftp_io.c.orig 2006-07-09 12:40:32.000000000 +0200 ++++ obexftp/obexftp_io.c 2006-07-09 12:41:36.000000000 +0200 +@@ -30,6 +30,18 @@ #include - #include -+#include - #include - #include /* ntohs */ + #include ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else ++#include ++#endif ++#endif /* HAVE_BLUETOOTH */ ++ + #include + + #include "obexftp_io.h" diff --git a/comms/obexftp/patches/patch-ag b/comms/obexftp/patches/patch-ag index 16891d850ba..5275ad7c970 100644 --- a/comms/obexftp/patches/patch-ag +++ b/comms/obexftp/patches/patch-ag @@ -1,12 +1,19 @@ -$NetBSD: patch-ag,v 1.1.1.1 2004/02/26 12:50:45 jmmv Exp $ +$NetBSD: patch-ag,v 1.2 2006/07/17 12:29:57 xtraeme Exp $ ---- vmo/vmo2gsm.c.orig 2003-02-17 22:55:40.000000000 +0100 -+++ vmo/vmo2gsm.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - #include - #include /* ntohs */ +--- obexftp/cache.c.orig 2006-07-09 12:43:21.000000000 +0200 ++++ obexftp/cache.c 2006-07-09 12:43:56.000000000 +0200 +@@ -40,6 +40,14 @@ + #include + #endif ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else ++#include ++#endif ++#endif /* HAVE_BLUETOOTH */ ++ + #include + + #include "obexftp.h" diff --git a/comms/obexftp/patches/patch-ah b/comms/obexftp/patches/patch-ah new file mode 100644 index 00000000000..c6dd1c06697 --- /dev/null +++ b/comms/obexftp/patches/patch-ah @@ -0,0 +1,13 @@ +$NetBSD: patch-ah,v 1.1 2006/07/17 12:29:57 xtraeme Exp $ + +--- obexftp/Makefile.in.orig 2006-07-09 12:56:29.000000000 +0200 ++++ obexftp/Makefile.in 2006-07-09 12:57:34.000000000 +0200 +@@ -201,7 +201,7 @@ + object.h + + +-libobexftp_la_LDFLAGS = -version-info $(OBEXFTP_VERSION) ++libobexftp_la_LDFLAGS = -version-info $(OBEXFTP_VERSION) @BLUETOOTH_LIBS@ + + EXTRA_DIST = client.i + subdir = obexftp diff --git a/comms/obexftp/patches/patch-ai b/comms/obexftp/patches/patch-ai new file mode 100644 index 00000000000..512e96ee7f7 --- /dev/null +++ b/comms/obexftp/patches/patch-ai @@ -0,0 +1,30 @@ +$NetBSD: patch-ai,v 1.1 2006/07/17 12:29:57 xtraeme Exp $ + +--- apps/obexftpd.c.orig 2006-07-09 16:43:20.000000000 +0200 ++++ apps/obexftpd.c 2006-07-09 16:45:04.000000000 +0200 +@@ -23,6 +23,10 @@ + * Created at: Don, 2 Okt 2003 + */ + ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ + #include + #include + #include +@@ -45,6 +49,14 @@ + #include + #endif /*_WIN32*/ + ++#ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else ++#include ++#endif ++#endif /* HAVE_BLUETOOTH */ ++ + /* just until there is a server layer in obexftp */ + #include + diff --git a/comms/obexftp/patches/patch-aj b/comms/obexftp/patches/patch-aj new file mode 100644 index 00000000000..0a6d1e41d62 --- /dev/null +++ b/comms/obexftp/patches/patch-aj @@ -0,0 +1,218 @@ +$NetBSD: patch-aj,v 1.1 2006/07/17 12:29:57 xtraeme Exp $ + +--- apps/bt_discovery.c.orig 2006-01-11 17:27:35.000000000 +0000 ++++ apps/bt_discovery.c +@@ -10,6 +10,205 @@ + #include + #include + ++#ifdef __NetBSD__ ++#include ++#include ++#include ++#include ++ ++#include "bt_discovery.h" ++ ++/* ++ * Parse protocol descriptor list for the RFCOMM channel ++ * ++ * seq8 len8 2 ++ * seq8 len8 2 ++ * uuid16 value16 3 L2CAP ++ * seq8 len8 2 ++ * uuid16 value16 3 RFCOMM ++ * uint8 value8 2 channel ++ * === ++ * 14 ++ */ ++ ++static int32_t ++parse_rfcomm_channel(sdp_attr_t *a) ++{ ++ uint8_t *ptr = a->value; ++ uint8_t *end = a->value + a->vlen; ++ int32_t type, len, uuid, channel; ++ ++ if (end - ptr < 14) ++ return (-1); ++ ++ SDP_GET8(type, ptr); ++ switch (type) { ++ case SDP_DATA_SEQ8: ++ SDP_GET8(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ16: ++ SDP_GET16(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ32: ++ SDP_GET32(len, ptr); ++ break; ++ ++ default: ++ return (-1); ++ } ++ if (ptr + len > end) ++ return (-1); ++ ++ /* Protocol */ ++ SDP_GET8(type, ptr); ++ switch (type) { ++ case SDP_DATA_SEQ8: ++ SDP_GET8(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ16: ++ SDP_GET16(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ32: ++ SDP_GET32(len, ptr); ++ break; ++ ++ default: ++ return (-1); ++ } ++ if (ptr + len > end) ++ return (-1); ++ ++ /* UUID */ ++ if (ptr + 3 > end) ++ return (-1); ++ SDP_GET8(type, ptr); ++ switch (type) { ++ case SDP_DATA_UUID16: ++ SDP_GET16(uuid, ptr); ++ if (uuid != SDP_UUID_PROTOCOL_L2CAP) ++ return (-1); ++ break; ++ ++ case SDP_DATA_UUID32: /* XXX FIXME can we have 32-bit UUID */ ++ case SDP_DATA_UUID128: /* XXX FIXME can we have 128-bit UUID */ ++ default: ++ return (-1); ++ } ++ ++ /* Protocol */ ++ SDP_GET8(type, ptr); ++ switch (type) { ++ case SDP_DATA_SEQ8: ++ SDP_GET8(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ16: ++ SDP_GET16(len, ptr); ++ break; ++ ++ case SDP_DATA_SEQ32: ++ SDP_GET32(len, ptr); ++ break; ++ ++ default: ++ return (-1); ++ } ++ if (ptr + len > end) ++ return (-1); ++ ++ /* UUID */ ++ if (ptr + 3 > end) ++ return (-1); ++ SDP_GET8(type, ptr); ++ switch (type) { ++ case SDP_DATA_UUID16: ++ SDP_GET16(uuid, ptr); ++ if (uuid != SDP_UUID_PROTOCOL_RFCOMM) ++ return (-1); ++ break; ++ ++ case SDP_DATA_UUID32: /* XXX FIXME can we have 32-bit UUID */ ++ case SDP_DATA_UUID128: /* XXX FIXME can we have 128-bit UUID */ ++ default: ++ return (-1); ++ } ++ ++ /* channel */ ++ if (ptr + 2 > end) ++ return (-1); ++ ++ SDP_GET8(type, ptr); ++ if (type != SDP_DATA_UINT8) ++ return (-1); ++ ++ SDP_GET8(channel, ptr); ++ ++ return (channel); ++} ++ ++int ++discover_bt(char *addr, char **res_bdaddr, int *res_channel) ++{ ++ bdaddr_t laddr, raddr; ++ uint8_t buffer[256]; ++ sdp_attr_t proto = { SDP_ATTR_INVALID, 0, sizeof(buffer), buffer }; ++ 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); ++ void *ss; ++ ++ /* ++ * Convert given address to bdaddr. If not bdaddr, ++ * look it up in hosts database. ++ * ++ * XXX original does an inquiry if no name is given, ++ * XXX and matches against the name given or uses ++ * XXX the first device found. Consider that. ++ */ ++ if (addr == NULL) ++ errx(1, "must have address"); ++ ++ if (!bt_aton(addr, &raddr)) { ++ struct hostent *he = NULL; ++ ++ if ((he = bt_gethostbyname(addr)) == NULL) ++ errx(1, "%s: %s", ++ addr, hstrerror(h_errno)); ++ ++ bdaddr_copy(&raddr, (bdaddr_t *)he->h_addr); ++ } ++ ++ *res_bdaddr = strdup(bt_ntoa(&raddr, NULL)); ++ fprintf(stderr, "Browsing %s ...\n", *res_bdaddr); ++ ++ /* ++ * Connect to remote SDP server to find the channel ++ * number to use for the OBEX_FILE_TRANSFER service ++ */ ++ bdaddr_copy(&laddr, BDADDR_ANY); ++ ss = sdp_open(&laddr, &raddr); ++ if (ss == NULL || (errno = sdp_error(ss)) != 0) ++ err(1, "%s", addr); ++ ++ if (sdp_search(ss, 1, &serv, 1, &attr, 1, &proto) != 0) ++ errx(1, "sdp_search", strerror(sdp_error(ss))); ++ ++ if (proto.flags != SDP_ATTR_OK) ++ errx(1, "sdp_search: File Transfer not available"); ++ ++ sdp_close(ss); ++ ++ *res_channel = parse_rfcomm_channel(&proto); ++ if (*res_channel == -1) ++ errx(1, "sdp_search: No Channel #"); ++ ++ return 0; ++} ++#else + #include + #include + #include +@@ -146,6 +345,7 @@ int discover_bt(char *addr, char **res_b + + return 0; + } ++#endif + + #else + #include "bt_discovery.h" diff --git a/comms/obexftp/patches/patch-ak b/comms/obexftp/patches/patch-ak new file mode 100644 index 00000000000..45057c372bb --- /dev/null +++ b/comms/obexftp/patches/patch-ak @@ -0,0 +1,63 @@ +$NetBSD: patch-ak,v 1.1 2006/07/17 12:29:57 xtraeme Exp $ + +--- apps/obexftp_sdp.c.orig 2006-07-15 19:50:12.000000000 +0100 ++++ apps/obexftp_sdp.c +@@ -34,6 +34,53 @@ + #include + #include + ++#ifdef __NetBSD__ ++#include ++#include ++ ++#include "obexftp_sdp.h" ++ ++#define OBEXFTP_RFCOMM_CHANNEL 10 ++ ++static void *session; ++ ++void ++obexftp_sdp_unregister(void) ++{ ++ sdp_close(session); ++} ++ ++int ++obexftp_sdp_register(void) ++{ ++ sdp_ftrn_profile_t ftrn; ++ bdaddr_t bdaddr; ++ ++ memset(&ftrn, 0, sizeof(ftrn)); ++ ftrn.server_channel = OBEXFTP_RFCOMM_CHANNEL; ++ ++ bdaddr_copy(&bdaddr, BDADDR_ANY); ++ ++ session = sdp_open_local(NULL); ++ if (session == NULL || (errno = sdp_error(session))) { ++ syslog(LOG_ERR, "Failed to connect to the local SDP server. %s(%d)", ++ strerror(errno), errno); ++ ++ return -1; ++ } ++ ++ if (sdp_register_service(session, SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER, ++ &bdaddr, (uint8_t *)&ftrn, sizeof(ftrn), NULL) != 0) { ++ errno = sdp_error(session); ++ syslog(LOG_ERR, "SDP registration failed. %s(%d)", ++ strerror(errno), errno); ++ sdp_close(session); ++ return -1; ++ } ++ ++ return 0; ++} ++#else + #include + #include + #include +@@ -173,3 +220,4 @@ int obexftp_sdp_search(bdaddr_t *src, bd + return 0; + } + */ ++#endif -- cgit v1.2.3