[PATCH] Fix return empty currency for huawei EM770W

Zhenhua Zhang zhenhua.zhang at intel.com
Mon Jun 7 18:28:55 PDT 2010


Huawei EM770W responses empty "+CPUC: \r\n". So return empty currency
and zero ppuval.
---
 drivers/atmodem/call-meter.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 0553d78..74528ee 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -253,11 +253,19 @@ static void cpuc_query_cb(gboolean ok,
 	}
 
 	g_at_result_iter_next_string(&iter, &currency);
+
+	if (currency == NULL) {
+		memset(currency_buf, 0, sizeof(currency_buf));
+		ppuval = 0;
+		goto done;
+	}
+
 	strncpy(currency_buf, currency, sizeof(currency_buf));
 
 	g_at_result_iter_next_string(&iter, &ppu);
 	ppuval = strtod(ppu, NULL);
 
+done:
 	cb(&error, currency_buf, ppuval, cbd->data);
 }
 
-- 
1.6.3.3



More information about the ofono mailing list