bt: drop bt_put_le16() dependency (not universally available)
Eliminate the dependency on the non-portable bt_put_le16() routine. It isn't available in all supported BlueZ versions, and won't be available in other platform backends. Prefer write_u16le() which is available on all sigrok supported platforms.
This commit is contained in:
parent
f8a8d4bb70
commit
3b13990f7d
|
@ -201,15 +201,6 @@ AM_CONDITIONAL([NEED_RPC], [test "x$sr_cv_have_rpc" = xyes])
|
||||||
# Check for compiler support of 128 bit integers
|
# Check for compiler support of 128 bit integers
|
||||||
AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], [])
|
AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], [])
|
||||||
|
|
||||||
# Availability of bt_put_le16() depends on the bluez library version.
|
|
||||||
AC_CACHE_CHECK([for bt_put_le16], [sr_cv_have_btputle16],
|
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
|
||||||
[[#include <bluetooth/bluetooth.h>]],
|
|
||||||
[[bt_put_le16(0, (void *)0);]])],
|
|
||||||
[sr_cv_have_btputle16=yes], [sr_cv_have_btputle16=no])])
|
|
||||||
AS_IF([test "x$sr_cv_have_btputle16" = xyes],
|
|
||||||
[AC_DEFINE([HAVE_BT_PUT_LE16], [1], [Specifies whether we have bt_put_le16().])])
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
## Hardware drivers ##
|
## Hardware drivers ##
|
||||||
########################
|
########################
|
||||||
|
|
|
@ -106,14 +106,6 @@
|
||||||
* the header doesn't.
|
* the header doesn't.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined HAVE_BT_PUT_LE16
|
|
||||||
static inline void bt_put_le16(uint16_t v, uint8_t *p)
|
|
||||||
{
|
|
||||||
p[0] = (v >> 0) & 0xff;
|
|
||||||
p[1] = (v >> 8) & 0xff;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* }}} compat decls */
|
/* }}} compat decls */
|
||||||
/* {{{ Linux socket specific decls */
|
/* {{{ Linux socket specific decls */
|
||||||
|
|
||||||
|
@ -898,7 +890,7 @@ SR_PRIV int sr_bt_start_notify(struct sr_bt_desc *desc)
|
||||||
if (sr_bt_check_socket_usable(desc) < 0)
|
if (sr_bt_check_socket_usable(desc) < 0)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
bt_put_le16(desc->cccd_value, buf);
|
write_u16le(buf, desc->cccd_value);
|
||||||
wrlen = sr_bt_char_write_req(desc, desc->cccd_handle, buf, sizeof(buf));
|
wrlen = sr_bt_char_write_req(desc, desc->cccd_handle, buf, sizeof(buf));
|
||||||
if (wrlen != sizeof(buf))
|
if (wrlen != sizeof(buf))
|
||||||
return -2;
|
return -2;
|
||||||
|
@ -1048,7 +1040,7 @@ static ssize_t sr_bt_write_type_handle_bytes(struct sr_bt_desc *desc,
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
header[0] = type;
|
header[0] = type;
|
||||||
bt_put_le16(handle, &header[1]);
|
write_u16le(&header[1], handle);
|
||||||
|
|
||||||
if (data && len)
|
if (data && len)
|
||||||
wrlen = writev(desc->fd, iov, ARRAY_SIZE(iov));
|
wrlen = writev(desc->fd, iov, ARRAY_SIZE(iov));
|
||||||
|
|
Loading…
Reference in New Issue