From: Pekka Pessi <[email protected]>

---
 drivers/atmodem/sim.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 2f68b5f..1a6b1f4 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -856,6 +856,35 @@ error:
        CALLBACK_WITH_FAILURE(cb, -1, data);
 }
 
+static void at_enable_fdn(struct ofono_sim *sim,
+                               int enable, 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);
+       char buf[64];
+       int ret;
+
+       if (!cbd)
+               goto error;
+
+       snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"",
+                       "FD", enable ? 1 : 0, passwd);
+
+       ret = g_at_chat_send(sd->chat, buf, none_prefix,
+                               at_lock_unlock_cb, cbd, g_free);
+
+       memset(buf, 0, sizeof(buf));
+
+       if (ret > 0)
+               return;
+
+error:
+       g_free(cbd);
+
+       CALLBACK_WITH_FAILURE(cb, data);
+}
+
 static gboolean at_sim_register(gpointer user)
 {
        struct ofono_sim *sim = user;
@@ -923,6 +952,7 @@ static struct ofono_sim_driver driver = {
        .lock                   = at_pin_enable,
        .change_passwd          = at_change_passwd,
        .query_locked           = at_pin_query_enabled,
+       .enable_fdn             = at_enable_fdn,
 };
 
 void at_sim_init()
-- 
1.7.0.4

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

Reply via email to