All of lore.kernel.org
 help / color / mirror / Atom feed
* [online PATCH 0/9] implement Online properties
@ 2010-08-24 11:31 Pekka.Pessi
  2010-08-24 11:31 ` [online PATCH 1/9] atgen: implement Online property Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Hi all,

Here are online implementation for a few more modem drivers. All of them
might not make sense (if the modem does not support AT+CFUN=4, for
instance).

I have not tested these patches with more exotic hardware. There might be
some common caveats.  E.g., if the modem does to wake up with AT+CFUN=4, it
might work with an initial cfun command like "AT+CFUN=1 ; +CFUN=4". At least
Calypso requires such an initialization command.

--Pekka


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [online PATCH 1/9] atgen: implement Online property
  2010-08-24 11:31 [online PATCH 0/9] implement Online properties Pekka.Pessi
@ 2010-08-24 11:31 ` Pekka.Pessi
  2010-08-24 11:31   ` [online PATCH 2/9] g1: " Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2777 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/atgen.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/plugins/atgen.c b/plugins/atgen.c
index a6eee60..600dbaa 100644
--- a/plugins/atgen.c
+++ b/plugins/atgen.c
@@ -49,6 +49,7 @@
 #include <ofono/ussd.h>
 #include <ofono/voicecall.h>
 
+#include <drivers/atmodem/atutil.h>
 #include <drivers/atmodem/sim-poll.h>
 
 #include <ofono/gprs.h>
@@ -154,11 +155,36 @@ static int atgen_disable(struct ofono_modem *modem)
 
 	ofono_modem_set_data(modem, NULL);
 
+	g_at_chat_send(chat, "AT+CFUN=4", NULL, NULL, NULL, NULL);
+
 	g_at_chat_unref(chat);
 
 	return 0;
 }
 
+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 atgen_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	GAtChat *chat = 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(chat, command, NULL, set_online_cb, cbd, g_free);
+}
+
 static void atgen_pre_sim(struct ofono_modem *modem)
 {
 	GAtChat *chat = ofono_modem_get_data(modem);
@@ -177,6 +203,15 @@ static void atgen_pre_sim(struct ofono_modem *modem)
 static void atgen_post_sim(struct ofono_modem *modem)
 {
 	GAtChat *chat = ofono_modem_get_data(modem);
+
+	DBG("%p", modem);
+
+	ofono_phonebook_create(modem, 0, "atmodem", chat);
+}
+
+static void atgen_post_online(struct ofono_modem *modem)
+{
+	GAtChat *chat = ofono_modem_get_data(modem);
 	struct ofono_message_waiting *mw;
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
@@ -191,7 +226,6 @@ static void atgen_post_sim(struct ofono_modem *modem)
 	ofono_call_barring_create(modem, 0, "atmodem", chat);
 	ofono_ssn_create(modem, 0, "atmodem", chat);
 	ofono_sms_create(modem, 0, "atmodem", chat);
-	ofono_phonebook_create(modem, 0, "atmodem", chat);
 	gprs = ofono_gprs_create(modem,0, "atmodem", chat);
 	gc = ofono_gprs_context_create(modem, 0, "atmodem", chat);
 	if (gprs && gc)
@@ -208,8 +242,10 @@ static struct ofono_modem_driver atgen_driver = {
 	.remove		= atgen_remove,
 	.enable		= atgen_enable,
 	.disable	= atgen_disable,
+	.set_online     = atgen_set_online,
 	.pre_sim	= atgen_pre_sim,
 	.post_sim	= atgen_post_sim,
+	.post_online	= atgen_post_online,
 };
 
 static int atgen_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 2/9] g1: implement Online property
  2010-08-24 11:31 ` [online PATCH 1/9] atgen: implement Online property Pekka.Pessi
@ 2010-08-24 11:31   ` Pekka.Pessi
  2010-08-24 11:31     ` [online PATCH 3/9] hso: " Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/g1.c |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/plugins/g1.c b/plugins/g1.c
