linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] tools/btpclient: Use address convertion function from libbluetooth
Date: Wed, 17 Jan 2018 11:30:22 +0100	[thread overview]
Message-ID: <2733837.P37tabTlIk@ix> (raw)
In-Reply-To: <20180116140333.10745-1-szymon.janc@codecoup.pl>

On Tuesday, 16 January 2018 15:03:32 CET Szymon Janc wrote:
> There is no need for internal helper.
> ---
>  Makefile.tools    |  2 +-
>  tools/btpclient.c | 12 ++++--------
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/Makefile.tools b/Makefile.tools
> index 651ff00ca..71d083e71 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -450,5 +450,5 @@ noinst_PROGRAMS += tools/btpclient
> 
>  tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c
> src/shared/btp.h tools_btpclient_CFLAGS = $(AM_CFLAGS) @ELL_CFLAGS@
> -tools_btpclient_LDADD = @ELL_LIBS@
> +tools_btpclient_LDADD = @ELL_LIBS@ lib/libbluetooth-internal.la
>  endif
> diff --git a/tools/btpclient.c b/tools/btpclient.c
> index 806403f6a..4d4475a07 100644
> --- a/tools/btpclient.c
> +++ b/tools/btpclient.c
> @@ -32,6 +32,7 @@
> 
>  #include <ell/ell.h>
> 
> +#include "lib/bluetooth.h"
>  #include "src/shared/btp.h"
> 
>  struct btp_adapter {
> @@ -53,12 +54,6 @@ static struct btp *btp;
> 
>  static bool gap_service_registered;
> 
> -static bool str2addr(const char *str, uint8_t *addr)
> -{
> -	return sscanf(str, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[5], &addr[4],
> -				&addr[3], &addr[2], &addr[1], &addr[0]) == 6;
> -}
> -
>  static struct btp_adapter *find_adapter_by_proxy(struct l_dbus_proxy
> *proxy) {
>  	const struct l_queue_entry *entry;
> @@ -181,7 +176,8 @@ static void btp_gap_read_info(uint8_t index, const void
> *param, uint16_t length, if (!l_dbus_proxy_get_property(adapter->proxy,
> "Address", "s", &str)) goto failed;
> 
> -	if (!str2addr(str, rp.address))
> +
> +	if (str2ba(str, (bdaddr_t *)rp.address) < 0)
>  		goto failed;
> 
>  	if (!l_dbus_proxy_get_property(adapter->proxy, "Name", "s", &str)) {
> @@ -674,7 +670,7 @@ static void btp_gap_device_found_ev(struct l_dbus_proxy
> *proxy) int16_t rssi;
> 
>  	if (!l_dbus_proxy_get_property(proxy, "Address", "s", &str) ||
> -						!str2addr(str, ev.address))
> +						str2ba(str, (bdaddr_t *)ev.address) < 0)
>  		return;
> 
>  	if (!l_dbus_proxy_get_property(proxy, "AddressType", "s", &str))

Applied.

-- 
pozdrawiam
Szymon Janc



      parent reply	other threads:[~2018-01-17 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 14:03 [PATCH 1/2] tools/btpclient: Use address convertion function from libbluetooth Szymon Janc
2018-01-16 14:03 ` [PATCH 2/2] shared/btp: Use bdaddr_t for storing address Szymon Janc
2018-01-17 10:30 ` Szymon Janc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2733837.P37tabTlIk@ix \
    --to=szymon.janc@codecoup.pl \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).