summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sim.h6
-rw-r--r--src/sim.c19
2 files changed, 24 insertions, 1 deletions
diff --git a/include/sim.h b/include/sim.h
index 8b5ff659..3e135640 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -104,6 +104,10 @@ typedef void (*ofono_sim_iccid_cb_t)(const struct ofono_error *error,
typedef void (*ofono_sim_imsi_cb_t)(const struct ofono_error *error,
const char *imsi, void *data);
+typedef void (*ofono_sim_mccmnc_cb_t)(const struct ofono_error *error,
+ const char *mcc, const char *mnc,
+ void *data);
+
typedef void (*ofono_sim_state_event_cb_t)(enum ofono_sim_state new_state,
void *data);
@@ -157,6 +161,8 @@ struct ofono_sim_driver {
ofono_sim_iccid_cb_t cb, void *data);
void (*read_imsi)(struct ofono_sim *sim,
ofono_sim_imsi_cb_t cb, void *data);
+ void (*read_mccmnc)(struct ofono_sim *sim,
+ ofono_sim_mccmnc_cb_t cb, void *data);
void (*query_passwd_state)(struct ofono_sim *sim,
ofono_sim_passwd_cb_t cb, void *data);
void (*send_passwd)(struct ofono_sim *sim, const char *passwd,
diff --git a/src/sim.c b/src/sim.c
index 3d4eece4..afb94ff2 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1721,6 +1721,20 @@ static void sim_cphs_information_read_cb(int ok, int length, int record,
memcpy(sim->cphs_service_table, data + 1, 2);
}
+static void sim_mccmnc_cb(const struct ofono_error *error,
+ const char *mcc, const char *mnc, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
+ return;
+
+ if (!mcc || !mnc)
+ return;
+
+ sim->mnc_length = strlen(mnc);
+}
+
static void sim_ad_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -1728,8 +1742,11 @@ static void sim_ad_read_cb(int ok, int length, int record,
struct ofono_sim *sim = userdata;
int new_mnc_length;
- if (!ok)
+ if (!ok) {
+ if (sim->driver->read_mccmnc)
+ sim->driver->read_mccmnc(sim, sim_mccmnc_cb, sim);
return;
+ }
if (length < 4)
return;