From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH_v4 4/8] gatppp: add public suspend function for testing
Date: Sun, 08 May 2011 23:13:39 -0500 [thread overview]
Message-ID: <4DC769F3.1090807@gmail.com> (raw)
In-Reply-To: <1304523546-643-5-git-send-email-guillaume.zajac@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2309 bytes --]
Hi Guillaume,
On 05/04/2011 10:39 AM, Guillaume Zajac wrote:
> ---
> gatchat/gatppp.c | 35 +++++++++++++++++++++++++++++++++++
> gatchat/gatppp.h | 1 +
> 2 files changed, 36 insertions(+), 0 deletions(-)
>
> diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
> index c776811..67f0a28 100644
> --- a/gatchat/gatppp.c
> +++ b/gatchat/gatppp.c
> @@ -46,6 +46,9 @@
> #define PPP_ADDR_FIELD 0xff
> #define PPP_CTRL 0x03
>
> +/* Time to wait before and after +++ sequence */
> +#define GUARD_TIMEOUTS 1500
> +
> enum ppp_phase {
> PPP_PHASE_DEAD = 0, /* Link dead */
> PPP_PHASE_ESTABLISHMENT, /* LCP started */
> @@ -500,6 +503,38 @@ void g_at_ppp_shutdown(GAtPPP *ppp)
> pppcp_signal_close(ppp->lcp);
> }
>
> +static gboolean call_suspend_cb(gpointer user_data)
> +{
> + GAtPPP *ppp = user_data;
> +
> + if (ppp->suspend_func)
> + ppp->suspend_func(ppp->suspend_data);
> +
> + return FALSE;
> +}
> +
> +static gboolean send_escape_sequence(gpointer user_data)
> +{
> + GAtPPP *ppp = user_data;
> + GAtIO *io = g_at_hdlc_get_io(ppp->hdlc);
> +
> + g_at_io_write(io, "+++", 3);
> +
> + g_timeout_add(GUARD_TIMEOUTS, call_suspend_cb, ppp);
Please make sure to track this GSource and remove it in case ppp is ever
forcefully removed. Remember, we're writing a library and you must make
sure to clean up after yourself.
> +
> + return FALSE;
> +}
> +
> +void g_at_ppp_suspend(GAtPPP *ppp)
> +{
> + if (ppp == NULL)
> + return;
> +
> + ppp_net_suspend_interface(ppp->net);
> + g_at_hdlc_suspend(ppp->hdlc);
> + g_timeout_add(GUARD_TIMEOUTS, send_escape_sequence, ppp);
> +}
> +
> void g_at_ppp_ref(GAtPPP *ppp)
> {
> g_atomic_int_inc(&ppp->ref_count);
> diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h
> index 9464ffd..66e0ade 100644
> --- a/gatchat/gatppp.h
> +++ b/gatchat/gatppp.h
> @@ -64,6 +64,7 @@ void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
> gpointer user_data);
> void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
> void g_at_ppp_shutdown(GAtPPP *ppp);
> +void g_at_ppp_suspend(GAtPPP *ppp);
> void g_at_ppp_ref(GAtPPP *ppp);
> void g_at_ppp_unref(GAtPPP *ppp);
>
Is a _resume version of this patch forthcoming?
Regards,
-Denis
next prev parent reply other threads:[~2011-05-09 4:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 15:38 [PATCH_v4 0/8] Escape sequence test implementation Guillaume Zajac
2011-05-04 15:38 ` [PATCH_v4 1/8] gathdlc: delete read/write handler in hdlc_suspend and add public suspend function for testing Guillaume Zajac
2011-05-09 4:10 ` Denis Kenzior
2011-05-04 15:39 ` [PATCH_v4 2/8] ppp_net: add ppp_net_suspend_interface() function Guillaume Zajac
2011-05-09 4:11 ` Denis Kenzior
2011-05-10 7:57 ` Guillaume Zajac
2011-05-04 15:39 ` [PATCH_v4 3/8] gatppp: add function to set ppp_suspend() and proxy function to call ppp_net_suspend_interface() Guillaume Zajac
2011-05-09 4:12 ` Denis Kenzior
2011-05-04 15:39 ` [PATCH_v4 4/8] gatppp: add public suspend function for testing Guillaume Zajac
2011-05-09 4:13 ` Denis Kenzior [this message]
2011-05-04 15:39 ` [PATCH_v4 5/8] emulator: add suspend_ppp() definition and and register it into GAtPPP Guillaume Zajac
2011-05-09 4:16 ` Denis Kenzior
2011-05-04 15:39 ` [PATCH_v4 6/8] gsmdial: add new option to test escape sequence Guillaume Zajac
2011-05-04 15:39 ` [PATCH_v4 7/8] emulator: add dun_ath_cb() and register it Guillaume Zajac
2011-05-09 4:19 ` Denis Kenzior
2011-05-04 15:39 ` [PATCH_v4 8/8] gsmdial: add ATH0 command test Guillaume Zajac
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=4DC769F3.1090807@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox