All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Jefferson Delfes <jefferson.delfes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ] gatttool: Update interactive prompt if connection is lost
Date: Tue, 27 Mar 2012 14:50:17 +0300	[thread overview]
Message-ID: <20120327115017.GH14481@x220> (raw)
In-Reply-To: <1332516126-6665-1-git-send-email-jefferson.delfes@openbossa.org>

Hi Jefferson,

On Fri, Mar 23, 2012, Jefferson Delfes wrote:
> In interactive mode, when connection is lost, the prompt used to remain
> in "connected" state. This patch fixes that case, by always showing the
> actual connection state.
> ---
>  attrib/interactive.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/attrib/interactive.c b/attrib/interactive.c
> index be81424..47ddcf6 100644
> --- a/attrib/interactive.c
> +++ b/attrib/interactive.c
> @@ -56,6 +56,7 @@ struct characteristic_data {
>  };
>  
>  static void cmd_help(int argcp, char **argvp);
> +static void cmd_disconnect(int argcp, char **argvp);

We should really try to avoid forward declarations when possible and the
cmd_* functions should be reserved for real user entered commands and
not as generic helpers as you're trying to do. So I'd factor out code
from cmd_disconnect into a static helper function somewhere above both
cmd_disconnect and cmd_connect, call it e.g. disconnect_io().

> +static gboolean channel_watcher(GIOChannel *chan, GIOCondition cond,
> +				gpointer user_data)
> +{
> +	cmd_disconnect(0, NULL);
> +
> +	return TRUE;
> +}

Shouldn't this be returning FALSE instead of TRUE so that the watch
doesn't get left hanging around GLibs watch lists wasting memory?

Johan

  reply	other threads:[~2012-03-27 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23 15:22 [PATCH BlueZ] gatttool: Update interactive prompt if connection is lost Jefferson Delfes
2012-03-27 11:50 ` Johan Hedberg [this message]
2012-03-27 12:52   ` Jefferson Delfes
2012-03-27 13:21 ` [PATCHv2 " Jefferson Delfes
2012-03-28  9:41   ` 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=20120327115017.GH14481@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=jefferson.delfes@openbossa.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.