Skip to contentSkip to conversation

Palm Hotsync over Bluetooth

PATCH In review Bastien Nocera 2 participants 3 messages Sep 22, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Palm Hotsync over Bluetooth

Heya,

David, Florent, Paul, I've copied you on this mail as the pilot-sync-devel list seems to be down ATM. Bluez-devel people, I know a few have been interested in Hotsync'ing over Bluetooth for Palm devices.

This patch should apply to the current CVS HEAD of pilot-link. It adds configure checks for BlueZ (with the default being to turn on the Bluetooth support), and use the "bt:" port.

How-to use it:
1) Make sure your Palm and computer are paired
2) Select your computer as the Hotsync (Bluetooth->Setup devices->Hotsync, ignore the instructions on screen, and go through the wizard)
3) launch your favourite Palm conduit with the "bt:" port, such as:
pilot-xfer -p bt: -l
4) Enjoy

There are a few kludges though:
- Multiple HOTSYNC SDP records could get created, you can remove them by hand using sdptool.
- We need to wait for the rfcomm device to be created, and then handled by the hotplug scripts before we can use it. Marcel probably knows how to do this better than I do.

You can use bt:<Palm bdaddr> to only allow a specific Palm to connect to your conduit.

Comments welcome. Palm hackers, is "bluetooth:" being used, and if not, could we hijack it, and is the current code mergeable?

Cheers

---
Bastien Nocera <[email protected]>

Index: configure.ac
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/configure.ac,v retrieving revision 1.36

