Skip to contentSkip to conversation

Fix return empty currency for huawei EM770W

PATCH New Zhenhua Zhang 1 participant 1 message Jun 8, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix return empty currency for huawei EM770W

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(-)
drivers/atmodem/call-meter.c +8 -0
index 0553d78..74528ee 100644
@@ -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);
 }
 
Signature · 1 line
1.6.3.3