Skip unsolicited CREG/CGREG correctly
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
@@ -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
Hi Tonny,
Quoted 3 lines · Tonny Tzeng
This patch skip unsolicited CREG/CGREG correctly.
Signed-off-by Tonny Tzeng <[email protected]>
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
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, constchar *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
-0switch (vendor) {case OFONO_VENDOR_HUAWEI :
Regards,
-Denis
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