All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/3] hfp: add watch to trigger HUP of the file descriptor
Date: Mon, 15 Feb 2010 13:36:06 -0600	[thread overview]
Message-ID: <201002151336.06928.denkenz@gmail.com> (raw)
In-Reply-To: <1266261996-15507-2-git-send-email-padovan@profusion.mobi>

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Hi Gustavo,

> ---
>  plugins/hfp.c |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/plugins/hfp.c b/plugins/hfp.c
> index 411cfc1..3776dc6 100644
> --- a/plugins/hfp.c
> +++ b/plugins/hfp.c
> @@ -482,6 +482,20 @@ error:
>  	service_level_conn_failed(modem);
>  }
> 
> +static gboolean hfp_fd_disconnected_cb(GIOChannel *chan, GIOCondition
>  cond, +		struct ofono_modem *modem)
> +{
> +	if (cond & G_IO_NVAL)
> +		return FALSE;
> +
> +	if (cond & (G_IO_ERR | G_IO_HUP)) {
> +		ofono_modem_set_powered(modem, FALSE);
> +		return FALSE;
> +	}
> +
> +	return TRUE;
> +}
> +
>  /* either oFono or Phone could request SLC connection */
>  static int service_level_connection(struct ofono_modem *modem, int fd)
>  {
> @@ -498,6 +512,9 @@ static int service_level_connection(struct ofono_modem
>  *modem, int fd) return -EIO;
>  	}
> 
> +	g_io_add_watch(io, G_IO_ERR | G_IO_HUP | G_IO_NVAL,
> +	                        (GIOFunc) hfp_fd_disconnected_cb, modem);
> +

Use g_at_chat_set_disconnect_function

>  	syntax = g_at_syntax_new_gsmv1();
>  	chat = g_at_chat_new(io, syntax);
>  	g_at_syntax_unref(syntax);
> 

Regards,
-Denis

  parent reply	other threads:[~2010-02-15 19:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 19:26 [PATCH 1/3] hfp: remove duplicated ofono_modem_set_powered Gustavo F. Padovan
2010-02-15 19:26 ` [PATCH 2/3] hfp: add watch to trigger HUP of the file descriptor Gustavo F. Padovan
2010-02-15 19:26   ` [PATCH 3/3] hfp: remove modems if bluetoothd shutdowns without calling Release Gustavo F. Padovan
2010-02-15 19:41     ` Denis Kenzior
2010-02-15 19:36   ` Denis Kenzior [this message]
2010-02-15 19:39 ` [PATCH 1/3] hfp: remove duplicated ofono_modem_set_powered Denis Kenzior

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=201002151336.06928.denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.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.