index fa96eb1..8c04117 100644
--- a/plugins/g1.c
+++ b/plugins/g1.c
@@ -49,6 +49,7 @@
 #include <ofono/voicecall.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 static void g1_debug(const char *str, void *data)
 {
@@ -120,7 +121,7 @@ static int g1_enable(struct ofono_modem *modem)
 	g_at_chat_send(chat, "ATE0Q0V1", NULL, NULL, NULL, NULL);
 
 	/* power up modem */
-	g_at_chat_send(chat, "AT+CFUN=1", NULL, cfun_set_on_cb, modem, NULL);
+	g_at_chat_send(chat, "AT+CFUN=4", NULL, cfun_set_on_cb, modem, NULL);
 
 	return 0;
 }
@@ -168,7 +169,30 @@ static void g1_pre_sim(struct ofono_modem *modem)
 		ofono_sim_inserted_notify(sim, TRUE);
 }
 
-static void g1_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 g1_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	GAtChat *chat = 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(chat, command, NULL, set_online_cb, cbd, g_free);
+}
+
+static void g1_post_online(struct ofono_modem *modem)
 {
 	GAtChat *chat = ofono_modem_get_data(modem);
 	struct ofono_message_waiting *mw;
@@ -196,8 +220,9 @@ static struct ofono_modem_driver g1_driver = {
 	.remove		= g1_remove,
 	.enable		= g1_enable,
 	.disable	= g1_disable,
+	.set_online     = g1_set_online,
 	.pre_sim	= g1_pre_sim,
-	.post_sim	= g1_post_sim,
+	.post_online	= g1_post_online,
 };
 
 static int g1_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 3/9] hso: implement Online property
  2010-08-24 11:31   ` [online PATCH 2/9] g1: " Pekka.Pessi
@ 2010-08-24 11:31     ` Pekka.Pessi
  2010-08-24 11:31       ` [online PATCH 4/9] huawei: " Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/hso.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/plugins/hso.c b/plugins/hso.c
index 8611e07..7433a7b 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -46,6 +46,7 @@
 #include <ofono/log.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 static const char *none_prefix[] = { NULL };
 
@@ -172,7 +173,7 @@ static int hso_enable(struct ofono_modem *modem)
 	g_at_chat_send(data->control, "ATE0", none_prefix, NULL, NULL, NULL);
 	g_at_chat_send(data->app, "ATE0", none_prefix, NULL, NULL, NULL);
 
-	g_at_chat_send(data->control, "AT+CFUN=1", none_prefix,
+	g_at_chat_send(data->control, "AT+CFUN=4", none_prefix,
 					cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
@@ -213,6 +214,30 @@ static int hso_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 hso_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct hso_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->control, command, NULL,
+			set_online_cb, cbd, g_free);
+}
+
 static void hso_pre_sim(struct ofono_modem *modem)
 {
 	struct hso_data *data = ofono_modem_get_data(modem);
@@ -228,7 +253,7 @@ static void hso_pre_sim(struct ofono_modem *modem)
 		ofono_sim_inserted_notify(sim, TRUE);
 }
 
-static void hso_post_sim(struct ofono_modem *modem)
+static void hso_post_online(struct ofono_modem *modem)
 {
 	struct hso_data *data = ofono_modem_get_data(modem);
 	struct ofono_gprs *gprs;
@@ -260,8 +285,9 @@ static struct ofono_modem_driver hso_driver = {
 	.remove		= hso_remove,
 	.enable		= hso_enable,
 	.disable	= hso_disable,
+	.set_online     = hso_set_online,
 	.pre_sim	= hso_pre_sim,
-	.post_sim	= hso_post_sim,
+	.post_online	= hso_post_online,
 };
 
 static int hso_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 4/9] huawei: implement Online property
  2010-08-24 11:31     ` [online PATCH 3/9] hso: " Pekka.Pessi
