1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

- Update to 1.4

- Add USB support (adopted from ports/128776)

PR:		128979
Submitted by:	Alex Samorukov <samm at os2 dot kiev dot ua>
Approved by:	Guido Falsi <mad at madpilot dot net> (maintainer)
This commit is contained in:
Dmitry Marakasov 2008-11-19 22:44:31 +00:00
parent 301edfdf6c
commit 41b7677280
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=223064
14 changed files with 101 additions and 312 deletions

View File

@ -6,24 +6,29 @@
#
PORTNAME= openobex
PORTVERSION= 1.3
PORTREVISION= 1
PORTVERSION= 1.4
CATEGORIES= comms net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
MASTER_SITES= http://www.kernel.org/pub/linux/bluetooth/ \
http://www.de.kernel.org/pub/linux/bluetooth/
MAINTAINER= mad@madpilot.net
COMMENT= Open source implementation of the OBEX protocol
USE_AUTOTOOLS= automake:14:env autoheader:262 autoconf:262 libtool:15
USE_GMAKE= yes
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --program-transform-name="" \
--disable-usb
USE_GMAKE= yes
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
USE_GNOME= gnomehack
post-patch:
@ ${REINPLACE_CMD} -e "s|pkgconfigdir =.*|pkgconfigdir = ${PREFIX}/libdata/pkgconfig|g" \
${WRKSRC}/Makefile.in
OPTIONS= LIBUSB "Enable OBEX over USB" no
.include <bsd.port.mk>
.include <bsd.port.pre.mk>
.if defined(WITH_LIBUSB)
LIB_DEPENDS+= usb-0.1.8:${PORTSDIR}/devel/libusb
CONFIGURE_ARGS+=--enable-usb
CFLAGS+= -I${PREFIX}/include
.else
CONFIGURE_ARGS+=--disable-usb
.endif
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
MD5 (openobex-1.3.tar.gz) = feaa5dfe5151c0e70e8f868fa4648a43
SHA256 (openobex-1.3.tar.gz) = 3a80ba2524c66a46db3ac17a788a759015a1f79de6a495fcdf3a316e19fe7c23
SIZE (openobex-1.3.tar.gz) = 337614
MD5 (openobex-1.4.tar.gz) = 572a52ac423434a3290c5f867eed362d
SHA256 (openobex-1.4.tar.gz) = 79265309e2320beb03910fccf27fd04aefb18ba47a900947d2de8e88fae05cd8
SIZE (openobex-1.4.tar.gz) = 393756

View File