configure.ac +29 -0
diff -u -p -r1.36 configure.ac
@@ -335,6 +335,34 @@ AM_CONDITIONAL(WITH_FREEBSDUSB, test x$u
 AM_CONDITIONAL(WITH_DARWINUSB, test x$usb_type = xdarwin)
 AC_SUBST(usb_libs)
 
+dnl *******************************************
+dnl Test if building Bluetooth Support on Linux
+dnl *******************************************
+have_bluez=no
+use_bluez=no
+msg_bluez="no"
+
+PKG_CHECK_MODULES(BLUEZ, bluez, have_bluez=yes, have_bluez=no)
+
+AC_MSG_CHECKING([for BlueZ])
+AC_ARG_WITH(bluez,
+		AC_HELP_STRING([--with-bluez],
+			[Enable usage of BlueZ]),,
+		use_bluez=auto)
+if test "x$use_bluez" != "xno"; then
+	if test "x$have_bluez" = xno && test "x$use_bluez" = xyes; then
+		AC_MSG_ERROR([BlueZ explicitly requested but no support found])
+	fi
+	if test "x$have_bluez" = xyes; then
+		AC_DEFINE(HAVE_BLUEZ, 1, [Define if we have BlueZ support])
+		AC_MSG_RESULT([enabled])
+		msg_bluez="yes"
+	else
+		AC_MSG_RESULT([not found])
+	fi
+fi
+
+AM_CONDITIONAL(WITH_BLUEZ, test x$have_bluez = "xyes")
 
 dnl *********************************
 dnl Check for popt (use internal if needed)
@@ -810,6 +838,7 @@ AC_MSG_RESULT([
   Build for host.......... : $host
   Extra Warnings.......... : $set_compile_warnings
   Direct USB support...... : $msg_usb
+  BlueZ support........... : $msg_bluez
   Thread-safe libpisock... : $msg_threads
   ElectricFence checks.... : $msg_efence
   CPPFLAGS................ : $CPPFLAGS

Index: include/Makefile.am
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/include/Makefile.am,v retrieving revision 1.24

Makefile.am +1 -0
diff -u -p -r1.24 Makefile.am
@@ -2,6 +2,7 @@ c_headers = 			\
 	pi-address.h		\
 	pi-appinfo.h		\
 	pi-args.h		\
+	pi-bluetooth.h		\
 	pi-buffer.h		\
 	pi-cmp.h		\
 	pi-contact.h		\

Index: libpisock/Makefile.am
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/libpisock/Makefile.am,v retrieving revision 1.25

Makefile.am +10 -3
diff -u -p -r1.25 Makefile.am
@@ -13,6 +13,8 @@ usb_FILES = 		\
 	freebsdusb.c	\
 	darwinusb.c
 
+bluez_FILES = bluetooth.c
+
 if WITH_LIBUSB
 usb_SOURCE = usb.c libusb.c
 endif
@@ -28,11 +30,16 @@ if WITH_DARWINUSB
 usb_SOURCE = usb.c darwinusb.c
 endif
 
+if WITH_BLUEZ
+bluez_SOURCE = bluetooth.c
+endif
+
 lib_LTLIBRARIES = libpisock.la
 
 libpisock_la_SOURCES =  \
 	$(serial_SOURCE)\
 	$(usb_SOURCE)	\
+	$(bluez_SOURCE)	\
 	address.c	\
 	appinfo.c	\
 	connect.c	\
@@ -68,10 +75,10 @@ libpisock_la_SOURCES =  \
 
 # Including PTHREAD_CFLAGS here is a dirty ugly kluge.  It works.
 libpisock_la_LIBADD = \
-	@usb_libs@ @PTHREAD_LIBS@ @PTHREAD_CFLAGS@
+	@usb_libs@ @PTHREAD_LIBS@ @PTHREAD_CFLAGS@ $(BLUEZ_LIBS)
 
 libpisock_la_LDFLAGS = \
 	-export-dynamic -version-info $(PISOCK_CURRENT):$(PISOCK_REVISION):$(PISOCK_AGE)
-libpisock_la_CFLAGS = $(PIC_LIBS) @PTHREAD_CFLAGS@
+libpisock_la_CFLAGS = $(PIC_LIBS) $(BLUEZ_CFLAGS) @PTHREAD_CFLAGS@
 
-EXTRA_DIST = $(serial_FILES) $(usb_FILES)
+EXTRA_DIST = $(serial_FILES) $(usb_FILES) $(bluez_FILES)

Index: libpisock/socket.c
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/libpisock/socket.c,v retrieving revision 1.104

socket.c +6 -0
diff -u -p -r1.104 socket.c
@@ -44,6 +44,9 @@
 #ifdef HAVE_USB
 #include "pi-usb.h"
 #endif
+#ifdef HAVE_BLUEZ
+#include "pi-bluetooth.h"
+#endif
 #include "pi-inet.h"
 #include "pi-slp.h"
 #include "pi-sys.h"
@@ -1014,6 +1017,9 @@ pi_devsocket(int pi_sd, const char *port
 	} else if (!strncmp (port, "net:", 4)) {
 		strncpy(addr->pi_device, port + 4, sizeof(addr->pi_device));
 		ps->device = pi_inet_device (PI_NET_DEV);
+	} else if (!strncmp (port, "bt:", 3)) {
+		strncpy(addr->pi_device, port + 3, sizeof(addr->pi_device));
+		ps->device = pi_bluetooth_device (PI_BLUETOOTH_DEV);
 	} else if (!strncmp (port, "bluetooth:", 10)) {
 	    /* warning: this code is not well tested */
 		strncpy(addr->pi_device, port + 10, sizeof(addr->pi_device));
pi-bluetooth.h new file +69 -0

69 lines not on this page · raw message

bluetooth.c new file +919 -0

919 lines not on this page · raw message

maintainer
#1 lore raw

Hi Bastien,

Quoted 17 lines

David, Florent, Paul, I've copied you on this mail as the pilot-sync-devel list seems to be down ATM. Bluez-devel people, I know a few have been interested in Hotsync'ing over Bluetooth for Palm devices.

This patch should apply to the current CVS HEAD of pilot-link. It adds configure checks for BlueZ (with the default being to turn on the Bluetooth support), and use the "bt:" port.

How-to use it:
1) Make sure your Palm and computer are paired
2) Select your computer as the Hotsync (Bluetooth->Setup devices->Hotsync, ignore the instructions on screen, and go through the wizard)
3) launch your favourite Palm conduit with the "bt:" port, such as:
pilot-xfer -p bt: -l
4) Enjoy

Quoted 3 lines

There are a few kludges though:
- Multiple HOTSYNC SDP records could get created, you can remove them by hand using sdptool.

look at the pand daemon and see how they handle the SDP records. There is no need to make them persistent. If the application dies, the records are automatically removed by sdpd.

Quoted 3 lines

- We need to wait for the rfcomm device to be created, and then handled by the hotplug scripts before we can use it. Marcel probably knows how to do this better than I do.

Don't create a TTY device. You can use the RFCOMM socket directly.

Quoted 5 lines

You can use bt:<Palm bdaddr> to only allow a specific Palm to connect to your conduit.

Comments welcome. Palm hackers, is "bluetooth:" being used, and if not, could we hijack it, and is the current code mergeable?

Someone has to send me a Palm device with Bluetooth, so I can do more testing.

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi Marcel,

Quoted 19 lines · Marcel Holtmann

Hi Bastien,

Quoted 17 lines

David, Florent, Paul, I've copied you on this mail as the pilot-sync-devel list seems to be down ATM. Bluez-devel people, I know a few have been interested in Hotsync'ing over Bluetooth for Palm devices.

This patch should apply to the current CVS HEAD of pilot-link. It adds configure checks for BlueZ (with the default being to turn on the Bluetooth support), and use the "bt:" port.

How-to use it:
1) Make sure your Palm and computer are paired
2) Select your computer as the Hotsync (Bluetooth->Setup devices->Hotsync, ignore the instructions on screen, and go through the wizard)
3) launch your favourite Palm conduit with the "bt:" port, such as:
pilot-xfer -p bt: -l
4) Enjoy

Quoted 7 lines
Quoted 3 lines

There are a few kludges though:
- Multiple HOTSYNC SDP records could get created, you can remove them by hand using sdptool.

look at the pand daemon and see how they handle the SDP records. There is no need to make them persistent. If the application dies, the records are automatically removed by sdpd.

Ha! I fixed the gnome-bluetooth OBEX code to keep the session opened as well.

Quoted 5 lines
Quoted 3 lines

- We need to wait for the rfcomm device to be created, and then handled by the hotplug scripts before we can use it. Marcel probably knows how to do this better than I do.

Don't create a TTY device. You can use the RFCOMM socket directly.

And that removes wads of code as well, much cleaner. Thanks.

Quoted 8 lines
Quoted 5 lines

You can use bt:<Palm bdaddr> to only allow a specific Palm to connect to your conduit.

Comments welcome. Palm hackers, is "bluetooth:" being used, and if not, could we hijack it, and is the current code mergeable?

Someone has to send me a Palm device with Bluetooth, so I can do more testing.

Do you have a Palm? A Bluetooth SDIO card for a Palm is considerably cheaper than a brand new Palm...

Thanks for the advices, I've attached the new patch below.

Cheers

---
Bastien Nocera <[email protected]>

Index: configure.ac
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/configure.ac,v retrieving revision 1.36

