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/usock.c | 2 ++ src/gsmd/vendor_ti.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/gsmd') 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 */ -- cgit v1.2.3