diff options
author | Denis Kenzior <denkenz@gmail.com> | 2012-11-23 07:21:46 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-11-23 07:22:25 -0600 |
commit | 2528b74491403864163d52a96be19aa543e8b5ab (patch) | |
tree | 22fb2269d782be9ac5499275b303a4404e94c743 /drivers/atmodem/sim.c | |
parent | 291f4e0bb0e8b03d97bebfe2f871ae16ce0cbdd1 (diff) |
atmodem: Always quote data in CRSM write operations
Diffstat (limited to 'drivers/atmodem/sim.c')
-rw-r--r-- | drivers/atmodem/sim.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c index 4f241ac2..986a8189 100644 --- a/drivers/atmodem/sim.c +++ b/drivers/atmodem/sim.c @@ -346,37 +346,22 @@ static void at_sim_update_file(struct ofono_sim *sim, int cmd, int fileid, struct sim_data *sd = ofono_sim_get_data(sim); struct cb_data *cbd = cb_data_new(cb, data); char *buf; - gboolean quote = FALSE; int len, ret; - int size = 36 + p3 * 2; + int size = 38 + p3 * 2; DBG(""); - /* Add quotes */ - switch (sd->vendor) { - case OFONO_VENDOR_MBM: - case OFONO_VENDOR_ZTE: - case OFONO_VENDOR_HUAWEI: - case OFONO_VENDOR_SPEEDUP: - quote = TRUE; - size += 2; - break; - } - buf = g_try_new(char, size); if (buf == NULL) goto error; - len = sprintf(buf, "AT+CRSM=%i,%i,%i,%i,%i,", cmd, fileid,p1, p2, p3); - - if (quote) - buf[len++] = '\"'; + len = sprintf(buf, "AT+CRSM=%i,%i,%i,%i,%i,\"", cmd, fileid,p1, p2, p3); for (; p3; p3--) len += sprintf(buf + len, "%02hhX", *value++); - if (quote) - buf[len++] = '\"'; + buf[len++] = '\"'; + buf[len] = '\0'; ret = g_at_chat_send(sd->chat, buf, crsm_prefix, at_crsm_update_cb, cbd, g_free); |