configure.ac +29 -0
diff -u -p -r1.36 configure.ac
@@ -335,6 +335,34 @@ AM_CONDITIONAL(WITH_FREEBSDUSB, test x$u
 AM_CONDITIONAL(WITH_DARWINUSB, test x$usb_type = xdarwin)
 AC_SUBST(usb_libs)
 
+dnl *******************************************
+dnl Test if building Bluetooth Support on Linux
+dnl *******************************************
+have_bluez=no
+use_bluez=no
+msg_bluez="no"
+
+PKG_CHECK_MODULES(BLUEZ, bluez, have_bluez=yes, have_bluez=no)
+
+AC_MSG_CHECKING([for BlueZ])
+AC_ARG_WITH(bluez,
+		AC_HELP_STRING([--with-bluez],
+			[Enable usage of BlueZ]),,
+		use_bluez=auto)
+if test "x$use_bluez" != "xno"; then
+	if test "x$have_bluez" = xno && test "x$use_bluez" = xyes; then
+		AC_MSG_ERROR([BlueZ explicitly requested but no support found])
+	fi
+	if test "x$have_bluez" = xyes; then
+		AC_DEFINE(HAVE_BLUEZ, 1, [Define if we have BlueZ support])
+		AC_MSG_RESULT([enabled])
+		msg_bluez="yes"
+	else
+		AC_MSG_RESULT([not found])
+	fi
+fi
+
+AM_CONDITIONAL(WITH_BLUEZ, test x$have_bluez = "xyes")
 
 dnl *********************************
 dnl Check for popt (use internal if needed)
@@ -810,6 +838,7 @@ AC_MSG_RESULT([
   Build for host.......... : $host
   Extra Warnings.......... : $set_compile_warnings
   Direct USB support...... : $msg_usb
+  BlueZ support........... : $msg_bluez
   Thread-safe libpisock... : $msg_threads
   ElectricFence checks.... : $msg_efence
   CPPFLAGS................ : $CPPFLAGS

Index: include/Makefile.am
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/include/Makefile.am,v retrieving revision 1.24

Makefile.am +1 -0
diff -u -p -r1.24 Makefile.am
@@ -2,6 +2,7 @@ c_headers = 			\
 	pi-address.h		\
 	pi-appinfo.h		\
 	pi-args.h		\
+	pi-bluetooth.h		\
 	pi-buffer.h		\
 	pi-cmp.h		\
 	pi-contact.h		\

Index: libpisock/Makefile.am
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/libpisock/Makefile.am,v retrieving revision 1.25

Makefile.am +10 -3
diff -u -p -r1.25 Makefile.am
@@ -13,6 +13,8 @@ usb_FILES = 		\
 	freebsdusb.c	\
 	darwinusb.c
 
+bluez_FILES = bluetooth.c
+
 if WITH_LIBUSB
 usb_SOURCE = usb.c libusb.c
 endif
@@ -28,11 +30,16 @@ if WITH_DARWINUSB
 usb_SOURCE = usb.c darwinusb.c
 endif
 
+if WITH_BLUEZ
+bluez_SOURCE = bluetooth.c
+endif
+
 lib_LTLIBRARIES = libpisock.la
 
 libpisock_la_SOURCES =  \
 	$(serial_SOURCE)\
 	$(usb_SOURCE)	\
+	$(bluez_SOURCE)	\
 	address.c	\
 	appinfo.c	\
 	connect.c	\
@@ -68,10 +75,10 @@ libpisock_la_SOURCES =  \
 
 # Including PTHREAD_CFLAGS here is a dirty ugly kluge.  It works.
 libpisock_la_LIBADD = \
-	@usb_libs@ @PTHREAD_LIBS@ @PTHREAD_CFLAGS@
+	@usb_libs@ @PTHREAD_LIBS@ @PTHREAD_CFLAGS@ $(BLUEZ_LIBS)
 
 libpisock_la_LDFLAGS = \
 	-export-dynamic -version-info $(PISOCK_CURRENT):$(PISOCK_REVISION):$(PISOCK_AGE)
-libpisock_la_CFLAGS = $(PIC_LIBS) @PTHREAD_CFLAGS@
+libpisock_la_CFLAGS = $(PIC_LIBS) $(BLUEZ_CFLAGS) @PTHREAD_CFLAGS@
 
-EXTRA_DIST = $(serial_FILES) $(usb_FILES)
+EXTRA_DIST = $(serial_FILES) $(usb_FILES) $(bluez_FILES)

Index: libpisock/socket.c
===================================================================
RCS file: /cvs/pilot-link/pilot-link_src/libpisock/socket.c,v retrieving revision 1.104

socket.c +6 -0
diff -u -p -r1.104 socket.c
@@ -44,6 +44,9 @@
 #ifdef HAVE_USB
 #include "pi-usb.h"
 #endif
+#ifdef HAVE_BLUEZ
+#include "pi-bluetooth.h"
+#endif
 #include "pi-inet.h"
 #include "pi-slp.h"
 #include "pi-sys.h"
@@ -1014,6 +1017,9 @@ pi_devsocket(int pi_sd, const char *port
 	} else if (!strncmp (port, "net:", 4)) {
 		strncpy(addr->pi_device, port + 4, sizeof(addr->pi_device));
 		ps->device = pi_inet_device (PI_NET_DEV);
+	} else if (!strncmp (port, "bt:", 3)) {
+		strncpy(addr->pi_device, port + 3, sizeof(addr->pi_device));
+		ps->device = pi_bluetooth_device (PI_BLUETOOTH_DEV);
 	} else if (!strncmp (port, "bluetooth:", 10)) {
 	    /* warning: this code is not well tested */
 		strncpy(addr->pi_device, port + 10, sizeof(addr->pi_device));
pi-bluetooth.h new file +70 -0

70 lines not on this page · raw message

bluetooth.c new file +856 -0

856 lines not on this page · raw message