diff options
author | Miia Leinonen <miia.leinonen@tieto.com> | 2011-03-02 14:56:52 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-03-02 22:53:35 -0600 |
commit | 2cb3027dd6c52f800e5905a74357c7e85e79d360 (patch) | |
tree | 7ed478533758a5aa7381c72b171e1829809fc2fd /drivers/atmodem | |
parent | a8e5f4d59c87bd99749576f523d8788f714fcf5a (diff) | |
download | ofono-2cb3027dd6c52f800e5905a74357c7e85e79d360.tar.bz2 |
atmodem: Add MBM vendor quirk for SIM record update
Diffstat (limited to 'drivers/atmodem')
-rw-r--r-- | drivers/atmodem/sim.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c index d9c0d8db..2690ab47 100644 --- a/drivers/atmodem/sim.c +++ b/drivers/atmodem/sim.c @@ -332,18 +332,29 @@ 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; + int size = 36 + length * 2; + + if (sd->vendor == OFONO_VENDOR_MBM) + size += 2; /*Add quotes*/ + buf = g_try_new(char, size); if (buf == NULL) goto error; len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid, record, length); + if (sd->vendor == OFONO_VENDOR_MBM) + len += sprintf(buf + len, "\""); + for (; length; length--) len += sprintf(buf + len, "%02hhX", *value++); + if (sd->vendor == OFONO_VENDOR_MBM) + sprintf(buf + len, "\""); + ret = g_at_chat_send(sd->chat, buf, crsm_prefix, at_crsm_update_cb, cbd, g_free); @@ -364,17 +375,28 @@ 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; + int size = 36 + length * 2; + + if (sd->vendor == OFONO_VENDOR_MBM) + size += 2; /* Add quotes */ + buf = g_try_new(char, size); if (buf == NULL) goto error; len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length); + if (sd->vendor == OFONO_VENDOR_MBM) + len += sprintf(buf + len, "\""); + for (; length; length--) len += sprintf(buf + len, "%02hhX", *value++); + if (sd->vendor == OFONO_VENDOR_MBM) + sprintf(buf + len, "\""); + ret = g_at_chat_send(sd->chat, buf, crsm_prefix, at_crsm_update_cb, cbd, g_free); |