Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Sebastian <sebastianchlad@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
	Sebastian Chlad <sebastian.chlad@tieto.com>
Subject: Re: [PATCH] Adding paired-devices cmd to the bluetoothctl
Date: Mon, 25 Nov 2013 14:08:07 +0100	[thread overview]
Message-ID: <7144304.2MX7gdvi4Y@uw000953> (raw)
In-Reply-To: <1384978912-27461-1-git-send-email-sebastian.chlad@tieto.com>

Hi,

> From: Sebastian Chlad <sebastian.chlad@tieto.com>
> 
> Paired-devices command lists only paired devices
> ---
>  client/main.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/client/main.c b/client/main.c
> index 0dd1510..c39ebf8 100644
> --- a/client/main.c
> +++ b/client/main.c
> @@ -538,6 +538,26 @@ static void cmd_devices(const char *arg)
>  	}
>  }
>  
> +static void cmd_devices_paired(const char *arg)
> +{
> +	GList *list;
> +
> +	for (list = g_list_first(dev_list); list; list = g_list_next(list)) {
> +		DBusMessageIter iter;
> +		GDBusProxy *proxy = list->data;
> +		dbus_bool_t paired;
> +
> +		if (g_dbus_proxy_get_property(proxy, "Paired", &iter) == FALSE)
> +			return;
> +		dbus_message_iter_get_basic(&iter, &paired);
> +
> +		if (!paired)
> +			break;

Shouldn't this be
  if (!paired)
      continue;

? Or paired devices are guaranteed to be first on list?

> +
> +		print_device(proxy, NULL);
> +	}
> +}
> +
>  static void generic_callback(const DBusError *error, void *user_data)
>  {
>  	char *str = user_data;
> @@ -1047,6 +1067,8 @@ static const struct {
>  	{ "select",       "<ctrl>",   cmd_select, "Select default controller",
>  							ctrl_generator },
>  	{ "devices",      NULL,       cmd_devices, "List available devices" },
> +	{ "paired-devices", NULL,     cmd_devices_paired,
> +					"List paired devices"},
>  	{ "system-alias", "<name>",   cmd_system_alias },
>  	{ "reset-alias",  NULL,       cmd_reset_alias },
>  	{ "power",        "<on/off>", cmd_power, "Set controller power" },
> 

-- 
BR
Szymon Janc


  parent reply	other threads:[~2013-11-25 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 20:21 [PATCH] Adding paired-devices cmd to the bluetoothctl Sebastian
2013-11-25 12:56 ` Johan Hedberg
2013-11-25 13:08 ` Szymon Janc [this message]
2013-11-25 13:24   ` Johan Hedberg

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=7144304.2MX7gdvi4Y@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sebastian.chlad@tieto.com \
    --cc=sebastianchlad@gmail.com \
    /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