summaryrefslogtreecommitdiff
path: root/src/gsmd
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-11-27 08:24:57 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-11-27 08:24:57 +0000
commited45d021e84b497e75ff4342ad369c615cc174a3 (patch)
tree48da3b00a6f6c55e523ee9724b24eb3e7720a802 /src/gsmd
parenta78ac8ad867bb77c6bce88e66879e7afa8474301 (diff)
gsmd: Refactorying get_imsi from PHONEBOOK to PHONE (tick)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3519 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd')
-rw-r--r--src/gsmd/usock.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index 0b81306..80165bf 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -263,6 +263,25 @@ static int phone_powerup_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
return 0;
}
+static int get_imsi_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
+{
+ struct gsmd_user *gu = ctx;
+ struct gsmd_ucmd *ucmd;
+
+ DEBUGP("resp: %s\n", resp);
+
+ ucmd = gsmd_ucmd_fill(strlen(resp)+1, GSMD_MSG_PHONE,
+ GSMD_PHONE_GET_IMSI, 0);
+ if (!ucmd)
+ return -ENOMEM;
+
+ strcpy(ucmd->buf, resp);
+
+ usock_cmd_enqueue(ucmd, gu);
+
+ return 0;
+}
+
static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
int len)
{
@@ -279,9 +298,14 @@ static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
&null_cmd_cb, gu, 0, NULL);
gu->gsmd->dev_state.on = 0;
break;
+ case GSMD_PHONE_GET_IMSI:
+ cmd = atcmd_fill("AT+CIMI", 7 + 1, &get_imsi_cb, gu, 0, NULL);
+ break;
+
default:
return -EINVAL;
}
+
if (!cmd)
return -ENOMEM;
@@ -961,25 +985,6 @@ static int phonebook_list_storage_cb(struct gsmd_atcmd *cmd,
return 0;
}
-static int get_imsi_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
-{
- struct gsmd_user *gu = ctx;
- struct gsmd_ucmd *ucmd;
-
- DEBUGP("resp: %s\n", resp);
-
- ucmd = gsmd_ucmd_fill(strlen(resp)+1, GSMD_MSG_PHONEBOOK,
- GSMD_PHONEBOOK_GET_IMSI, 0);
- if (!ucmd)
- return -ENOMEM;
-
- strcpy(ucmd->buf, resp);
-
- usock_cmd_enqueue(ucmd, gu);
-
- return 0;
-}
-
static int usock_rcv_phonebook(struct gsmd_user *gu,
struct gsmd_msg_hdr *gph,int len)
@@ -1156,9 +1161,6 @@ static int usock_rcv_phonebook(struct gsmd_user *gu,
usock_cmd_enqueue(ucmd, gu);
break;
- case GSMD_PHONEBOOK_GET_IMSI:
- cmd = atcmd_fill("AT+CIMI", 7 + 1, &get_imsi_cb, gu, 0, NULL);
- break;
default:
return -EINVAL;
personal git repositories of Harald Welte. Your mileage may vary