All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence
Date: Mon, 02 May 2011 07:22:20 -0500	[thread overview]
Message-ID: <4DBEA1FC.20800@gmail.com> (raw)
In-Reply-To: <1301648188-7208-6-git-send-email-guillaume.zajac@linux.intel.com>

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

Hi Guillaume,

> @@ -197,6 +257,29 @@ out:
>  
>  	if (hdlc->destroyed)
>  		g_free(hdlc);
> +
> +	/*
> +	 * If there were no data pause for GUARD_TIMEOUTS ms,
> +	 * we try again to check it.
> +	 */
> +	if (!hdlc->paused)
> +		hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
> +							paused_timeout_cb,
> +							hdlc);

So you just caused a crash here...

> +
> +	return;
> +
> +suspend:
> +	/*
> +	 * Restart the counter and reset the ring buffer.
> +	 */
> +	hdlc->cmpt = 0;
> +
> +	/*
> +	 * Wait for another pause of GUARD_TIMEOUTS ms before returning to command mode.
> +	 */
> +	hdlc->paused = FALSE;
> +	hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS, hdlc_suspend, hdlc);
>  }
>  
>  GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)

Some general comments:

Your implementation assumes too much about the contents of the read
buffer.  You have to make sure that it works even in different timings
of the received information.  You should also not try to process the
escape sequence through the main HDLC parser...

I've pushed my own version, which I have not tested at all.  The
relevant commits are 94d6d505eeda4db0a28aea99bf3ab23a62a65f2c and
dc86e864463a61d3f99a21c948c11ba274c6ef84.  Please review and let me know
how well it works.

Regards,
-Denis

  reply	other threads:[~2011-05-02 12:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
2011-05-02 12:08   ` Denis Kenzior
2011-04-01  8:56 ` [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer Guillaume Zajac
2011-05-02 12:08   ` Denis Kenzior
2011-04-01  8:56 ` [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition Guillaume Zajac
2011-05-02 12:09   ` Denis Kenzior
2011-04-01  8:56 ` [PATCH v3 04/26] gathdlc: add g_at_hdlc_set_suspend_function() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence Guillaume Zajac
2011-05-02 12:22   ` Denis Kenzior [this message]
2011-05-04  9:14     ` Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 06/26] gatppp: add g_at_ppp_set_suspend_function() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 07/26] gatppp: add g_at_ppp_set_suspend_function() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 08/26] gathdlc: add g_at_hdlc_suspend() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition Guillaume Zajac
2011-05-02 12:24   ` Denis Kenzior
2011-05-04  9:23     ` Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 10/26] ppp: add ppp_net_suspend_interface() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 11/26] ppp_net: add ppp_net_suspend_interface() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 12/26] gatppp: add g_at_ppp_suspend() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition Guillaume Zajac
2011-05-02 12:26   ` Denis Kenzior
2011-05-04  9:25     ` Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 14/26] emulator: add ppp_suspend() CB and register it Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 15/26] emulator: add dun_ath_cb() " Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 16/26] gathdlc: add g_at_hdlc_resume() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 17/26] gathdlc: add g_at_hdlc_resume() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 18/26] ppp: add ppp_net_resume_interface() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 19/26] ppp_net: add ppp_net_resume_interface() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 20/26] gatppp: add g_at_ppp_resume() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 21/26] gatppp: add g_at_ppp_resume() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 22/26] emulator: add dun_ato_cb() and register it Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 23/26] gsmdial: add new option to test sending escape sequence Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 24/26] gatchat: add g_at_chat_send_escape_sequence() prototype Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 25/26] gatchat: add g_at_chat_send_escape_sequence() definition Guillaume Zajac
2011-04-01  8:56 ` [PATCH v3 26/26] gsmdial: implement test sequence +++-ATO0-+++-ATH0 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=4DBEA1FC.20800@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.