diff options
-rw-r--r-- | src/gsmd/usock.c | 2 | ||||
-rw-r--r-- | src/gsmd/vendor_ti.c | 37 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c index 961f9a0..0337b5e 100644 --- a/src/gsmd/usock.c +++ b/src/gsmd/usock.c @@ -210,11 +210,13 @@ static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, case GSMD_PHONE_POWERUP: cmd = atcmd_fill("AT+CFUN=1", 9+1, &null_cmd_cb, gu, 0); + gu->gsmd->dev_state.on = 1; break; case GSMD_PHONE_POWERDOWN: cmd = atcmd_fill("AT+CFUN=0", 9+1, &null_cmd_cb, gu, 0); + gu->gsmd->dev_state.on = 0; break; default: return -EINVAL; diff --git a/src/gsmd/vendor_ti.c b/src/gsmd/vendor_ti.c index 892945c..e7c5433 100644 --- a/src/gsmd/vendor_ti.c +++ b/src/gsmd/vendor_ti.c @@ -101,7 +101,42 @@ out_free_io: static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd) { - /* FIXME: parse ciphering indication */ + char *tok1, *tok2; + + tok1 = strtok(buf, ","); + if (!tok1) + return -EIO; + + tok2 = strtok(NULL, ","); + if (!tok2) { + switch (atoi(tok1)) { + case 0: + gsmd->dev_state.ciph_ind.flags &= ~GSMD_CIPHIND_ACTIVE; + break; + case 1: + gsmd->dev_state.ciph_ind.flags |= GSMD_CIPHIND_ACTIVE; + break; + case 2: + gsmd->dev_state.ciph_ind.flags |= GSMD_CIPHIND_DISABLED_SIM; + break; + } + } else { + struct gsmd_evt_auxdata *aux; + struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, + GSMD_EVT_CIPHER, + sizeof(*aux)); + if (!ucmd) + return -ENOMEM; + + aux = (struct gsmd_evt_auxdata *) ucmd->buf; + + aux->u.cipher.net_state_gsm = atoi(tok1); + aux->u.cipher.net_state_gsm = atoi(tok2); + + usock_evt_send(gsmd, ucmd, GSMD_EVT_CIPHER); + } + + return 0; } /* Call Progress Information */ |