From: Iain H. <pl...@ne...> - 2011-06-21 09:05:43
|
The following 7 patches then, are build fixes for NetBSD and FreeBSD in advance of 2.0 release. |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:09
|
--- lib/bluez_compat.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/bluez_compat.h b/lib/bluez_compat.h index b0b97d6..3f36cd7 100644 --- a/lib/bluez_compat.h +++ b/lib/bluez_compat.h @@ -66,6 +66,7 @@ extern bdaddr_t bluez_compat_bdaddr_any; #define rc_channel bt_channel #define bacpy(dst,src) memcpy((dst),(src),sizeof(bdaddr_t)) #define bacmp(a,b) memcmp((a),(b),sizeof(bdaddr_t)) +#define str2ba(str, ba) (bt_aton((str), (ba)) == 1 ? 0 : -1) #else #define bdaddr_t unsigned long -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:10
|
--- apps/obex_tcp.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/apps/obex_tcp.c b/apps/obex_tcp.c index 7fca284..17204fa 100644 --- a/apps/obex_tcp.c +++ b/apps/obex_tcp.c @@ -61,7 +61,9 @@ static int get_peer_addr(char *name, struct sockaddr_storage *peer) .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, .ai_protocol = 0, +#if defined(AI_ADDRCONFIG) .ai_flags = AI_ADDRCONFIG +#endif }; struct addrinfo *info; -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:10
|
getaddrinfo() was first released in Issue 6 of XNS, but was derived from the Issue 5.2 specification. http://pubs.opengroup.org/onlinepubs/009695399/functions/getaddrinfo.html --- apps/obex_tcp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/apps/obex_tcp.c b/apps/obex_tcp.c index 17204fa..a9036ff 100644 --- a/apps/obex_tcp.c +++ b/apps/obex_tcp.c @@ -22,7 +22,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 520 #ifdef _WIN32 #include <winsock2.h> -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:10
|
--- CMakeModules/FindBluetooth.cmake | 16 ++++++++++++++++ acinclude.m4 | 2 ++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/CMakeModules/FindBluetooth.cmake b/CMakeModules/FindBluetooth.cmake index 4c36282..b2dd2e1 100644 --- a/CMakeModules/FindBluetooth.cmake +++ b/CMakeModules/FindBluetooth.cmake @@ -64,6 +64,14 @@ elseif ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" ) ) mark_as_advanced ( Bluetooth_INCLUDE_DIRS ) + find_library ( Bluetooth_LIBRARIES + NAMES + bluetooth + PATH_SUFFIXES + lib + ) + mark_as_advanced ( Bluetooth_LIBRARIES ) + if ( Bluetooth_INCLUDE_DIRS ) set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INLUDE_DIRS} ) CHECK_C_SOURCE_COMPILES ( @@ -85,6 +93,14 @@ elseif ( CMAKE_SYSTEM_NAME STREQUAL "NetBSD" ) ) mark_as_advanced ( Bluetooth_INCLUDE_DIRS ) + find_library ( Bluetooth_LIBRARIES + NAMES + bluetooth + PATH_SUFFIXES + lib + ) + mark_as_advanced ( Bluetooth_LIBRARIES ) + if ( Bluetooth_INCLUDE_DIRS ) set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INLUDE_DIRS} ) CHECK_C_SOURCE_COMPILES ( diff --git a/acinclude.m4 b/acinclude.m4 index 7b67007..3da248a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -309,10 +309,12 @@ AC_DEFUN([AC_ARG_OPENOBEX], [ if (test "${netbsdbt_cv_found}" = "yes"); then AC_DEFINE(HAVE_BLUETOOTH_NETBSD, 1, [Define if system supports Bluetooth stack for NetBSD]) + BLUETOOTH_LIBS="-lbluetooth" fi if (test "${freebsdbt_cv_found}" = "yes"); then AC_DEFINE(HAVE_BLUETOOTH_FREEBSD, 1, [Define if system supports Bluetooth stack for FreeBSD]) + BLUETOOTH_LIBS="-lbluetooth" fi if (test "${bluez_found}" = "yes"); then -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:19
|
--- CMakeModules/FindBluetooth.cmake | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeModules/FindBluetooth.cmake b/CMakeModules/FindBluetooth.cmake index b2dd2e1..11a93cf 100644 --- a/CMakeModules/FindBluetooth.cmake +++ b/CMakeModules/FindBluetooth.cmake @@ -73,7 +73,7 @@ elseif ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" ) mark_as_advanced ( Bluetooth_LIBRARIES ) if ( Bluetooth_INCLUDE_DIRS ) - set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INLUDE_DIRS} ) + set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INCLUDE_DIRS} ) CHECK_C_SOURCE_COMPILES ( "#include <bluetooth.h> int main () { @@ -102,7 +102,7 @@ elseif ( CMAKE_SYSTEM_NAME STREQUAL "NetBSD" ) mark_as_advanced ( Bluetooth_LIBRARIES ) if ( Bluetooth_INCLUDE_DIRS ) - set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INLUDE_DIRS} ) + set ( CMAKE_REQUIRED_INCLUDES ${Bluetooth_INCLUDE_DIRS} ) CHECK_C_SOURCE_COMPILES ( "#include <bluetooth.h> int main () { -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:19
|
--- lib/CMakeLists.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 0110db4..6efa6d0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -106,7 +106,7 @@ if ( OPENOBEX_USB ) list ( APPEND openobex_LIBRARIES ${LibUSB_LIBRARIES} ) - include_directories ( BEFORE SYSTEM ${LibUSB_INCLUDE_DIRS} ) + include_directories ( SYSTEM ${LibUSB_INCLUDE_DIRS} ) if ( LibUSB_VERSION_1.0 ) list ( APPEND SOURCES usb1obex.c -- 1.7.4.1 |
From: Iain H. <pl...@ne...> - 2011-06-21 08:58:21
|
we only need to detect the presence of "Bluetooth Device Address" type in order to provide the function prototype, which needs to be from a header included prior to <openobex/obex.h> while here constify arguments --- include/openobex/obex.h | 25 ++++++++++++++++--------- lib/obex.c | 6 +++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/openobex/obex.h b/include/openobex/obex.h index f948113..6dda861 100644 --- a/include/openobex/obex.h +++ b/include/openobex/obex.h @@ -131,18 +131,25 @@ OPENOBEX_SYMBOL(int) IrOBEX_TransportConnect(obex_t *self, const char *service); * Bluetooth OBEX API */ #if !defined(bt_addr_t) -# if defined(SOL_RFCOMM) -# if defined(_WIN32) /* Windows */ -# define bt_addr_t BTH_ADDR -# else /* Linux, FreeBSD, NetBSD */ -# define bt_addr_t bdaddr_t +# if defined(_WIN32) +# if defined(BTH_ADDR_NULL) +# define bt_addr_t BTH_ADDR +# endif +# elif defined(__FreeBSD__) +# if defined(NG_HCI_BDADDR_ANY) +# define bt_addr_t bdaddr_t +# endif +# else /* Linux, NetBSD, etc.. */ +# if defined(BDADDR_ANY) +# define bt_addr_t bdaddr_t # endif -# else /* no bluetooth stack available */ -# define bt_addr_t unsigned long # endif #endif -OPENOBEX_SYMBOL(int) BtOBEX_ServerRegister(obex_t *self, bt_addr_t *src, uint8_t channel); -OPENOBEX_SYMBOL(int) BtOBEX_TransportConnect(obex_t *self, bt_addr_t *src, bt_addr_t *dst, uint8_t channel); + +#if defined(bt_addr_t) +OPENOBEX_SYMBOL(int) BtOBEX_ServerRegister(obex_t *self, const bt_addr_t *src, uint8_t channel); +OPENOBEX_SYMBOL(int) BtOBEX_TransportConnect(obex_t *self, const bt_addr_t *src, const bt_addr_t *dst, uint8_t channel); +#endif /* * OBEX File API diff --git a/lib/obex.c b/lib/obex.c index 165fcb8..874cfcd 100644 --- a/lib/obex.c +++ b/lib/obex.c @@ -1058,7 +1058,7 @@ int CALLAPI IrOBEX_TransportConnect(obex_t *self, const char *service) An easier server function to use for Bluetooth (Bluetooth OBEX) only. */ LIB_SYMBOL -int CALLAPI BtOBEX_ServerRegister(obex_t *self, bdaddr_t *src, uint8_t channel) +int CALLAPI BtOBEX_ServerRegister(obex_t *self, const bt_addr_t *src, uint8_t channel) { DEBUG(3, "\n"); @@ -1085,8 +1085,8 @@ int CALLAPI BtOBEX_ServerRegister(obex_t *self, bdaddr_t *src, uint8_t channel) An easier connect function to use for Bluetooth (Bluetooth OBEX) only. */ LIB_SYMBOL -int CALLAPI BtOBEX_TransportConnect(obex_t *self, bdaddr_t *src, - bdaddr_t *dst, uint8_t channel) +int CALLAPI BtOBEX_TransportConnect(obex_t *self, const bt_addr_t *src, + const bt_addr_t *dst, uint8_t channel) { DEBUG(4, "\n"); -- 1.7.4.1 |
From: Hendrik S. <po...@he...> - 2011-06-28 11:50:33
|
Zitat von Iain Hibbert <pl...@ne...>: > The following 7 patches then, are build fixes for NetBSD and > FreeBSD in advance of 2.0 release. @Johan: can you apply this patchset? HS |
From: Johan H. <joh...@gm...> - 2011-06-28 12:56:15
|
Hi Iain, On Tue, Jun 21, 2011, Iain Hibbert wrote: > we only need to detect the presence of "Bluetooth Device Address" type > in order to provide the function prototype, which needs to be from a header > included prior to <openobex/obex.h> > > while here constify arguments > --- > include/openobex/obex.h | 25 ++++++++++++++++--------- > lib/obex.c | 6 +++--- > 2 files changed, 19 insertions(+), 12 deletions(-) I've applied patches 1-4 but had to stop at this one. Firstly, this should really be split into two separate ones (the way you've formatted the commit message already gives hints about it). Secondly, only recently Marcel objected to a patch which would break the API (the one about packet based transports). Doesn't adding const declarations have a similar implication? Btw, please start your summary lines and sentences with capital letters. I had to fix that manually in patches 1-4. Johan |
From: Iain H. <pl...@ry...> - 2011-06-29 11:03:17
|
On Tue, 28 Jun 2011, Johan Hedberg wrote: > Hi Iain, > > On Tue, Jun 21, 2011, Iain Hibbert wrote: > > we only need to detect the presence of "Bluetooth Device Address" type > > in order to provide the function prototype, which needs to be from a header > > included prior to <openobex/obex.h> > > > > while here constify arguments > > --- > > include/openobex/obex.h | 25 ++++++++++++++++--------- > > lib/obex.c | 6 +++--- > > 2 files changed, 19 insertions(+), 12 deletions(-) > > I've applied patches 1-4 but had to stop at this one. Firstly, this > should really be split into two separate ones (the way you've formatted > the commit message already gives hints about it). Secondly, only > recently Marcel objected to a patch which would break the API (the one > about packet based transports). Doesn't adding const declarations have a > similar implication? Ok thanks, I agree with Hendrik - it does not change anything for C but it does fix a problem, as on NetBSD at least BDADDR_ANY has always been defined as a const value.. On reflection, I split that patch into three.. 1. change the bdaddr_t to bt_addr_t in order to be consistent 2. constify prototype 3. define bt_addr_t in a better way > Btw, please start your summary lines and sentences with capital letters. > I had to fix that manually in patches 1-4. ok did that too, so six patches to follow iain |
From: Hendrik S. <po...@he...> - 2011-06-28 13:10:51
|
Zitat von Johan Hedberg <joh...@gm...>: > Hi Iain, > > On Tue, Jun 21, 2011, Iain Hibbert wrote: >> we only need to detect the presence of "Bluetooth Device Address" type >> in order to provide the function prototype, which needs to be from a header >> included prior to <openobex/obex.h> >> >> while here constify arguments >> --- >> include/openobex/obex.h | 25 ++++++++++++++++--------- >> lib/obex.c | 6 +++--- >> 2 files changed, 19 insertions(+), 12 deletions(-) > > I've applied patches 1-4 but had to stop at this one. Firstly, this > should really be split into two separate ones (the way you've formatted > the commit message already gives hints about it). Secondly, only > recently Marcel objected to a patch which would break the API (the one > about packet based transports). Doesn't adding const declarations have a > similar implication? Not in C, only in C++, as C is not using name mangling. For a C compiler, the const only tells him that the value doesn't change. That allows it to optimize. However, there is no ABI difference. > Btw, please start your summary lines and sentences with capital letters. > I had to fix that manually in patches 1-4. Did you see the mail about Nami's 3 patches (the ones that do not break the API)? BTW: my L2CAP patch set also modifies the last argument of BtOBEX functions from uint8_t to uint16_t. However, after reconsidering, this may be a problem for big-endian systems. Shall the L2CAP transport use separate functions, then? I actually didn't want to but... Note that for version 2.0, we already changed the API/ABI by removing deprecated stuff. Marcel comment was not actually about full API compatibility but being able to write code that compiles with both versions, 1.5 and 2.0. HS |
From: Johan H. <joh...@gm...> - 2011-06-28 13:30:52
|
On Tue, Jun 28, 2011, Hendrik Sattler wrote: > Did you see the mail about Nami's 3 patches (the ones that do not > break the API)? Yes. I'm waiting for versions with fixed commit message formating and author information (I replied in private about this). Hopefully the cross-posting to linux-bluetooth will also stop. Johan |