All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Add command echo back if ATE=1
@ 2010-03-02 10:21 Zhenhua Zhang
  2010-03-02 10:21 ` [PATCH 2/4] Fix remove wrong extended prefix Zhenhua Zhang
  2010-03-03 19:02 ` [PATCH 1/4] Add command echo back if ATE=1 Denis Kenzior
  0 siblings, 2 replies; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-02 10:21 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/gatserver.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index f19d267..c72e798 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -382,6 +382,9 @@ static void new_bytes(GAtServer *p)
 		gsize rbytes = MIN(len - p->read_so_far, wrap - p->read_so_far);
 		result = server_feed(p, (char *)buf, &rbytes);
 
+		if (p->v250.echo)
+			send_common(p, (char *)buf, rbytes);
+
 		buf += rbytes;
 		p->read_so_far += rbytes;
 
-- 
1.6.6.1


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

* [PATCH 2/4] Fix remove wrong extended prefix
  2010-03-02 10:21 [PATCH 1/4] Add command echo back if ATE=1 Zhenhua Zhang
@ 2010-03-02 10:21 ` Zhenhua Zhang
  2010-03-02 10:21   ` [PATCH 3/4] Update rename result to state Zhenhua Zhang
  2010-03-03 19:17   ` [PATCH 2/4] Fix remove wrong extended prefix Denis Kenzior
  2010-03-03 19:02 ` [PATCH 1/4] Add command echo back if ATE=1 Denis Kenzior
  1 sibling, 2 replies; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-02 10:21 UTC (permalink / raw)
  To: ofono

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

ATA, ATH and ATD are belongs to basic command. So removed them.
---
 gatchat/gatserver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index c72e798..253a80a 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -216,7 +216,7 @@ static void server_parse_line(GAtServer *server, char *line)
 	if (c == ';')
 		c = line[++i];
 
-	if (is_at_command_prefix(c) || c == 'A' || c == 'D' || c == 'H')
+	if (is_at_command_prefix(c))
 		parse_at_command(server, line + i);
 	else if (g_ascii_isalpha(c) || c == '&')
 		parse_v250_settings(server, line + i);
-- 
1.6.6.1


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

* [PATCH 3/4] Update rename result to state
  2010-03-02 10:21 ` [PATCH 2/4] Fix remove wrong extended prefix Zhenhua Zhang
@ 2010-03-02 10:21   ` Zhenhua Zhang
  2010-03-02 10:21     ` [PATCH 4/4] Fix server only return the final parser result Zhenhua Zhang
  2010-03-03 19:07     ` [PATCH 3/4] Update rename result to state Denis Kenzior
  2010-03-03 19:17   ` [PATCH 2/4] Fix remove wrong extended prefix Denis Kenzior
  1 sibling, 2 replies; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-02 10:21 UTC (permalink / raw)
  To: ofono

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

to avoid name conflict with GAtServerResult
---
 gatchat/gatserver.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 253a80a..df3c8bf 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -376,11 +376,11 @@ static void new_bytes(GAtServer *p)
 	unsigned int len = ring_buffer_len(p->read_buf);
 	unsigned int wrap = ring_buffer_len_no_wrap(p->read_buf);
 	unsigned char *buf = ring_buffer_read_ptr(p->read_buf, p->read_so_far);
-	enum ParserState result;
+	enum ParserState state;
 
 	while (p->channel && (p->read_so_far < len)) {
 		gsize rbytes = MIN(len - p->read_so_far, wrap - p->read_so_far);
-		result = server_feed(p, (char *)buf, &rbytes);
+		state = server_feed(p, (char *)buf, &rbytes);
 
 		if (p->v250.echo)
 			send_common(p, (char *)buf, rbytes);
@@ -393,10 +393,10 @@ static void new_bytes(GAtServer *p)
 			wrap = len;
 		}
 
-		if (result == PARSER_RESULT_UNSURE)
+		if (state == PARSER_RESULT_UNSURE)
 			continue;
 
-		switch (result) {
+		switch (state) {
 		case PARSER_RESULT_EMPTY_COMMAND:
 			/*
 			 * According to section 5.2.4 and 5.6 of V250,
-- 
1.6.6.1


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

* [PATCH 4/4] Fix server only return the final parser result
  2010-03-02 10:21   ` [PATCH 3/4] Update rename result to state Zhenhua Zhang
