All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix change state immediately when meet the slash
@ 2010-02-02 13:23 Zhenhua Zhang
  2010-02-02 17:47 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenhua Zhang @ 2010-02-02 13:23 UTC (permalink / raw)
  To: ofono

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

According to V.250 spec section 5.2.4 Repeating a command line, if
the prefix "A/" or "a/" is received, we should execute the last
command immediately. No need to meet \r.
---
 gatchat/gatserver.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index fe5c3a8..eb33605 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -35,7 +35,6 @@
 enum ParserState {
 	PARSER_STATE_IDLE,
 	PARSER_STATE_A,
-	PARSER_STATE_SLASH,
 	PARSER_STATE_COMMAND,
 	PARSER_STATE_GARBAGE,
 };
@@ -214,22 +213,14 @@ static enum ParserResult server_feed(GAtServer *server,
 				i += 1;
 				res = PARSER_RESULT_GARBAGE;
 				goto out;
-			} else if (byte == '/')
-				server->parser_state = PARSER_STATE_SLASH;
-			else if (byte == 'T' || byte == 't')
+			} else if (byte == '/') {
 				server->parser_state = PARSER_STATE_COMMAND;
-			else
-				server->parser_state = PARSER_STATE_GARBAGE;
-
-			break;
-
-		case PARSER_STATE_SLASH:
-			if (byte == s3) {
-				server->parser_state = PARSER_STATE_IDLE;
-				i+= 1;
+				i += 1;
 				res = PARSER_RESULT_REPEAT_LAST;
 				goto out;
-			} else if (byte != ' ' && byte != '\t')
+			} else if (byte == 'T' || byte == 't')
+				server->parser_state = PARSER_STATE_COMMAND;
+			else
 				server->parser_state = PARSER_STATE_GARBAGE;
 
 			break;
@@ -246,7 +237,6 @@ static enum ParserResult server_feed(GAtServer *server,
 		case PARSER_STATE_GARBAGE:
 			if (byte == s3) {
 				server->parser_state = PARSER_STATE_IDLE;
-
 				i += 1;
 				res = PARSER_RESULT_GARBAGE;
 				goto out;
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix change state immediately when meet the slash
  2010-02-02 13:23 [PATCH] Fix change state immediately when meet the slash Zhenhua Zhang
@ 2010-02-02 17:47 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-02-02 17:47 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> According to V.250 spec section 5.2.4 Repeating a command line, if
> the prefix "A/" or "a/" is received, we should execute the last
> command immediately. No need to meet \r.

Yes you're right.

> @@ -214,22 +213,14 @@ static enum ParserResult server_feed(GAtServer
>  *server, i += 1;
>  				res = PARSER_RESULT_GARBAGE;
>  				goto out;
> -			} else if (byte == '/')
> -				server->parser_state = PARSER_STATE_SLASH;
> -			else if (byte == 'T' || byte == 't')
> +			} else if (byte == '/') {
>  				server->parser_state = PARSER_STATE_COMMAND;

I changed this to PARSER_STATE_IDLE and applied the patch.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-02 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 13:23 [PATCH] Fix change state immediately when meet the slash Zhenhua Zhang
2010-02-02 17:47 ` Denis Kenzior

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.