From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
---
plugins/calypso.c | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/plugins/calypso.c b/plugins/calypso.c
index a2d4ec8..e47cf19 100644
--- a/plugins/calypso.c
+++ b/plugins/calypso.c
@@ -57,6 +57,7 @@
#include <ofono/stk.h>
#include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
#define CALYPSO_POWER_PATH
"/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on"
#define CALYPSO_RESET_PATH "/sys/bus/platform/devices/neo1973-pm-gsm.0/reset"
@@ -518,14 +519,38 @@ static void calypso_pre_sim(struct ofono_modem *modem)
if (data->have_sim && data->sim)
ofono_stk_create(modem, 0, "calypsomodem", data->dlcs[AUX_DLC]);
- g_at_chat_send(data->dlcs[AUX_DLC], "AT+CFUN=1",
+ g_at_chat_send(data->dlcs[AUX_DLC], "AT+CFUN=1;+CFUN=4",
none_prefix, NULL, NULL, NULL);
if (data->have_sim && data->sim)
ofono_sim_inserted_notify(data->sim, TRUE);
}
-static void calypso_post_sim(struct ofono_modem *modem)
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_modem_online_cb_t cb = cbd->cb;
+
+ if (ok)
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ else
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+}
+
+static void calypso_set_online(struct ofono_modem *modem, ofono_bool_t online,
+ ofono_modem_online_cb_t cb, void *user_data)
+{
+ struct calypso_data *data = ofono_modem_get_data(modem);
+ struct cb_data *cbd = cb_data_new(cb, user_data);
+ char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
+ DBG("modem %p %s", modem, online ? "online" : "offline");
+
+ g_at_chat_send(data->dlcs[AUX_DLC], command, NULL,
+ set_online_cb, cbd, g_free);
+}
+
+static void calypso_post_online(struct ofono_modem *modem)
{
struct calypso_data *data = ofono_modem_get_data(modem);
struct ofono_message_waiting *mw;
@@ -553,8 +578,9 @@ static struct ofono_modem_driver calypso_driver = {
.remove = calypso_remove,
.enable = calypso_enable,
.disable = calypso_disable,
+ .set_online = calypso_set_online,
.pre_sim = calypso_pre_sim,
- .post_sim = calypso_post_sim,
+ .post_online = calypso_post_online,
};
static int calypso_init(void)
--
1.7.0.4
Show replies by thread