atmodem: Fix issue with AT+CREG=? and AT+CGREG=? handling

Some modems might see an interim +CREG: or +CGREG: notification when
querying the supported modes.

  Aux: > AT+CFUN=1\r
  Aux: < \r\nOK\r\n
  Aux: > AT+CREG=?\r
  Aux: < \r\n+CREG: 2\r\n
  Aux: < \r\n+CREG: (0-2)\r\nOK\r\n
  Unable to initialize Network Registration

To make this work, skip to the first line with an actual range value.
This commit is contained in:
Marcel Holtmann 2012-05-24 03:28:50 +02:00
parent ce395cd818
commit 1f9f161e0b
2 changed files with 4 additions and 2 deletions

View File

@ -318,11 +318,12 @@ static void at_cgreg_test_cb(gboolean ok, GAtResult *result,
g_at_result_iter_init(&iter, result);
retry:
if (!g_at_result_iter_next(&iter, "+CGREG:"))
goto error;
if (!g_at_result_iter_open_list(&iter))
goto error;
goto retry;
while (g_at_result_iter_next_range(&iter, &range[0], &range[1])) {
if (1 >= range[0] && 1 <= range[1])

View File

@ -1556,11 +1556,12 @@ static void at_creg_test_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_init(&iter, result);
retry:
if (!g_at_result_iter_next(&iter, "+CREG:"))
goto error;
if (!g_at_result_iter_open_list(&iter))
goto error;
goto retry;
while (g_at_result_iter_next_range(&iter, &range[0], &range[1])) {
if (1 >= range[0] && 1 <= range[1])