@ 2010-08-24 11:31       ` Pekka.Pessi
  2010-08-24 11:32         ` [online PATCH 5/9] nokia: " Pekka.Pessi
  2010-08-24 16:20         ` [online PATCH 4/9] huawei: " Marcel Holtmann
  0 siblings, 2 replies; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3166 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/huawei.c |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/plugins/huawei.c b/plugins/huawei.c
index fc331ff..4869294 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -351,7 +351,7 @@ static int huawei_enable(struct ofono_modem *modem)
 
 	g_at_chat_send(data->pcui, "ATE0", none_prefix, NULL, NULL, NULL);
 
-	g_at_chat_send(data->pcui, "AT+CFUN=1", none_prefix,
+	g_at_chat_send(data->pcui, "AT+CFUN=4", none_prefix,
 					cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
@@ -395,6 +395,30 @@ static int huawei_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct huawei_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->pcui, command, NULL,
+			set_online_cb, cbd, g_free);
+}
+
 static void huawei_pre_sim(struct ofono_modem *modem)
 {
 	struct huawei_data *data = ofono_modem_get_data(modem);
@@ -414,15 +438,20 @@ static void huawei_pre_sim(struct ofono_modem *modem)
 static void huawei_post_sim(struct ofono_modem *modem)
 {
 	struct huawei_data *data = ofono_modem_get_data(modem);
-	struct ofono_netreg *netreg;
-	struct ofono_message_waiting *mw;
 
 	DBG("%p", modem);
 
-	if (data->sim_state == HUAWEI_SIM_STATE_INVALID_PS_AND_CS) {
-		ofono_phonebook_create(modem, 0, "atmodem", data->pcui);
+	ofono_phonebook_create(modem, 0, "atmodem", data->pcui);
+}
+
+static void huawei_post_online(struct ofono_modem *modem)
+{
+	struct huawei_data *data = ofono_modem_get_data(modem);
+	struct ofono_netreg *netreg;
+	struct ofono_message_waiting *mw;
+
+	if (data->sim_state == HUAWEI_SIM_STATE_INVALID_PS_AND_CS)
 		return;
-	}
 
 	netreg = ofono_netreg_create(modem, OFONO_VENDOR_HUAWEI, "atmodem",
 								data->pcui);
@@ -432,7 +461,6 @@ static void huawei_post_sim(struct ofono_modem *modem)
 						"atmodem", data->pcui);
 	ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
 						"atmodem", data->pcui);
-	ofono_phonebook_create(modem, 0, "atmodem", data->pcui);
 
 	if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
 			data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
@@ -464,8 +492,10 @@ static struct ofono_modem_driver huawei_driver = {
 	.remove		= huawei_remove,
 	.enable		= huawei_enable,
 	.disable	= huawei_disable,
+	.set_online     = huawei_set_online,
 	.pre_sim	= huawei_pre_sim,
 	.post_sim	= huawei_post_sim,
+	.post_online    = huawei_post_online,
 };
 
 static int huawei_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 5/9] nokia: implement Online property
  2010-08-24 11:31       ` [online PATCH 4/9] huawei: " Pekka.Pessi
@ 2010-08-24 11:32         ` Pekka.Pessi
  2010-08-24 11:32           ` [online PATCH 6/9] novatel: " Pekka.Pessi
  2010-08-24 16:21           ` [online PATCH 5/9] nokia: " Marcel Holtmann
  2010-08-24 16:20         ` [online PATCH 4/9] huawei: " Marcel Holtmann
  1 sibling, 2 replies; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/nokia.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/plugins/nokia.c b/plugins/nokia.c
index b7db2cc..f185d00 100644
--- a/plugins/nokia.c
+++ b/plugins/nokia.c
@@ -45,6 +45,7 @@
 #include <ofono/log.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 static const char *none_prefix[] = { NULL };
 
@@ -181,7 +182,7 @@ static int nokia_enable(struct ofono_modem *modem)
 	g_at_chat_send(data->control, "ATE0 +CMEE=1", none_prefix,
 						NULL, NULL, NULL);
 
-	g_at_chat_send(data->control, "AT+CFUN=1", none_prefix,
+	g_at_chat_send(data->control, "AT+CFUN=4", none_prefix,
 					cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
@@ -225,6 +226,30 @@ static int nokia_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 nokia_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct nokia_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->control, command, NULL,
+			set_online_cb, cbd, g_free);
+}
+
 static void nokia_pre_sim(struct ofono_modem *modem)
 {
 	struct nokia_data *data = ofono_modem_get_data(modem);
@@ -239,7 +264,7 @@ static void nokia_pre_sim(struct ofono_modem *modem)
 		ofono_sim_inserted_notify(sim, TRUE);
 }
 
