atutil: Don't try parsing lac/ci when unregistered
authorDenis Kenzior <denkenz@gmail.com>
Fri, 13 Aug 2010 23:29:42 +0000 (18:29 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Fri, 13 Aug 2010 23:29:42 +0000 (18:29 -0500)
drivers/atmodem/atutil.c

index e668602..f566237 100644 (file)
@@ -175,6 +175,10 @@ gboolean at_util_parse_reg_unsolicited(GAtResult *result, const char *prefix,
        if (g_at_result_iter_next_number(&iter, &s) == FALSE)
                return FALSE;
 
+       /* Some firmware will report bogus lac/ci when unregistered */
+       if (s != 1 && s != 5)
+               goto out;
+
        switch (vendor) {
        case OFONO_VENDOR_HUAWEI:
        case OFONO_VENDOR_NOVATEL:
@@ -240,6 +244,10 @@ gboolean at_util_parse_reg(GAtResult *result, const char *prefix,
                if (g_at_result_iter_next_number(&iter, &s) == FALSE)
                        continue;
 
+               /* Some firmware will report bogus lac/ci when unregistered */
+               if (s != 1 && s != 5)
+                       goto out;
+
                switch (vendor) {
                case OFONO_VENDOR_HUAWEI:
                case OFONO_VENDOR_NOVATEL: