diff options
author | tick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-10-31 06:42:58 +0000 |
---|---|---|
committer | tick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-10-31 06:42:58 +0000 |
commit | df2acb0b0e907082be5157b326a063c3387107f9 (patch) | |
tree | 14f6c95a534034eb55217dcf4c0f7bc3e875265d /src | |
parent | 68f58c51e268a2301cc933288e693fbf7c6325b7 (diff) |
gsmd: Adding IMSI support (Jim Rayner)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3309 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src')
-rw-r--r-- | src/gsmd/usock.c | 25 | ||||
-rw-r--r-- | src/libgsmd/libgsmd_phonebook.c | 6 | ||||
-rw-r--r-- | src/util/shell.c | 8 |
3 files changed, 39 insertions, 0 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c index a07fd6f..5b7edd4 100644 --- a/src/gsmd/usock.c +++ b/src/gsmd/usock.c @@ -1317,6 +1317,26 @@ 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) { @@ -1491,6 +1511,11 @@ 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); + break; + default: return -EINVAL; } diff --git a/src/libgsmd/libgsmd_phonebook.c b/src/libgsmd/libgsmd_phonebook.c index 1f59e34..2c5664b 100644 --- a/src/libgsmd/libgsmd_phonebook.c +++ b/src/libgsmd/libgsmd_phonebook.c @@ -223,3 +223,9 @@ int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num) return 0; } + +int lgsm_get_imsi(struct lgsm_handle *lh) +{ + return lgsm_send_simple(lh, GSMD_MSG_PHONEBOOK, GSMD_PHONEBOOK_GET_IMSI); +} + diff --git a/src/util/shell.c b/src/util/shell.c index 096b2cf..0e77c44 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -128,6 +128,10 @@ static int pb_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) nFIND = 0; break; + case GSMD_PHONEBOOK_GET_IMSI: + payload = (char *)gmh + sizeof(*gmh); + printf("imsi <%s>\n", payload); + break; default: return -EINVAL; } @@ -363,6 +367,7 @@ static int shell_help(void) "\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n" "\tsc\tSMS Show Service Centre\n" "\tsC\tSMS Set Service Centre (sC=number)\n" + "\tim\tGet imsi\n" "\tq\tQuit\n" ); } @@ -629,6 +634,9 @@ int shell_main(struct lgsm_handle *lgsmh) lgsm_sms_set_smsc(lgsmh, ptr + 1); } else if (!strcmp(buf, "n")) { lgsm_get_subscriber_num(lgsmh); + } else if (!strncmp(buf, "im", 2)) { + printf("Get imsi\n"); + lgsm_get_imsi(lgsmh); } else { printf("Unknown command `%s'\n", buf); } |