From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 6/9] gatchat: fix gatsyntax to support +CPOS
Date: Wed, 09 Mar 2011 16:19:20 -0600 [thread overview]
Message-ID: <4D77FCE8.5040905@gmail.com> (raw)
In-Reply-To: <1299582051-32701-7-git-send-email-jarko.poutiainen@tieto.com>
[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]
Hi Jarko,
On 03/08/2011 05:00 AM, Jarko Poutiainen wrote:
> ---
> gatchat/gatsyntax.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/gatchat/gatsyntax.c b/gatchat/gatsyntax.c
> index 2fc70b8..a85bc66 100644
> --- a/gatchat/gatsyntax.c
> +++ b/gatchat/gatsyntax.c
> @@ -90,7 +90,11 @@ static GAtSyntaxResult gsmv1_feed(GAtSyntax *syntax,
>
> case GSMV1_STATE_INITIAL_CR:
> if (byte == '\n')
> - syntax->state = GSMV1_STATE_INITIAL_LF;
> + if (*len == 2) {
You simply cannot do this. The whole idea behind the state machine in
GAtSyntax is that your data is a byte-stream. There are no markers, and
you can make no assumptions on the length of the buffer that is fed into
this function. e.g. if you're unlucky you can get:
gsmv1_feed("\r")
gsmv1_feed("\n")
> + res = G_AT_SYNTAX_RESULT_PROMPT;
> + syntax->state = GSMV1_STATE_IDLE;
> + } else
> + syntax->state = GSMV1_STATE_INITIAL_LF;
Is there any particular reason why CPOS is not re-using the prompting
feature of AT commands and has to invent its own? If you think about
this a bit harder you will realize that the spec is *completely* broken
here and introduces a parser ambiguity which cannot be reliably fixed.
At this point my only suggestion is that you need to set a parser hint
after every CPOS command sent to the modem. Or better yet, push a
change request to 27.007 to use proper prompting procedures.
> else
> syntax->state = GSMV1_STATE_ECHO;
> break;
> @@ -252,7 +256,9 @@ static GAtSyntaxResult gsm_permissive_feed(GAtSyntax *syntax,
>
> switch (syntax->state) {
> case GSM_PERMISSIVE_STATE_IDLE:
> - if (byte == '\r' || byte == '\n')
> + if (byte == '\n' && *len == 2)
> + res = G_AT_SYNTAX_RESULT_PROMPT;
> + else if (byte == '\r' || byte == '\n')
> /* ignore */;
> else if (byte == '>')
> syntax->state = GSM_PERMISSIVE_STATE_PROMPT;
Regards,
-Denis
next prev parent reply other threads:[~2011-03-09 22:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 11:00 [PATCH 0/9] Basic E911 support Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 1/9] dbus: add gnss interface definition Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 2/9] include: add gnss.h file Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 3/9] src: add atom type for gnss Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 4/9] src: add gnss atom and agent implementation Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 5/9] atmodem: add gnss driver Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 6/9] gatchat: fix gatsyntax to support +CPOS Jarko Poutiainen
2011-03-09 22:19 ` Denis Kenzior [this message]
2011-03-10 14:19 ` Jarko Poutiainen
2011-03-10 23:11 ` Denis Kenzior
2011-03-11 8:23 ` Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 7/9] ste: add support for gnss Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 8/9] ofono.conf: add positioning agent interface Jarko Poutiainen
2011-03-08 11:00 ` [PATCH 9/9] test: add test-gnss Jarko Poutiainen
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=4D77FCE8.5040905@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