From aefa11c79415e696c41378ab7681dabbc28f0a7d Mon Sep 17 00:00:00 2001 From: laforge Date: Thu, 8 Mar 2007 21:48:59 +0000 Subject: * introduce ciphering indication parsing and event generation * stubs for volume control * add data structure resembing gsm device state git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1281 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/vendor_ti.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/gsmd/vendor_ti.c') 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 */ -- cgit v1.2.3