summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-03-08 21:48:59 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-03-08 21:48:59 +0000
commitaefa11c79415e696c41378ab7681dabbc28f0a7d (patch)
treed19c5a51e216ddfb26d33f8446bb1fe47c9155a2
parente7ceefbeb06dc9592da3d58f59b7a80fdfa1d3ed (diff)
* 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
-rw-r--r--src/gsmd/usock.c2
-rw-r--r--src/gsmd/vendor_ti.c37
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 */
personal git repositories of Harald Welte. Your mileage may vary