All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmodem: Add MBM/STE quirk for SIM record update
@ 2011-02-23  8:09 Miia Leinonen
  2011-02-28  7:22 ` Miia Leinonen
  2011-03-01 21:30 ` Denis Kenzior
  0 siblings, 2 replies; 5+ messages in thread
From: Miia Leinonen @ 2011-02-23  8:09 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3001 bytes --]

Fixed the <data> string to be set inside quotes for STE/MBM.

---

Hi,

This fix has been tested with STE modem only due the lack of MBM HW.

Would it be possible that someone checks this with MBM modem? The problem is 
likely to appear also there - therefore OFONO_VENDOR_MBM used. Could fix this 
also to cover all modems, but that might cause some backward compatibility 
issues.

BR,
Miia


 drivers/atmodem/sim.c |   59 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d9c0d8d..7a0100a 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -332,17 +332,34 @@ static void at_sim_update_record(struct ofono_sim *sim, int fileid,
 {
 	struct sim_data *sd = ofono_sim_get_data(sim);
 	struct cb_data *cbd = cb_data_new(cb, data);
-	char *buf = g_try_new(char, 36 + length * 2);
+	char *buf;
 	int len, ret;
 
-	if (buf == NULL)
-		goto error;
+	if (sd->vendor == OFONO_VENDOR_MBM) {
+		buf = g_try_new(char, 36 + 2 + length * 2);
 
-	len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid,
-			record, length);
+		if (buf == NULL)
+			goto error;
 
-	for (; length; length--)
-		len += sprintf(buf + len, "%02hhX", *value++);
+		len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,\"", fileid,
+					record, length);
+
+		for (; length; length--)
+			len += sprintf(buf + len, "%02hhX", *value++);
+
+		sprintf(buf + len, "\"");
+	} else {
+		buf = g_try_new(char, 36 + length * 2);
+
+		if (buf == NULL)
+			goto error;
+
+		len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid,
+				record, length);
+
+		for (; length; length--)
+			len += sprintf(buf + len, "%02hhX", *value++);
+	}
 
 	ret = g_at_chat_send(sd->chat, buf, crsm_prefix,
 				at_crsm_update_cb, cbd, g_free);
@@ -364,16 +381,32 @@ static void at_sim_update_cyclic(struct ofono_sim *sim, int fileid,
 {
 	struct sim_data *sd = ofono_sim_get_data(sim);
 	struct cb_data *cbd = cb_data_new(cb, data);
-	char *buf = g_try_new(char, 36 + length * 2);
+	char *buf;
 	int len, ret;
 
-	if (buf == NULL)
-		goto error;
+	if (sd->vendor == OFONO_VENDOR_MBM) {
+		buf = g_try_new(char, 36 + 2 + length * 2);
 
-	len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length);
+		if (buf == NULL)
+			goto error;
 
-	for (; length; length--)
-		len += sprintf(buf + len, "%02hhX", *value++);
+		len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,\"", fileid, length);
+
+		for (; length; length--)
+			len += sprintf(buf + len, "%02hhX", *value++);
+
+		sprintf(buf + len, "\"");
+	} else {
+		buf = g_try_new(char, 36 + length * 2);
+
+		if (buf == NULL)
+			goto error;
+
+		len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length);
+
+		for (; length; length--)
+			len += sprintf(buf + len, "%02hhX", *value++);
+	}
 
 	ret = g_at_chat_send(sd->chat, buf, crsm_prefix,
 				at_crsm_update_cb, cbd, g_free);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-03  4:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23  8:09 [PATCH] atmodem: Add MBM/STE quirk for SIM record update Miia Leinonen
2011-02-28  7:22 ` Miia Leinonen
2011-03-01 21:30 ` Denis Kenzior
2011-03-02 12:56   ` [PATCH v2] atmodem: Add MBM vendor " Miia Leinonen
2011-03-03  4:55     ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.