mirror of git://git.sysmocom.de/ofono
atmodem: Fix CPUC parser
Apparently some modems are extra stupid: AT+CPUC?\r \r\n+CPUC: \r\nOK\r\n So if we fail to parse the response, return an error
This commit is contained in:
parent
719842ea39
commit
1d8bb1bab6
|
@ -247,18 +247,24 @@ static void cpuc_query_cb(gboolean ok,
|
|||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
if (!g_at_result_iter_next(&iter, cbd->user)) {
|
||||
CALLBACK_WITH_FAILURE(cb, 0, 0, cbd->data);
|
||||
return;
|
||||
}
|
||||
if (g_at_result_iter_next(&iter, cbd->user) != TRUE)
|
||||
goto error;
|
||||
|
||||
if (g_at_result_iter_next_string(&iter, ¤cy) != TRUE)
|
||||
goto error;
|
||||
|
||||
g_at_result_iter_next_string(&iter, ¤cy);
|
||||
strncpy(currency_buf, currency, sizeof(currency_buf));
|
||||
|
||||
g_at_result_iter_next_string(&iter, &ppu);
|
||||
if (g_at_result_iter_next_string(&iter, &ppu) != TRUE)
|
||||
goto error;
|
||||
|
||||
ppuval = strtod(ppu, NULL);
|
||||
|
||||
cb(&error, currency_buf, ppuval, cbd->data);
|
||||
return;
|
||||
|
||||
error:
|
||||
CALLBACK_WITH_FAILURE(cb, 0, 0, cbd->data);
|
||||
}
|
||||
|
||||
static void at_cpuc_query(struct ofono_call_meter *cm,
|
||||
|
|
Loading…
Reference in New Issue