@ 2010-03-02 10:21     ` Zhenhua Zhang
  2010-03-03 19:09       ` Denis Kenzior
  2010-03-03 19:07     ` [PATCH 3/4] Update rename result to state Denis Kenzior
  1 sibling, 1 reply; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-02 10:21 UTC (permalink / raw)
  To: ofono

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

In case we meet compound commands in single line, AtServer should
only return the parser result of last command according to spec.
So we return the parser result in the parse iteration.
---
 gatchat/gatserver.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index df3c8bf..c9256e2 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -186,28 +186,27 @@ static inline gboolean is_at_command_prefix(const char c)
 	}
 }
 
-static void parse_at_command(GAtServer *server, char *buf)
+static GAtServerResult parse_at_command(GAtServer *server, char *buf)
 {
-	g_at_server_send_result(server, G_AT_SERVER_RESULT_ERROR);
+	return G_AT_SERVER_RESULT_ERROR;
 }
 
-static void parse_v250_settings(GAtServer *server, char *buf)
+static GAtServerResult parse_v250_settings(GAtServer *server, char *buf)
 {
-	g_at_server_send_result(server, G_AT_SERVER_RESULT_ERROR);
+	return G_AT_SERVER_RESULT_ERROR;
 }
 
-static void server_parse_line(GAtServer *server, char *line)
+static GAtServerResult server_parse_line(GAtServer *server, char *line)
 {
 	gsize i = 0;
 	char c;
+	GAtServerResult res = G_AT_SERVER_RESULT_ERROR;
 
-	if (line == NULL) {
-		g_at_server_send_result(server, G_AT_SERVER_RESULT_ERROR);
+	if (line == NULL)
 		goto done;
-	}
 
 	if (line[0] == '\0') {
-		g_at_server_send_result(server, G_AT_SERVER_RESULT_OK);
+		res = G_AT_SERVER_RESULT_OK;
 		goto done;
 	}
 
@@ -217,14 +216,13 @@ static void server_parse_line(GAtServer *server, char *line)
 		c = line[++i];
 
 	if (is_at_command_prefix(c))
-		parse_at_command(server, line + i);
+		res = parse_at_command(server, line + i);
 	else if (g_ascii_isalpha(c) || c == '&')
-		parse_v250_settings(server, line + i);
-	else
-		g_at_server_send_result(server, G_AT_SERVER_RESULT_ERROR);
+		res = parse_v250_settings(server, line + i);
 
 done:
 	g_free(line);
+	return res;
 }
 
 static enum ParserResult server_feed(GAtServer *server,
@@ -377,6 +375,7 @@ static void new_bytes(GAtServer *p)
 	unsigned int wrap = ring_buffer_len_no_wrap(p->read_buf);
 	unsigned char *buf = ring_buffer_read_ptr(p->read_buf, p->read_so_far);
 	enum ParserState state;
+	GAtServerResult result;
 
 	while (p->channel && (p->read_so_far < len)) {
 		gsize rbytes = MIN(len - p->read_so_far, wrap - p->read_so_far);
@@ -407,7 +406,8 @@ static void new_bytes(GAtServer *p)
 			break;
 
 		case PARSER_RESULT_COMMAND:
-			server_parse_line(p, extract_line(p));
+			result = server_parse_line(p, extract_line(p));
+			g_at_server_send_result(p, result);
 			break;
 
 		case PARSER_RESULT_REPEAT_LAST:
-- 
1.6.6.1


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

* Re: [PATCH 1/4] Add command echo back if ATE=1
  2010-03-02 10:21 [PATCH 1/4] Add command echo back if ATE=1 Zhenhua Zhang
  2010-03-02 10:21 ` [PATCH 2/4] Fix remove wrong extended prefix Zhenhua Zhang
@ 2010-03-03 19:02 ` Denis Kenzior
  1 sibling, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2010-03-03 19:02 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ---
>  gatchat/gatserver.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 3/4] Update rename result to state
  2010-03-02 10:21   ` [PATCH 3/4] Update rename result to state Zhenhua Zhang
  2010-03-02 10:21     ` [PATCH 4/4] Fix server only return the final parser result Zhenhua Zhang
@ 2010-03-03 19:07     ` Denis Kenzior
  1 sibling, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2010-03-03 19:07 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> to avoid name conflict with GAtServerResult
> ---
>  gatchat/gatserver.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
> index 253a80a..df3c8bf 100644
> --- a/gatchat/gatserver.c
> +++ b/gatchat/gatserver.c
> @@ -376,11 +376,11 @@ static void new_bytes(GAtServer *p)
>  	unsigned int len = ring_buffer_len(p->read_buf);
>  	unsigned int wrap = ring_buffer_len_no_wrap(p->read_buf);
>  	unsigned char *buf = ring_buffer_read_ptr(p->read_buf, p->read_so_far);
> -	enum ParserState result;
> +	enum ParserState state;