-static void nokia_post_sim(struct ofono_modem *modem)
+static void nokia_post_online(struct ofono_modem *modem)
 {
 	struct nokia_data *data = ofono_modem_get_data(modem);
 
@@ -269,8 +294,9 @@ static struct ofono_modem_driver nokia_driver = {
 	.remove		= nokia_remove,
 	.enable		= nokia_enable,
 	.disable	= nokia_disable,
+	.set_online     = nokia_set_online,
 	.pre_sim	= nokia_pre_sim,
-	.post_sim	= nokia_post_sim,
+	.post_online	= nokia_post_online,
 };
 
 static int nokia_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 6/9] novatel: implement Online property
  2010-08-24 11:32         ` [online PATCH 5/9] nokia: " Pekka.Pessi
@ 2010-08-24 11:32           ` Pekka.Pessi
  2010-08-24 11:32             ` [online PATCH 7/9] palmpre: " Pekka.Pessi
  2010-08-24 16:21           ` [online PATCH 5/9] nokia: " Marcel Holtmann
  1 sibling, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2278 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/novatel.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/plugins/novatel.c b/plugins/novatel.c
index 38a6c3b..998ea59 100644
--- a/plugins/novatel.c
+++ b/plugins/novatel.c
@@ -156,7 +156,7 @@ static void nwdmat_action(gboolean ok, GAtResult *result, gpointer user_data)
 							NULL, NULL, NULL);
 
 done:
-	g_at_chat_send(data->primary, "AT+CFUN=1", none_prefix,
+	g_at_chat_send(data->primary, "AT+CFUN=4", none_prefix,
 						cfun_enable, modem, NULL);
 }
 
@@ -288,6 +288,33 @@ static int novatel_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 novatel_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct novatel_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");
+
+	if (!data->primary)
+		return;
+
+	g_at_chat_send(data->primary, command, NULL,
+			set_online_cb, cbd, g_free);
+}
+
 static void novatel_pre_sim(struct ofono_modem *modem)
 {
 	struct novatel_data *data = ofono_modem_get_data(modem);
@@ -309,7 +336,7 @@ static void novatel_pre_sim(struct ofono_modem *modem)
 		ofono_sim_inserted_notify(sim, TRUE);
 }
 
