summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gsmd/gsmd.h1
-rw-r--r--include/libgsmd/misc.h1
-rw-r--r--src/gsmd/gsmd.c13
-rw-r--r--src/gsmd/usock.c3
4 files changed, 17 insertions, 1 deletions
diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h
index ff63b58..585d78d 100644
--- a/include/gsmd/gsmd.h
+++ b/include/gsmd/gsmd.h
@@ -91,6 +91,7 @@ struct gsmd {
unsigned int mlbuf_len;
int mlunsolicited;
int alive_responded;
+ char imsi[16]; /* imsi mem space */
};
struct gsmd_user {
diff --git a/include/libgsmd/misc.h b/include/libgsmd/misc.h
index 5ac9bdb..0dc22f8 100644
--- a/include/libgsmd/misc.h
+++ b/include/libgsmd/misc.h
@@ -36,6 +36,7 @@ extern int lgsm_signal_quality(struct lgsm_handle *h);
/* Operator Selection, Network Registration */
extern int lgsm_oper_get(struct lgsm_handle *lh);
+extern int lgsm_oper_n_get(struct lgsm_handle *lh);
extern int lgsm_opers_get(struct lgsm_handle *lh);
extern int lgsm_netreg_register(struct lgsm_handle *lh,
gsmd_oper_numeric oper);
diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c
index f5525a6..fdd33de 100644
--- a/src/gsmd/gsmd.c
+++ b/src/gsmd/gsmd.c
@@ -147,6 +147,16 @@ static int gsmd_test_atcb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
return 0;
}
+static int gsmd_get_imsi_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
+{
+ struct gsmd *g = ctx;
+
+ DEBUGP("imsi : %s\n", resp);
+ strcpy(g->imsi, resp);
+
+ return 0;
+}
+
int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt)
{
struct gsmd_atcmd *cmd;
@@ -178,6 +188,9 @@ static int gsmd_initsettings2(struct gsmd *gsmd)
/* configure message format as PDU mode*/
/* FIXME: TEXT mode support!! */
rc |= gsmd_simplecmd(gsmd, "AT+CMGF=0");
+ /* reueset imsi */
+ atcmd_submit(gsmd, atcmd_fill("AT+CIMI", 7+1,
+ &gsmd_get_imsi_cb, gsmd, 0, NULL));
sms_cb_init(gsmd);
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index 18c6662..0164c1c 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -638,7 +638,8 @@ static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
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);
+ return gsmd_ucmd_submit(gu, GSMD_MSG_PHONE, GSMD_PHONE_GET_IMSI,
+ 0, strlen(gu->gsmd->imsi), gu->gsmd->imsi);
break;
default:
personal git repositories of Harald Welte. Your mileage may vary