Actually this should be enum ParserResult result;  Fixed upstream.

Regards,
-Denis

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

* Re: [PATCH 4/4] Fix server only return the final parser result
  2010-03-02 10:21     ` [PATCH 4/4] Fix server only return the final parser result Zhenhua Zhang
@ 2010-03-03 19:09       ` Denis Kenzior
  2010-03-04  1:31         ` Zhenhua Zhang
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Kenzior @ 2010-03-03 19:09 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> In case we meet compound commands in single line, AtServer should
> only return the parser result of last command according to spec.
> So we return the parser result in the parse iteration.

So I agree that we need to do this, but I disagree with the approach.  I 
suggest we let g_at_server_send_result take care of this.  This will make 
extended errors much easier to handle.

Regards,
-Denis

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

* Re: [PATCH 2/4] Fix remove wrong extended prefix
  2010-03-02 10:21 ` [PATCH 2/4] Fix remove wrong extended prefix Zhenhua Zhang
  2010-03-02 10:21   ` [PATCH 3/4] Update rename result to state Zhenhua Zhang
@ 2010-03-03 19:17   ` Denis Kenzior
  2010-03-04  1:38     ` Zhenhua Zhang
  1 sibling, 1 reply; 10+ messages in thread
From: Denis Kenzior @ 2010-03-03 19:17 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ATA, ATH and ATD are belongs to basic command. So removed them.

All of these need to be handled by user callbacks, so effectively they need to 
be treated like extended commands.  Especially with the weird ATD syntax rules 
that 27.007 introduces.

Regards,
-Denis

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

* Re: [PATCH 4/4] Fix server only return the final parser result
  2010-03-03 19:09       ` Denis Kenzior
@ 2010-03-04  1:31         ` Zhenhua Zhang
  0 siblings, 0 replies; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-04  1:31 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

On 03/04/2010 03:09 AM, Denis Kenzior wrote:
> Hi Zhenhua,
>
>> In case we meet compound commands in single line, AtServer should
>> only return the parser result of last command according to spec.
>> So we return the parser result in the parse iteration.
>
> So I agree that we need to do this, but I disagree with the approach.  I
> suggest we let g_at_server_send_result take care of this.  This will make
> extended errors much easier to handle.

OK. I will try your approach and send out code later.

> Regards,
> -Denis
> _______________________________________________
> ofono mailing list
> ofono(a)ofono.org
> http://lists.ofono.org/listinfo/ofono
>


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

* Re: [PATCH 2/4] Fix remove wrong extended prefix
  2010-03-03 19:17   ` [PATCH 2/4] Fix remove wrong extended prefix Denis Kenzior
@ 2010-03-04  1:38     ` Zhenhua Zhang
  0 siblings, 0 replies; 10+ messages in thread
From: Zhenhua Zhang @ 2010-03-04  1:38 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

On 03/04/2010 03:17 AM, Denis Kenzior wrote:
> Hi Zhenhua,
>
>> ATA, ATH and ATD are belongs to basic command. So removed them.
>
> All of these need to be handled by user callbacks, so effectively they need to
> be treated like extended commands.  Especially with the weird ATD syntax rules
> that 27.007 introduces.

The basic and extended command are treated as the same internally. So 
user could also register basic command callbacks. ATD and ATA are 
handled in "[PATCH 3/7] Add basic command parsing".

> Regards,
> -Denis
> _______________________________________________
> ofono mailing list
> ofono(a)ofono.org
> http://lists.ofono.org/listinfo/ofono
>


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

end of thread, other threads:[~2010-03-04  1:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 10:21 [PATCH 1/4] Add command echo back if ATE=1 Zhenhua Zhang
2010-03-02 10:21 ` [PATCH 2/4] Fix remove wrong extended prefix Zhenhua Zhang
2010-03-02 10:21   ` [PATCH 3/4] Update rename result to state Zhenhua Zhang
2010-03-02 10:21     ` [PATCH 4/4] Fix server only return the final parser result Zhenhua Zhang
2010-03-03 19:09       ` Denis Kenzior
2010-03-04  1:31         ` Zhenhua Zhang
2010-03-03 19:07     ` [PATCH 3/4] Update rename result to state Denis Kenzior
2010-03-03 19:17   ` [PATCH 2/4] Fix remove wrong extended prefix Denis Kenzior
2010-03-04  1:38     ` Zhenhua Zhang
2010-03-03 19:02 ` [PATCH 1/4] Add command echo back if ATE=1 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.