r3309 - in trunk/src/target/gsm: include/gsmd include/libgsmd src/gsmd src/libgsmd src/util
tick at sita.openmoko.org
tick at sita.openmoko.org
Wed Oct 31 07:43:06 CET 2007
Author: tick
Date: 2007-10-31 07:42:58 +0100 (Wed, 31 Oct 2007)
New Revision: 3309
Modified:
trunk/src/target/gsm/include/gsmd/usock.h
trunk/src/target/gsm/include/libgsmd/phonebook.h
trunk/src/target/gsm/src/gsmd/usock.c
trunk/src/target/gsm/src/libgsmd/libgsmd_phonebook.c
trunk/src/target/gsm/src/util/shell.c
Log:
gsmd: Adding IMSI support (Jim Rayner)
Modified: trunk/src/target/gsm/include/gsmd/usock.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/usock.h 2007-10-31 06:41:45 UTC (rev 3308)
+++ trunk/src/target/gsm/include/gsmd/usock.h 2007-10-31 06:42:58 UTC (rev 3309)
@@ -249,6 +249,7 @@
GSMD_PHONEBOOK_SET_STORAGE = 8,
GSMD_PHONEBOOK_RETRIEVE_READRG = 9,
GSMD_PHONEBOOK_RETRIEVE_FIND = 10,
+ GSMD_PHONEBOOK_GET_IMSI = 11,
};
/* Type-of-Address, Numbering-Plan-Identification field, GSM 03.40, 9.1.2.5 */
Modified: trunk/src/target/gsm/include/libgsmd/phonebook.h
===================================================================
--- trunk/src/target/gsm/include/libgsmd/phonebook.h 2007-10-31 06:41:45 UTC (rev 3308)
+++ trunk/src/target/gsm/include/libgsmd/phonebook.h 2007-10-31 06:42:58 UTC (rev 3309)
@@ -112,4 +112,7 @@
/* Retrieve the records of FIND request */
extern int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num);
+/* Retrieve IMSI information */
+extern int lgsm_get_imsi(struct lgsm_handle *lh); // TODO this needs to go into a SIM specific file
+
#endif
Modified: trunk/src/target/gsm/src/gsmd/usock.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/usock.c 2007-10-31 06:41:45 UTC (rev 3308)
+++ trunk/src/target/gsm/src/gsmd/usock.c 2007-10-31 06:42:58 UTC (rev 3309)
@@ -1317,6 +1317,26 @@
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 @@
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;
}
Modified: trunk/src/target/gsm/src/libgsmd/libgsmd_phonebook.c
===================================================================
--- trunk/src/target/gsm/src/libgsmd/libgsmd_phonebook.c 2007-10-31 06:41:45 UTC (rev 3308)
+++ trunk/src/target/gsm/src/libgsmd/libgsmd_phonebook.c 2007-10-31 06:42:58 UTC (rev 3309)
@@ -223,3 +223,9 @@
return 0;
}
+
+int lgsm_get_imsi(struct lgsm_handle *lh)
+{
+ return lgsm_send_simple(lh, GSMD_MSG_PHONEBOOK, GSMD_PHONEBOOK_GET_IMSI);
+}
+
Modified: trunk/src/target/gsm/src/util/shell.c
===================================================================
--- trunk/src/target/gsm/src/util/shell.c 2007-10-31 06:41:45 UTC (rev 3308)
+++ trunk/src/target/gsm/src/util/shell.c 2007-10-31 06:42:58 UTC (rev 3309)
@@ -128,6 +128,10 @@
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 @@
"\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 @@
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);
}
More information about the commitlog
mailing list