atmodem: Add MBM vendor quirk for SIM record update

This commit is contained in:
Miia Leinonen 2011-03-02 14:56:52 +02:00 committed by Denis Kenzior
parent a8e5f4d59c
commit 2cb3027dd6
1 changed files with 24 additions and 2 deletions

View File

@ -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);