Hi,
I have set up development tools on OS X because that's my primary machine
now, and made some fixes to openobex so that it compiles and runs there.
Note that Apple's bluetooth API is completely different from bluez, so
that won't work but at least USB interfaces work fine. The fixes are:
- applications need to be linked against Apple's framework if USB support
is enabled
- libtoolize is called glibtoolize on OS X
- TCSBRKP isn't defined anywhere, so I adopted this patch for a fix:
http://sourceforge.net/tracker/index.php?func=detail&aid=1038132&group_id=8960&atid=308960
- in ircp malloc.h is used, but ANSI C specifies stdlib.h instead
- setting USB configuration always returns an error both on latest Linux
kernels and on OS X, so it's attempted but not considered a fatal failure
from now on.
Alexander
Homepage: http://www.sensi.org/~ak/
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/openobex/openobex/acinclude.m4,v
retrieving revision 1.7
diff -u -r1.7 acinclude.m4
--- acinclude.m4 3 Jan 2006 10:46:36 -0000 1.7
+++ acinclude.m4 14 Jan 2006 13:32:39 -0000
@@ -123,6 +123,12 @@
AC_CHECK_LIB(usb, usb_get_busses, dummy=yes,
AC_DEFINE(NEED_USB_GET_BUSSES, 1, [Define to 1 if you need the usb_get_busses()
function.]))
AC_CHECK_LIB(usb, usb_interrupt_read, dummy=yes,
AC_DEFINE(NEED_USB_INTERRUPT_READ, 1, [Define to 1 if you need the
usb_interrupt_read() function.]))
+ case "${host_cpu}-${host_os}" in
+ *-darwin*)
+ USB_LIBS="$USB_LIBS -framework CoreFoundation
-framework IOKit"
+ ;;
+ esac
+
CPPFLAGS=$ac_save_CPPFLAGS
LDFLAGS=$ac_save_LDFLAGS
Index: bootstrap
===================================================================
RCS file: /cvsroot/openobex/openobex/bootstrap,v
retrieving revision 1.1
diff -u -r1.1 bootstrap
--- bootstrap 25 Dec 2005 01:36:22 -0000 1.1
+++ bootstrap 14 Jan 2006 13:32:39 -0000
@@ -2,6 +2,7 @@
aclocal && \
autoheader && \
- libtoolize --copy --force && \
+ libtoolize --copy --force || \
+ glibtoolize --copy --force && \
automake --add-missing --copy && \
autoconf
Index: apps/obex_test_cable.c
===================================================================
RCS file: /cvsroot/openobex/openobex/apps/obex_test_cable.c,v
retrieving revision 1.20
diff -u -r1.20 obex_test_cable.c
--- apps/obex_test_cable.c 3 Jan 2006 18:36:15 -0000 1.20
+++ apps/obex_test_cable.c 14 Jan 2006 13:32:40 -0000
@@ -224,7 +224,13 @@
{
if(force) {
// Send a break to get out of OBEX-mode
- if(ioctl(gt->ttyfd, TCSBRKP, 0) < 0) {
+#ifdef TCSBRKP
+ if(ioctl(gt->ttyfd, TCSBRKP, 0) < 0) {
+#elif defined(TCSBRK)
+ if(ioctl(gt->ttyfd, TCSBRK, 0) < 0) {
+#else
+ if(tcsendbreak(gt->ttyfd, 0) < 0) {
+#endif /* TCSBRKP */
printf("Unable to send break!\n");
}
}
Index: ircp/ircp_client.c
===================================================================
RCS file: /cvsroot/openobex/openobex/ircp/ircp_client.c,v
retrieving revision 1.10
diff -u -r1.10 ircp_client.c
--- ircp/ircp_client.c 3 Jan 2006 18:36:15 -0000 1.10
+++ ircp/ircp_client.c 14 Jan 2006 13:32:41 -0000
@@ -4,7 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <malloc.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
Index: ircp/ircp_io.c
===================================================================
RCS file: /cvsroot/openobex/openobex/ircp/ircp_io.c,v
retrieving revision 1.13
diff -u -r1.13 ircp_io.c
--- ircp/ircp_io.c 3 Jan 2006 18:36:15 -0000 1.13
+++ ircp/ircp_io.c 14 Jan 2006 13:32:41 -0000
@@ -3,7 +3,7 @@
#endif
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
Index: ircp/ircp_server.c
===================================================================
RCS file: /cvsroot/openobex/openobex/ircp/ircp_server.c,v
retrieving revision 1.17
diff -u -r1.17 ircp_server.c
--- ircp/ircp_server.c 3 Jan 2006 18:36:15 -0000 1.17
+++ ircp/ircp_server.c 14 Jan 2006 13:32:41 -0000
@@ -3,7 +3,7 @@
#endif
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Index: lib/usbobex.c
===================================================================
RCS file: /cvsroot/openobex/openobex/lib/usbobex.c,v
retrieving revision 1.4
diff -u -r1.4 usbobex.c
--- lib/usbobex.c 3 Jan 2006 18:36:15 -0000 1.4
+++ lib/usbobex.c 14 Jan 2006 13:32:41 -0000
@@ -335,9 +335,8 @@
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) && (ret != -EBUSY)) {
+ if (ret < 0) {
DEBUG(4, "Can't set configuration %d", ret);
- goto err1;
}
ret = usb_claim_interface(self->trans.self.usb.dev_control,
self->trans.self.usb.control_interface);