Changeset 158
- Timestamp:
- 06/05/07 01:19:46 (18 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
acinclude.m4 (modified) (2 diffs)
-
apps/obexftpd.c (modified) (2 diffs)
-
configure.in (modified) (1 diff)
-
obexftp/client.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/acinclude.m4
r153 r158 41 41 dnl 42 42 43 AC_DEFUN([AC_PATH_WINBT], [ 44 AC_CACHE_VAL(winbt_found,[ 45 AC_CHECK_HEADERS(ws2bth.h, winbt_found=yes, winbt_found=no, [ 46 #include <winsock2.h> 47 ]) 48 ]) 49 AC_MSG_CHECKING([for Windows Bluetooth support]) 50 AC_MSG_RESULT([$winbt_found]) 51 ]) 52 53 AC_DEFUN([AC_PATH_NETBSDBT], [ 54 AC_CACHE_CHECK([for NetBSD Bluetooth support], netbsdbt_found, [ 55 AC_TRY_COMPILE([ 56 #include <bluetooth.h> 57 ], [ 58 struct sockaddr_bt *bt; 59 ], netbsdbt_found=yes, netbsdbt_found=no) 60 ]) 61 ]) 62 63 AC_DEFUN([AC_PATH_FREEBSDBT], [ 64 AC_CACHE_CHECK([for FreeBSD Bluetooth support], freebsdbt_found, [ 65 AC_TRY_COMPILE([ 66 #include <bluetooth.h> 67 ], [ 68 struct sockaddr_rfcomm *rfcomm; 69 ], freebsdbt_found=yes, freebsdbt_found=no) 70 ]) 71 ]) 72 73 AC_DEFUN([AC_PATH_BLUEZ], [ 74 PKG_CHECK_MODULES(BLUETOOTH, bluez, bluez_found=yes, AC_MSG_RESULT(no)) 75 ]) 76 77 AC_DEFUN([AC_PATH_BLUETOOTH], [ 78 case $host in 79 *-*-linux*) 80 AC_PATH_BLUEZ 81 ;; 82 *-*-freebsd*) 83 AC_PATH_FREEBSDBT 84 ;; 85 *-*-netbsd*) 86 AC_PATH_NETBSDBT 87 ;; 88 *-*-mingw32*) 89 AC_PATH_WINBT 90 ;; 91 esac 92 AC_SUBST(BLUETOOTH_CFLAGS) 93 AC_SUBST(BLUETOOTH_LIBS) 94 ]) 95 43 96 AC_DEFUN([BLUETOOTH_CHECK],[ 44 97 AC_ARG_ENABLE([bluetooth], … … 48 101 49 102 if test "$ac_bluetooth_enabled" = yes; then 50 AC_CACHE_CHECK([for Bluetooth support], am_cv_bluetooth_found,[ 51 52 AC_TRY_COMPILE([ 53 #ifdef __FreeBSD__ 54 #include <sys/types.h> 55 #include <bluetooth.h> 56 #else /* Linux */ 57 #include <sys/socket.h> 58 #include <bluetooth/bluetooth.h> 59 #include <bluetooth/rfcomm.h> 60 #endif 61 ],[ 62 #ifdef __FreeBSD__ 63 bdaddr_t bdaddr; 64 struct sockaddr_rfcomm addr; 65 #else /* Linux */ 66 bdaddr_t bdaddr; 67 struct sockaddr_rc addr; 68 #endif 69 ], 70 am_cv_bluetooth_found=yes, 71 am_cv_bluetooth_found=no)]) 72 if test $am_cv_bluetooth_found = yes; then 103 AC_PATH_BLUETOOTH 104 if test "${netbsdbt_found}" = "yes" -o "${freebsdbt_found}" = "yes" -o "${bluez_found}" = "yes" -o "${winbt_found}" = "yes"; then 73 105 AC_DEFINE([HAVE_BLUETOOTH], [1], [Define if system supports Bluetooth and it's enabled]) 74 BLUETOOTH_CFLAGS=""75 BLUETOOTH_LIBS="-lbluetooth"76 106 fi 77 AC_SUBST(BLUETOOTH_CFLAGS)78 AC_SUBST(BLUETOOTH_LIBS)79 107 fi 80 108 ]) -
trunk/apps/obexftpd.c
r154 r158 26 26 */ 27 27 28 #ifdef HAVE_CONFIG_H 29 #include <config.h> 30 #endif 31 28 32 #define _GNU_SOURCE 29 33 #include <stdio.h> … … 40 44 #ifdef _WIN32 41 45 #include <winsock2.h> 46 #ifdef HAVE_BLUETOOTH 47 #include <ws2bth.h> 48 #define bdaddr_t BTH_ADDR 49 #define BDADDR_ANY BTH_ADDR_NULL 50 #endif 42 51 #define S_IRGRP 0 43 52 #define S_IROTH 0 -
trunk/configure.in
r155 r158 33 33 dnl IRDA_CHECK 34 34 BLUETOOTH_CHECK 35 if test $am_cv_bluetooth_found = yes; then35 if test "${bluez_found}" = "yes"; then 36 36 SDPLIB_CHECK 37 37 fi -
trunk/obexftp/client.c
r156 r158 51 51 52 52 #ifdef HAVE_BLUETOOTH 53 #ifdef _WIN32 54 #include <ws2bth.h> 55 #define bdaddr_t BTH_ADDR 56 #define BDADDR_ANY BTH_ADDR_NULL 57 #define bacpy(dst,src) memcpy((dst),(src),sizeof(BTH_ADDR)) 58 #else /* _WIN32 */ 59 53 60 #ifdef __FreeBSD__ 54 61 #include <sys/types.h> … … 60 67 #include <bluetooth/hci_lib.h> 61 68 #endif /* __FreeBSD__ */ 62 #endif 69 70 #endif /* _WIN32 */ 71 #endif /* HAVE_BLUETOOTH */ 63 72 64 73 #include <openobex/obex.h> … … 81 90 } __attribute__((packed)) apparam_t; 82 91 92 #ifdef _WIN32 93 #ifdef HAVE_BLUETOOTH 94 static int str2ba(const char *straddr, BTH_ADDR *btaddr) 95 { 96 int i; 97 unsigned int aaddr[6]; 98 BTH_ADDR tmpaddr = 0; 99 100 if (sscanf(straddr, "%02x:%02x:%02x:%02x:%02x:%02x", 101 &aaddr[0], &aaddr[1], &aaddr[2], &aaddr[3], &aaddr[4], &aaddr[5]) != 6) 102 return 1; 103 *btaddr = 0; 104 for (i = 0; i < 6; i++) { 105 tmpaddr = (BTH_ADDR) (aaddr[i] & 0xff); 106 *btaddr = ((*btaddr) << 8) + tmpaddr; 107 } 108 return 0; 109 } 110 #endif 111 #endif 83 112 84 113 static void dummy_info_cb(int UNUSED(event), const char *UNUSED(msg), int UNUSED(len), void *UNUSED(data)) … … 555 584 peer.sin_family = AF_INET; 556 585 peer.sin_port = htons(port); /* overridden with OBEX_PORT 650 anyhow */ 557 ret = OBEX_TransportConnect(cli->obexhandle, (struct sockaddr *) &peer,586 ret = InOBEX_TransportConnect(cli->obexhandle, (struct sockaddr *) &peer, 558 587 sizeof(struct sockaddr_in)); 559 588 DEBUG(3, "%s() TCP %d\n", __func__, ret); … … 581 610 str2ba(src, &src_addr); 582 611 hci_id = atoi(src); 612 #ifndef _WIN32 583 613 if (hci_id > 0) { 584 614 hci_devba(hci_id, &src_addr); 585 615 } 616 #endif 586 617 } 587 618 if (!device) {
