summaryrefslogtreecommitdiff
path: root/src/gsmd
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-01 01:54:59 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-01 01:54:59 +0000
commitf07e7027fe91ac71a8ab760f863c3a05a1d1499d (patch)
treee8657fd1bbf18a0b9a6e71385e5dfd071321270f /src/gsmd
parented45d021e84b497e75ff4342ad369c615cc174a3 (diff)
gsmd: Modem power-up and -down result events.(Andrzej Zaborowski)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3544 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd')
-rw-r--r--src/gsmd/usock.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index 80165bf..cf3aea9 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -248,6 +248,7 @@ static int usock_rcv_pin(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
static int phone_powerup_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
{
struct gsmd_user *gu = ctx;
+ struct gsmd_ucmd *ucmd;
/* We need to verify if there is some error */
switch (cmd->ret) {
@@ -260,7 +261,29 @@ static int phone_powerup_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
gsmd_log(GSMD_DEBUG, "Radio power-up failed\n");
break;
}
- return 0;
+
+ ucmd = gsmd_ucmd_fill(sizeof(int), GSMD_MSG_PHONE,
+ GSMD_PHONE_POWERUP, 0);
+ if (ucmd) {
+ ((int *) ucmd->buf)[0] = cmd->ret;
+ usock_cmd_enqueue(ucmd, gu);
+ return 0;
+ }
+ return -ENOMEM;
+}
+
+static int phone_powerdown_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
+{
+ struct gsmd_user *gu = ctx;
+ struct gsmd_ucmd *ucmd = gsmd_ucmd_fill(sizeof(int), GSMD_MSG_PHONE,
+ GSMD_PHONE_POWERDOWN, 0);
+
+ if (ucmd) {
+ ((int *) ucmd->buf)[0] = cmd->ret;
+ usock_cmd_enqueue(ucmd, gu);
+ return 0;
+ }
+ return -ENOMEM;
}
static int get_imsi_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
@@ -295,7 +318,7 @@ static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
case GSMD_PHONE_POWERDOWN:
cmd = atcmd_fill("AT+CFUN=0", 9+1,
- &null_cmd_cb, gu, 0, NULL);
+ &phone_powerdown_cb, gu, 0, NULL);
gu->gsmd->dev_state.on = 0;
break;
case GSMD_PHONE_GET_IMSI:
personal git repositories of Harald Welte. Your mileage may vary