-static void novatel_post_sim(struct ofono_modem *modem)
+static void novatel_post_online(struct ofono_modem *modem)
 {
 	struct novatel_data *data = ofono_modem_get_data(modem);
 
@@ -351,8 +378,9 @@ static struct ofono_modem_driver novatel_driver = {
 	.remove		= novatel_remove,
 	.enable		= novatel_enable,
 	.disable	= novatel_disable,
+	.set_online     = novatel_set_online,
 	.pre_sim	= novatel_pre_sim,
-	.post_sim	= novatel_post_sim,
+	.post_online	= novatel_post_online,
 };
 
 static int novatel_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 7/9] palmpre: implement Online property
  2010-08-24 11:32           ` [online PATCH 6/9] novatel: " Pekka.Pessi
@ 2010-08-24 11:32             ` Pekka.Pessi
  2010-08-24 11:32               ` [online PATCH 8/9] ste: " Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3083 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/palmpre.c |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/plugins/palmpre.c b/plugins/palmpre.c
index 7d2aeb4..0963cb1 100644
--- a/plugins/palmpre.c
+++ b/plugins/palmpre.c
@@ -45,6 +45,7 @@
 #include <ofono/sms.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 struct palmpre_data {
 	GAtChat *chat;
@@ -132,7 +133,7 @@ static int palmpre_enable(struct ofono_modem *modem)
 	g_at_chat_send(data->chat, "ATZ E0 +CMEE=1", NULL, NULL, NULL, NULL);
 
 	/* Power modem up */
-	g_at_chat_send(data->chat, "AT+CFUN=1", NULL,
+	g_at_chat_send(data->chat, "AT+CFUN=4", NULL,
 			cfun_set_on_cb, modem, NULL);
 
 	return 0;
@@ -167,6 +168,30 @@ static int palmpre_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 palmpre_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct palmpre_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->chat, command, NULL,
+			set_online_cb, cbd, g_free);
+}
+
 static void palmpre_pre_sim(struct ofono_modem *modem)
 {
 	struct palmpre_data *data = ofono_modem_get_data(modem);
@@ -186,6 +211,14 @@ static void palmpre_pre_sim(struct ofono_modem *modem)
 static void palmpre_post_sim(struct ofono_modem *modem)
 {
 	struct palmpre_data *data = ofono_modem_get_data(modem);
+	DBG("%p", modem);
+
+	ofono_phonebook_create(modem, 0, "atmodem", data->chat);
+}
+
+static void palmpre_post_online(struct ofono_modem *modem)
+{
+	struct palmpre_data *data = ofono_modem_get_data(modem);
 	struct ofono_message_waiting *mw;
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
@@ -195,7 +228,6 @@ static void palmpre_post_sim(struct ofono_modem *modem)
 	ofono_netreg_create(modem, 0, "atmodem", data->chat);
 	ofono_sms_create(modem, OFONO_VENDOR_QUALCOMM_MSM, "atmodem",
 				data->chat);
-	ofono_phonebook_create(modem, 0, "atmodem", data->chat);
 
 	gprs = ofono_gprs_create(modem, 0, "atmodem", data->chat);
 	gc = ofono_gprs_context_create(modem, 0, "atmodem", data->chat);
@@ -214,8 +246,10 @@ static struct ofono_modem_driver palmpre_driver = {
 	.remove		= palmpre_remove,
 	.enable		= palmpre_enable,
 	.disable	= palmpre_disable,
+	.set_online     = palmpre_set_online,
 	.pre_sim	= palmpre_pre_sim,
-	.post_sim	= palmpre_post_sim
+	.post_sim	= palmpre_post_sim,
+	.post_online	= palmpre_post_online,
 };
 
 static int palmpre_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 8/9] ste: implement Online property
  2010-08-24 11:32             ` [online PATCH 7/9] palmpre: " Pekka.Pessi
@ 2010-08-24 11:32               ` Pekka.Pessi
  2010-08-24 11:32                 ` [online PATCH 9/9] zte: " Pekka.Pessi
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3387 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/ste.c |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/plugins/ste.c b/plugins/ste.c
index 63c36ce..f5f72a3 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -57,6 +57,8 @@
 #include <ofono/gprs-context.h>
 #include <ofono/radio-settings.h>
 #include <ofono/stk.h>
+
+#include <drivers/atmodem/atutil.h>
 #include <drivers/atmodem/vendor.h>
 
 #include <drivers/stemodem/caif_socket.h>
@@ -237,7 +239,7 @@ static int ste_enable(struct ofono_modem *modem)
 
 	g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
 			NULL, NULL, NULL, NULL);
-	g_at_chat_send(data->chat, "AT+CFUN=1", NULL, cfun_enable, modem, NULL);
+	g_at_chat_send(data->chat, "AT+CFUN=4", NULL, cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
 }