@ -1,40 +0,0 @@
--- aclocal.m4.orig Wed Jun 14 15:58:25 2006
+++ aclocal.m4 Sat Nov 25 21:55:24 2006
@@ -6914,6 +6914,37 @@
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+dnl adding a check for FreeBSD blutooth netgraph support.
+
+AC_DEFUN([FREEBSD_BLUETOOTH_HOOK],[
+ AC_MSG_CHECKING([for the FreeBSD/netgraph bluetooth support])
+ echo
+ AC_CHECK_LIB(bluetooth, bt_aton,
+ [AC_CACHE_CHECK(for the struct sockaddr_rfcomm in <netgraph/.../ng_btsocket.h>, ac_cv_have_sockaddr_rfcomm,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <bitstring.h>
+ #include <netgraph/bluetooth/include/ng_hci.h>
+ #include <netgraph/bluetooth/include/ng_l2cap.h>
+ #include <netgraph/bluetooth/include/ng_btsocket.h>],
+ [struct sockaddr_rfcomm rc;],
+ ac_cv_have_sockaddr_rfcomm=yes,
+ ac_cv_have_sockaddr_rfcomm=no)])
+
+ if test $ac_cv_have_sockaddr_rfcomm = yes; then
+ AC_DEFINE(HAVE_BLUETOOTH)
+ AC_DEFINE(HAVE_BLUETOOTH_NETGRAPH,1,[Compile on FreeBSD])
+ USE_BLUETOOTH="yes"
+ LIBS="$LIBS -lbluetooth"
+ AC_DEFINE(HAVE_BT_ATON,1,[Define to 1 if you have the \`bt_aton' function.])
+ fi
+])])
+
+AC_DEFUN([FREEBSD_BLUETOOTH_CHECK], [
+ FREEBSD_BLUETOOTH_HOOK([],failure)
+])
+
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005

View File

@ -0,0 +1,12 @@
diff -ur lib/bluez_compat.h work.2/openobex-1.4/lib/bluez_compat.h
--- lib/bluez_compat.h 2008-11-07 14:36:09.000000000 +0200
+++ lib/bluez_compat.h 2008-11-19 02:34:53.000000000 +0200
@@ -53,6 +53,8 @@
#define rc_family rfcomm_family
#define rc_bdaddr rfcomm_bdaddr
#define rc_channel rfcomm_channel
+#define BDADDR_ANY NG_HCI_BDADDR_ANY
+#define BTPROTO_RFCOMM BLUETOOTH_PROTO_RFCOMM
#elif defined(HAVE_BLUETOOTH_NETBSD)
#include <bluetooth.h>

View File

@ -1,10 +0,0 @@
--- configure.in.orig Wed Jun 14 11:24:13 2006
+++ configure.in Sat Nov 25 21:56:52 2006
@@ -22,6 +22,7 @@
AC_PATH_IRDA
AC_PATH_BLUEZ
AC_PATH_USB
+FREEBSD_BLUETOOTH_CHECK
AC_ARG_OPENOBEX

View File

@ -1,110 +0,0 @@
--- lib/btobex.c.orig Tue Jan 3 20:36:15 2006
+++ lib/btobex.c Sat Nov 25 22:00:13 2006
@@ -46,8 +46,12 @@
#include <netinet/in.h>
#include <sys/socket.h>
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+#include <bluetooth.h>
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /* _WIN32 */
@@ -63,6 +67,15 @@
void btobex_prepare_connect(obex_t *self, bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
{
#ifndef _WIN32
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH;
+ bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src);
+ self->trans.self.rfcomm.rfcomm_channel = 0;
+
+ self->trans.peer.rfcomm.rfcomm_family = AF_BLUETOOTH;
+ bacpy(&self->trans.peer.rfcomm.rfcomm_bdaddr, dst);
+ self->trans.peer.rfcomm.rfcomm_channel = channel;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
self->trans.self.rfcomm.rc_family = AF_BLUETOOTH;
bacpy(&self->trans.self.rfcomm.rc_bdaddr, src);
self->trans.self.rfcomm.rc_channel = 0;
@@ -70,6 +83,7 @@
self->trans.peer.rfcomm.rc_family = AF_BLUETOOTH;
bacpy(&self->trans.peer.rfcomm.rc_bdaddr, dst);
self->trans.peer.rfcomm.rc_channel = channel;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /* _WIN32 */
}
@@ -83,9 +97,15 @@
{
#ifndef _WIN32
/* Bind local service */
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH;
+ bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src);
+ self->trans.self.rfcomm.rfcomm_channel = channel;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
self->trans.self.rfcomm.rc_family = AF_BLUETOOTH;
bacpy(&self->trans.self.rfcomm.rc_bdaddr, src);
self->trans.self.rfcomm.rc_channel = channel;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /* _WIN32 */
}
@@ -106,9 +126,15 @@
return -1;
}
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm,
+ sizeof(struct sockaddr_rfcomm)))
+ {
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm,
sizeof(struct sockaddr_rc)))
{
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
DEBUG(0, "Error doing bind\n");
goto out_freesock;
}
@@ -140,7 +166,11 @@
int btobex_accept(obex_t *self)
{
#ifndef _WIN32
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ socklen_t addrlen = sizeof(struct sockaddr_rfcomm);
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
socklen_t addrlen = sizeof(struct sockaddr_rc);
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
//int mtu;
//int len = sizeof(int);
@@ -178,16 +208,26 @@
return -1;
}
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm,
+ sizeof(struct sockaddr_rfcomm));
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm,
sizeof(struct sockaddr_rc));
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
if (ret < 0) {
DEBUG(4, "ret=%d\n", ret);
goto out_freesock;
}
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm,
+ sizeof(struct sockaddr_rfcomm));
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm,
sizeof(struct sockaddr_rc));
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
if (ret < 0) {
DEBUG(4, "ret=%d\n", ret);
goto out_freesock;

View File

@ -1,11 +0,0 @@
--- lib/databuffer.h.orig Thu May 4 13:24:21 2006
+++ lib/databuffer.h Sat Nov 25 22:02:38 2006
@@ -31,7 +31,7 @@
#define DATABUFFER_H
#define __need_size_t
-#include <stddef.h>
+#include <sys/types.h>
#include <stdint.h>
/*

View File

@ -1,26 +0,0 @@
--- lib/obex.c.orig Thu May 25 20:09:41 2006
+++ lib/obex.c Sat Nov 25 22:04:07 2006
@@ -1031,7 +1031,11 @@
#ifdef HAVE_BLUETOOTH
if(src == NULL)
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ src = NG_HCI_BDADDR_ANY;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
src = BDADDR_ANY;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
btobex_prepare_listen(self, src, channel);
return obex_transport_listen(self);
#else
@@ -1061,7 +1065,11 @@
#ifdef HAVE_BLUETOOTH
if(src == NULL)
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ src = NG_HCI_BDADDR_ANY;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
src = BDADDR_ANY;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
btobex_prepare_connect(self, src, dst, channel);
return obex_transport_connect_request(self);
#else

View File

@ -1,26 +0,0 @@
--- lib/obex_main.c.orig Thu May 4 13:24:21 2006
+++ lib/obex_main.c Sat Nov 25 22:32:59 2006
@@ -46,7 +46,11 @@
#include <stdio.h>
#ifdef HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+#include <bluetooth.h>
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
#include <bluetooth/bluetooth.h>
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /*HAVE_BLUETOOTH*/
#endif /* _WIN32 */
@@ -80,7 +84,11 @@
#ifdef HAVE_BLUETOOTH
if (domain == AF_BLUETOOTH)
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ proto = BLUETOOTH_PROTO_RFCOMM;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
proto = BTPROTO_RFCOMM;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /*HAVE_BLUETOOTH*/
fd = socket(domain, SOCK_STREAM, proto);

View File

@ -1,27 +0,0 @@
--- lib/obex_transport.h.orig Thu May 4 13:24:21 2006
+++ lib/obex_transport.h Sat Nov 25 22:34:03 2006
@@ -40,8 +40,12 @@
#include "irda_wrap.h"
#endif /*HAVE_IRDA*/
#ifdef HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+#include <bluetooth.h>
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /*HAVE_BLUETOOTH*/
#ifdef HAVE_USB
#include "usbobex.h"
@@ -55,7 +59,11 @@
#endif /*HAVE_IRDA*/
struct sockaddr_in inet;
#ifdef HAVE_BLUETOOTH
+#ifdef HAVE_BLUETOOTH_NETGRAPH
+ struct sockaddr_rfcomm rfcomm;
+#else /*HAVE_BLUETOOTH_NETGRAPH*/
struct sockaddr_rc rfcomm;
+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
#endif /*HAVE_BLUETOOTH*/
#ifdef HAVE_USB
struct obex_usb_intf_transport_t usb;

View File

@ -1,42 +0,0 @@
--- ltmain.sh.orig Wed Oct 1 13:17:13 2003
+++ ltmain.sh Mon Mar 22 10:54:43 2004
@@ -1037,8 +1037,16 @@
continue
;;
+ -pthread)
+ compile_command="$compile_command -pthread"
+ finalize_command="$finalize_command -pthread"
+ compiler_flags="$compiler_flags -pthread"
+ continue
+ ;;
+
-module)
module=yes
+ build_old_libs=no
continue
;;
@@ -2408,6 +2416,9 @@
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
+ *-*-freebsd*)
+ # FreeBSD doesn't need this...
+ ;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
@@ -4175,10 +4186,12 @@
fi
# Install the pseudo-library for information purposes.
+ if /usr/bin/false; then
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
instname="$dir/$name"i
$show "$install_prog $instname $destdir/$name"
$run eval "$install_prog $instname $destdir/$name" || exit $?
+ fi
# Maybe install the static library, too.
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"

View File

@ -0,0 +1,65 @@
--- lib/usbobex.c 2008-11-07 14:36:09.000000000 +0200
+++ lib/usbobex.c 2008-11-19 02:47:39.000000000 +0200
@@ -392,25 +392,8 @@
DEBUG(4, "\n");
- self->trans.self.usb.dev_control = usb_open(self->trans.self.usb.device);
self->trans.self.usb.dev_data = usb_open(self->trans.self.usb.device);
- ret = usb_set_configuration(self->trans.self.usb.dev_control, self->trans.self.usb.configuration);
- if (ret < 0)
- DEBUG(4, "Can't set configuration %d", ret);
-
- ret = usb_claim_interface(self->trans.self.usb.dev_control, self->trans.self.usb.control_interface);
- if (ret < 0) {
- DEBUG(4, "Can't claim control interface %d", ret);
- goto err1;
- }
-
- ret = usb_set_altinterface(self->trans.self.usb.dev_control, self->trans.self.usb.control_setting);
- if (ret < 0) {
- DEBUG(4, "Can't set control setting %d", ret);
- goto err2;
- }
-
ret = usb_claim_interface(self->trans.self.usb.dev_data, self->trans.self.usb.data_interface);
if (ret < 0) {
DEBUG(4, "Can't claim data interface %d", ret);
@@ -430,10 +413,8 @@
err3:
usb_release_interface(self->trans.self.usb.dev_data, self->trans.self.usb.data_interface);
err2:
- usb_release_interface(self->trans.self.usb.dev_control, self->trans.self.usb.control_interface);
err1:
usb_close(self->trans.self.usb.dev_data);
- usb_close(self->trans.self.usb.dev_control);
return ret;
}
@@ -450,21 +431,19 @@
return 0;
DEBUG(4, "\n");
+
+ usb_clear_halt(self->trans.self.usb.dev_data, self->trans.self.usb.data_endpoint_read);
+ usb_clear_halt(self->trans.self.usb.dev_data, self->trans.self.usb.data_endpoint_write);
+
ret = usb_set_altinterface(self->trans.self.usb.dev_data, self->trans.self.usb.data_idle_setting);
if (ret < 0)
DEBUG(4, "Can't set data idle setting %d", ret);
ret = usb_release_interface(self->trans.self.usb.dev_data, self->trans.self.usb.data_interface);
if (ret < 0)
DEBUG(4, "Can't release data interface %d", ret);
- ret = usb_release_interface(self->trans.self.usb.dev_control, self->trans.self.usb.control_interface);
- if (ret < 0)
- DEBUG(4, "Can't release control interface %d", ret);
ret = usb_close(self->trans.self.usb.dev_data);
if (ret < 0)
DEBUG(4, "Can't close data interface %d", ret);
- ret = usb_close(self->trans.self.usb.dev_control);
- if (ret < 0)
- DEBUG(4, "Can't close control interface %d", ret);
return ret;
}

View File

@ -3,6 +3,6 @@ implementation of the Object Exchange (OBEX) protocol. OBEX is a
session protocol and can best be described as a binary HTTP protocol.
It's used mainly for Infrared and Bluetooth communication.
WWW: http://openobex.sourceforge.net/
WWW: http://www.bluez.org/openobex/
- Guido Falsi <mad@madpilot.net>

View File

@ -1,9 +1,8 @@
include/openobex/obex.h
include/openobex/obex_const.h
lib/libopenobex.so.4
lib/libopenobex.so.5
lib/libopenobex.a
lib/libopenobex.la
lib/libopenobex.so
libdata/pkgconfig/openobex.pc
share/aclocal/openobex.m4
@dirrm include/openobex