Skip to contentSkip to conversation

Skip unsolicited CREG/CGREG correctly

PATCH In review Tonny Tzeng 2 participants 3 messages Dec 2, 2010 – Dec 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip unsolicited CREG/CGREG correctly

This patch skip unsolicited CREG/CGREG correctly.

---
 drivers/atmodem/atutil.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/atmodem/atutil.c +0 -0
index b6f0d92..2ca7b44 100644
@@ -244,8 +244,9 @@ gboolean at_util_parse_reg(GAtResult *result, const

char *prefix,
continue;

/* Some firmware will report bogus lac/ci when unregistered */
+ /* in this case, we should skip it */
if (s != 1 && s != 5)
- goto out;
+ continue;

switch (vendor) {
case OFONO_VENDOR_HUAWEI:

Signature · 1 line
1.7.2.2
#1 lore raw

Hi Tonny,

Quoted 3 lines · Tonny Tzeng

This patch skip unsolicited CREG/CGREG correctly.

Please don't use Signed-off-by

Quoted 9 lines
---
 drivers/atmodem/atutil.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/atmodem/atutil.c +0 -0
index b6f0d92..2ca7b44 100644

drivers/atmodem/atutil.c gboolean at_util_parse_reg(GAtResult *result, const · line 250

Quoted 8 lines
drivers/atmodem/atutil.c +2 -1
@@ -244,8 +244,9 @@ gboolean at_util_parse_reg(GAtResult *result, const
 char *prefix,
 			continue;
 
 		/* Some firmware will report bogus lac/ci when unregistered */
+		/* in this case, we should skip it                          */
 		if (s != 1 && s != 5)
-			goto out;
+			continue;

And this fix is wrong. what this is doing is skipping the parsing of the lac/ci values if we're not registered / roaming. Using continue here will cause the parser to fail for those cases.

What you probably meant was continuing if the status was not between 1 and 5. But even that won't really help you if an lac of 1..5 is encountered ;)

drivers/atmodem/atutil.c gboolean at_util_parse_reg(GAtResult *result, const · line 252

Quoted 3 lines
drivers/atmodem/atutil.c +0 -0
 		switch (vendor) {
 		case OFONO_VENDOR_HUAWEI:

Regards,
-Denis

#2 lore raw

Hi Denis,

Thanks for reviewing.

Quoted 9 lines · Denis Kenzior
Quoted 5 lines

              /* Some firmware will report bogus lac/ci when unregistered */
+             /* in this case, we should skip it                          */ if (s != 1 && s != 5)
-                     goto out;
+                     continue;

And this fix is wrong.  what this is doing is skipping the parsing of the lac/ci values if we're not registered / roaming.  Using continue here will cause the parser to fail for those cases.

But if we jump to label 'out', this routine will return the wrong status code parsed from a unsolicited CREG/CGREG. For example, in my case, the real status value goes to the mode argument, and the status argument got lac value.

Since huawei modems send these strings without quotes, I think we need different logic to parse these values, for example, we may need a new function for testing whether there are more codes left?

Quoted 3 lines

What you probably meant was continuing if the status was not between 1 and 5.  But even that won't really help you if an lac of 1..5 is encountered ;)

Yes, you got my point, I will propose another way to avoid this. Thanks.

Best Regards,
Tonny