@@ -273,6 +275,29 @@ static int ste_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 ste_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct ste_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->chat, command, NULL, set_online_cb, cbd, g_free);
+}
+
 static void ste_pre_sim(struct ofono_modem *modem)
 {
 	struct ste_data *data = ofono_modem_get_data(modem);
@@ -291,13 +316,22 @@ static void ste_pre_sim(struct ofono_modem *modem)
 static void ste_post_sim(struct ofono_modem *modem)
 {
 	struct ste_data *data = ofono_modem_get_data(modem);
+
+	DBG("%p", modem);
+
+	ofono_stk_create(modem, 0, "mbmmodem", data->chat);
+	ofono_phonebook_create(modem, 0, "atmodem", data->chat);
+}
+
+static void ste_post_online(struct ofono_modem *modem)
+{
+	struct ste_data *data = ofono_modem_get_data(modem);
 	struct ofono_message_waiting *mw;
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
 
 	DBG("%p", modem);
 
-	ofono_stk_create(modem, 0, "mbmmodem", data->chat);
 	ofono_radio_settings_create(modem, 0, "stemodem", data->chat);
 	ofono_ussd_create(modem, 0, "atmodem", data->chat);
 	ofono_call_forwarding_create(modem, 0, "atmodem", data->chat);
@@ -307,7 +341,6 @@ static void ste_post_sim(struct ofono_modem *modem)
 	ofono_call_barring_create(modem, 0, "atmodem", data->chat);
 	ofono_ssn_create(modem, 0, "atmodem", data->chat);
 	ofono_sms_create(modem, 0, "atmodem", data->chat);
-	ofono_phonebook_create(modem, 0, "atmodem", data->chat);
 	ofono_call_volume_create(modem, 0, "atmodem", data->chat);
 
 	gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
@@ -329,8 +362,10 @@ static struct ofono_modem_driver ste_driver = {
 	.remove		= ste_remove,
 	.enable		= ste_enable,
 	.disable	= ste_disable,
+	.set_online     = ste_set_online,
 	.pre_sim	= ste_pre_sim,
 	.post_sim	= ste_post_sim,
+	.post_online    = ste_post_online,
 };
 
 static int ste_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [online PATCH 9/9] zte: implement Online property
  2010-08-24 11:32               ` [online PATCH 8/9] ste: " Pekka.Pessi
@ 2010-08-24 11:32                 ` Pekka.Pessi
  0 siblings, 0 replies; 12+ messages in thread
From: Pekka.Pessi @ 2010-08-24 11:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 plugins/zte.c |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/plugins/zte.c b/plugins/zte.c
index 7a8c9c7..1e22b47 100644
--- a/plugins/zte.c
+++ b/plugins/zte.c
@@ -46,6 +46,7 @@
 #include <ofono/log.h>
 
 #include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
 
 static const char *none_prefix[] = { NULL };
 
@@ -182,7 +183,7 @@ static int zte_enable(struct ofono_modem *modem)
 	g_at_chat_send(data->aux, "ATE0 +CMEE=1", none_prefix,
 						NULL, NULL, NULL);
 
-	g_at_chat_send(data->aux, "AT+CFUN=1", none_prefix,
+	g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
 					cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
@@ -226,6 +227,32 @@ static int zte_disable(struct ofono_modem *modem)
 	return -EINPROGRESS;
 }
 
+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 zte_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+	struct zte_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");
+
+	if (data->aux)
+		return;
+
+	g_at_chat_send(data->aux, command, NULL, set_online_cb, cbd, g_free);
+}
+
 static void zte_pre_sim(struct ofono_modem *modem)
 {
 	struct zte_data *data = ofono_modem_get_data(modem);
@@ -247,6 +274,15 @@ static void zte_post_sim(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
+	ofono_phonebook_create(modem, 0, "atmodem", data->aux);
+}
+
+static void zte_post_online(struct ofono_modem *modem)
+{
+	struct zte_data *data = ofono_modem_get_data(modem);
+
+	DBG("%p", modem);
+
 	ofono_netreg_create(modem, OFONO_VENDOR_ZTE, "atmodem", data->aux);
 
 	ofono_sms_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
@@ -255,8 +291,6 @@ static void zte_post_sim(struct ofono_modem *modem)
 					"atmodem", data->aux);
 	ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
 					"atmodem", data->aux);
-	ofono_phonebook_create(modem, 0, "atmodem", data->aux);
-
 	data->gprs = ofono_gprs_create(modem, 0, "atmodem", data->aux);
 
 	data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
@@ -271,8 +305,10 @@ static struct ofono_modem_driver zte_driver = {
 	.remove		= zte_remove,
 	.enable		= zte_enable,
 	.disable	= zte_disable,
+	.set_online     = zte_set_online,
 	.pre_sim	= zte_pre_sim,
 	.post_sim	= zte_post_sim,
+	.post_online    = zte_post_online,
 };
 
 static int zte_init(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [online PATCH 4/9] huawei: implement Online property
  2010-08-24 11:31       ` [online PATCH 4/9] huawei: " Pekka.Pessi
  2010-08-24 11:32         ` [online PATCH 5/9] nokia: " Pekka.Pessi
@ 2010-08-24 16:20         ` Marcel Holtmann
  1 sibling, 0 replies; 12+ messages in thread
From: Marcel Holtmann @ 2010-08-24 16:20 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]

Hi Pekka,

> ---
>  plugins/huawei.c |   44 +++++++++++++++++++++++++++++++++++++-------
>  1 files changed, 37 insertions(+), 7 deletions(-)
> 
> diff --git a/plugins/huawei.c b/plugins/huawei.c
> index fc331ff..4869294 100644
> --- a/plugins/huawei.c
> +++ b/plugins/huawei.c
> @@ -351,7 +351,7 @@ static int huawei_enable(struct ofono_modem *modem)
>  
>  	g_at_chat_send(data->pcui, "ATE0", none_prefix, NULL, NULL, NULL);
>  
> -	g_at_chat_send(data->pcui, "AT+CFUN=1", none_prefix,
> +	g_at_chat_send(data->pcui, "AT+CFUN=4", none_prefix,
>  					cfun_enable, modem, NULL);

this is exactly the one that doesn't work this way. You can't get from
CFUN=4 back into CFUN=1, but from CFUN=5 into CFUN=1. It seems that
Huawei has a few different online/offline modes and you can't switch as
you like. Only a few certain combination will work.

Regards

Marcel



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [online PATCH 5/9] nokia: implement Online property
  2010-08-24 11:32         ` [online PATCH 5/9] nokia: " Pekka.Pessi
  2010-08-24 11:32           ` [online PATCH 6/9] novatel: " Pekka.Pessi
@ 2010-08-24 16:21           ` Marcel Holtmann
  1 sibling, 0 replies; 12+ messages in thread
From: Marcel Holtmann @ 2010-08-24 16:21 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 981 bytes --]

Hi Pekka,

> ---
>  plugins/nokia.c |   32 +++++++++++++++++++++++++++++---
>  1 files changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/plugins/nokia.c b/plugins/nokia.c
> index b7db2cc..f185d00 100644
> --- a/plugins/nokia.c
> +++ b/plugins/nokia.c
> @@ -45,6 +45,7 @@
>  #include <ofono/log.h>
>  
>  #include <drivers/atmodem/vendor.h>
> +#include <drivers/atmodem/atutil.h>
>  
>  static const char *none_prefix[] = { NULL };
>  
> @@ -181,7 +182,7 @@ static int nokia_enable(struct ofono_modem *modem)
>  	g_at_chat_send(data->control, "ATE0 +CMEE=1", none_prefix,
>  						NULL, NULL, NULL);
>  
> -	g_at_chat_send(data->control, "AT+CFUN=1", none_prefix,
> +	g_at_chat_send(data->control, "AT+CFUN=4", none_prefix,
>  					cfun_enable, modem, NULL);
>  

I have to test this one. This modem is so crappy it is not funny
anymore. It most likely contains the most buggy Qualcomm firmware I have
seen so far :(

Regards

Marcel



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-08-24 16:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 11:31 [online PATCH 0/9] implement Online properties Pekka.Pessi
2010-08-24 11:31 ` [online PATCH 1/9] atgen: implement Online property Pekka.Pessi
2010-08-24 11:31   ` [online PATCH 2/9] g1: " Pekka.Pessi
2010-08-24 11:31     ` [online PATCH 3/9] hso: " Pekka.Pessi
2010-08-24 11:31       ` [online PATCH 4/9] huawei: " Pekka.Pessi
2010-08-24 11:32         ` [online PATCH 5/9] nokia: " Pekka.Pessi
2010-08-24 11:32           ` [online PATCH 6/9] novatel: " Pekka.Pessi
2010-08-24 11:32             ` [online PATCH 7/9] palmpre: " Pekka.Pessi
2010-08-24 11:32               ` [online PATCH 8/9] ste: " Pekka.Pessi
2010-08-24 11:32                 ` [online PATCH 9/9] zte: " Pekka.Pessi
2010-08-24 16:21           ` [online PATCH 5/9] nokia: " Marcel Holtmann
2010-08-24 16:20         ` [online PATCH 4/9] huawei: " Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.