---
 drivers/atmodem/sim.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 21bc933..44ecc1a 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -537,13 +537,16 @@ static gboolean at_epev_unregister(gpointer user_data)
 static void at_epev_notify(GAtResult *result, gpointer user_data)
 {
        struct cb_data *cbd = user_data;
-       struct sim_data *sd = cbd->user;
+       struct ofono_sim *sim = cbd->user;
+       struct sim_data *sd = ofono_sim_get_data(sim);
        ofono_sim_lock_unlock_cb_t cb = cbd->cb;
        struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
 
        if (sd->epev_source)
                return;
 
+       ofono_sim_ready_notify(sim);
+
        cb(&error, cbd->data);
 
        sd->epev_source = g_timeout_add(0, at_epev_unregister, sd);
@@ -553,7 +556,8 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
                                gpointer user_data)
 {
        struct cb_data *cbd = user_data;
-       struct sim_data *sd = cbd->user;
+       struct ofono_sim *sim = cbd->user;
+       struct sim_data *sd = ofono_sim_get_data(sim);
        ofono_sim_lock_unlock_cb_t cb = cbd->cb;
        struct ofono_error error;
 
@@ -590,15 +594,15 @@ static void at_lock_unlock_cb(gboolean ok, GAtResult 
*result,
 static void at_pin_send(struct ofono_sim *sim, const char *passwd,
                        ofono_sim_lock_unlock_cb_t cb, void *data)
 {
-       struct sim_data *sd = ofono_sim_get_data(sim);
        struct cb_data *cbd = cb_data_new(cb, data);
+       struct sim_data *sd = ofono_sim_get_data(sim);
        char buf[64];
        int ret;
 
        if (!cbd)
                goto error;
 
-       cbd->user = sd;
+       cbd->user = sim;
 
        snprintf(buf, sizeof(buf), "AT+CPIN=\"%s\"", passwd);
 
-- 
1.7.2.1

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to