Re: [PATCH BlueZ] gatttool: Update interactive prompt if connection is lost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux