All of lore.kernel.org
 help / color / mirror / Atom feed
* [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings
@ 2011-01-26 12:34 Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 1/5] gprs-provision: add driver API header Jukka Saunamaki
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

Hello

And again a patchset about automatic provisioning of GPRS context settings.

Since the safe reading of EF-SPN turned out to be impossible until general solution is implemented, I must temporary give up my insistence on it.

So the following provisioning driver API must be considered as provisional. 
When proper solution for SPN comes up, we should redesign the API. Without SPN, correct settings cannot be provisioned for all service providers, but at least for now most cases should work with just the MCC and MNC values provided with this API.


--Jukka


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

* [PATCH 1/5] gprs-provision: add driver API header
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
@ 2011-01-26 12:34 ` Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 2/5] ofono.h: add gprs-provision Jukka Saunamaki
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am              |    3 +-
 include/gprs-provision.h |   59 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletions(-)
 create mode 100644 include/gprs-provision.h

diff --git a/Makefile.am b/Makefile.am
index f941a19..f543135 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,8 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
 			include/radio-settings.h include/stk.h \
 			include/audio-settings.h include/nettime.h \
 			include/ctm.h include/cdma-voicecall.h \
-			include/cdma-sms.h include/sim-auth.h
+			include/cdma-sms.h include/sim-auth.h \
+			include/gprs-provision.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
diff --git a/include/gprs-provision.h b/include/gprs-provision.h
new file mode 100644
index 0000000..efde892
--- /dev/null
+++ b/include/gprs-provision.h
@@ -0,0 +1,59 @@
+/*
+ *
+ *  oFono - Open Telephony stack for Linux
+ *
+ *  Copyright (C) 2011  Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_GPRS_PROVISION_H
+#define __OFONO_GPRS_PROVISION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "gprs-context.h"
+
+struct ofono_gprs_provision_data {
+	enum ofono_gprs_context_type type;
+	enum ofono_gprs_proto proto;
+	char *name;
+	char *apn;
+	char *username;
+	char *password;
+	char *message_proxy;
+	char *message_center;
+};
+
+struct ofono_gprs_provision_driver {
+	const char *name;
+	int priority;
+	void (*get_settings)(const char *mcc, const char *mnc,
+				struct ofono_gprs_provision_data **settings,
+				int *count);
+};
+
+int ofono_gprs_provision_driver_register(
+			const struct ofono_gprs_provision_driver *driver);
+void ofono_gprs_provision_driver_unregister(
+			const struct ofono_gprs_provision_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_GPRS_PROVISION_H */
-- 
1.7.1


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

* [PATCH 2/5] ofono.h: add gprs-provision
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 1/5] gprs-provision: add driver API header Jukka Saunamaki
@ 2011-01-26 12:34 ` Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 3/5] gprs-provision: add driver API sources Jukka Saunamaki
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

---
 src/ofono.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index e48dbf6..056c7f1 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -420,3 +420,12 @@ void __ofono_nettime_info_received(struct ofono_modem *modem,
 
 #include <ofono/cdma-voicecall.h>
 #include <ofono/sim-auth.h>
+
+#include <ofono/gprs-provision.h>
+void __ofono_gprs_provision_get_settings(const char *mcc, const char *mnc,
+			struct ofono_gprs_provision_data **settings,
+			int *count);
+void __ofono_gprs_provision_free_settings(
+				struct ofono_gprs_provision_data *settings,
+				int count);
+
-- 
1.7.1


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

* [PATCH 3/5] gprs-provision: add driver API sources
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 1/5] gprs-provision: add driver API header Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 2/5] ofono.h: add gprs-provision Jukka Saunamaki
@ 2011-01-26 12:34 ` Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 4/5] gprs: add gprs context provisioning Jukka Saunamaki
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am          |    2 +-
 src/gprs-provision.c |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletions(-)
 create mode 100644 src/gprs-provision.c

diff --git a/Makefile.am b/Makefile.am
index f543135..9c4f383 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -356,7 +356,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
 			src/simfs.c src/simfs.h src/audio-settings.c \
 			src/smsagent.c src/smsagent.h src/ctm.c \
 			src/cdma-voicecall.c src/sim-auth.c \
-			src/message.h src/message.c
+			src/message.h src/message.c src/gprs-provision.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/gprs-provision.c b/src/gprs-provision.c
new file mode 100644
index 0000000..cc1f589
--- /dev/null
+++ b/src/gprs-provision.c
@@ -0,0 +1,104 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include "ofono.h"
+
+static GSList *g_drivers = NULL;
+
+void  __ofono_gprs_provision_free_settings(
+				struct ofono_gprs_provision_data *settings,
+				int count)
+{
+	int i;
+
+	for (i = 0; i < count; i++) {
+		g_free(settings[i].name);
+		g_free(settings[i].apn);
+		g_free(settings[i].username);
+		g_free(settings[i].password);
+		g_free(settings[i].message_proxy);
+		g_free(settings[i].message_center);
+	}
+
+	g_free(settings);
+}
+
+void __ofono_gprs_provision_get_settings(const char *mcc, const char *mnc,
+			struct ofono_gprs_provision_data **settings,
+			int *count)
+{
+	GSList *d;
+
+	*settings = NULL;
+	*count = 0;
+
+	if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0)
+		return;
+
+	for (d = g_drivers; d != NULL; d = d->next) {
+		const struct ofono_gprs_provision_driver *driver = d->data;
+
+		DBG("Calling provisioning plugin '%s'", driver->name);
+
+		driver->get_settings(mcc, mnc, settings, count);
+
+		if (*count > 0) {
+			DBG("Plugin '%s' returned %d context settings",
+				driver->name, *count);
+			return;
+		}
+
+		ofono_warn("Provisioning plugin '%s' returned no settings",
+			driver->name);
+	}
+}
+
+static gint compare_priority(gconstpointer a, gconstpointer b)
+{
+	const struct ofono_gprs_provision_driver *plugin1 = a;
+	const struct ofono_gprs_provision_driver *plugin2 = b;
+
+	return plugin2->priority - plugin1->priority;
+}
+
+int ofono_gprs_provision_driver_register(
+			const struct ofono_gprs_provision_driver *driver)
+{
+	DBG("driver: %p name: %s", driver, driver->name);
+
+	g_drivers = g_slist_insert_sorted(g_drivers, (void *) driver,
+						compare_priority);
+	return 0;
+}
+
+void ofono_gprs_provision_driver_unregister(
+			const struct ofono_gprs_provision_driver *driver)
+{
+	DBG("driver: %p name: %s", driver, driver->name);
+
+	g_drivers = g_slist_remove(g_drivers, driver);
+}
-- 
1.7.1


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

* [PATCH 4/5] gprs: add gprs context provisioning
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
                   ` (2 preceding siblings ...)
  2011-01-26 12:34 ` [PATCH 3/5] gprs-provision: add driver API sources Jukka Saunamaki
@ 2011-01-26 12:34 ` Jukka Saunamaki
  2011-01-26 12:34 ` [PATCH 5/5] gprs-provision: add example context provisioning driver Jukka Saunamaki
  2011-01-26 20:56 ` [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Denis Kenzior
  5 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

---
 src/gprs.c |   99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 92d0b1a..7fad23b 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -43,6 +43,8 @@
 #include "common.h"
 #include "storage.h"
 #include "idmap.h"
+#include "simutil.h"
+#include "util.h"
 
 #define GPRS_FLAG_ATTACHING 0x1
 #define GPRS_FLAG_RECHECK 0x2
@@ -2531,6 +2533,75 @@ remove:
 		storage_sync(imsi, SETTINGS_STORE, gprs->settings);
 }
 
+static void provision_context(const struct ofono_gprs_provision_data *ap,
+				struct ofono_gprs *gprs)
+{
+	unsigned int id;
+	struct pri_context *context = NULL;
+
+	/* Sanity check */
+	if (ap == NULL || ap->name == NULL)
+		return;
+
+	if (gprs->last_context_id)
+		id = idmap_alloc_next(gprs->pid_map, gprs->last_context_id);
+	else
+		id = idmap_alloc(gprs->pid_map);
+
+	if (id > idmap_get_max(gprs->pid_map))
+		return;
+
+	context = pri_context_create(gprs, ap->name, ap->type);
+	DBG("%s context%d '%s' %s", gprs_context_default_name(ap->type),
+		id, ap->name, context ? "created" : "creation failed");
+
+	if (context == NULL)
+		return;
+
+	context->id = id;
+
+	if (ap->username != NULL)
+		strncpy(context->context.username, ap->username,
+			OFONO_GPRS_MAX_USERNAME_LENGTH);
+
+	if (ap->password != NULL)
+		strncpy(context->context.password, ap->password,
+			OFONO_GPRS_MAX_PASSWORD_LENGTH);
+
+	if (ap->apn != NULL)
+		strncpy(context->context.apn, ap->apn,
+			OFONO_GPRS_MAX_APN_LENGTH);
+
+	context->context.proto = ap->proto;
+
+	if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS &&
+			ap->message_proxy != NULL)
+		strncpy(context->message_proxy, ap->message_proxy,
+			MAX_MESSAGE_PROXY_LENGTH);
+
+	if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS &&
+			ap->message_center != NULL)
+		strncpy(context->message_center, ap->message_center,
+			MAX_MESSAGE_CENTER_LENGTH);
+
+	if (context_dbus_register(context) == TRUE) {
+		gprs->last_context_id = id;
+		gprs->contexts = g_slist_append(gprs->contexts, context);
+		write_context_settings(gprs, context);
+
+		if (context->type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
+			g_key_file_set_string(gprs->settings, context->key,
+						"MessageProxy",
+						context->message_proxy);
+			g_key_file_set_string(gprs->settings, context->key,
+						"MessageCenter",
+						context->message_center);
+		}
+
+		storage_sync(gprs->imsi, SETTINGS_STORE, gprs->settings);
+	}
+}
+
 void ofono_gprs_register(struct ofono_gprs *gprs)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
@@ -2538,6 +2609,7 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
 	const char *path = __ofono_atom_get_path(gprs->atom);
 	struct ofono_atom *netreg_atom;
 	struct ofono_atom *sim_atom;
+	struct ofono_sim *sim = NULL;
 
 	if (!g_dbus_register_interface(conn, path,
 					OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -2555,14 +2627,33 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
 	sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
 
 	if (sim_atom) {
-		struct ofono_sim *sim = __ofono_atom_get_data(sim_atom);
-		const char *imsi = ofono_sim_get_imsi(sim);
+		const char *imsi;
 
+		sim = __ofono_atom_get_data(sim_atom);
+		imsi = ofono_sim_get_imsi(sim);
 		gprs_load_settings(gprs, imsi);
 	}
 
-	if (gprs->contexts == NULL)
-		add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
+	if (gprs->contexts == NULL) {
+		struct ofono_gprs_provision_data *settings = NULL;
+		int count = 0;
+		int i;
+
+		__ofono_gprs_provision_get_settings(ofono_sim_get_mcc(sim),
+							ofono_sim_get_mnc(sim),
+							&settings, &count);
+
+		if (count > 0) {
+			for (i = 0; i < count; i++)
+				provision_context(&settings[i], gprs);
+
+			__ofono_gprs_provision_free_settings(settings, count);
+		} else {
+			ofono_warn("Context settings provisioning failed");
+			add_context(gprs, NULL,
+					OFONO_GPRS_CONTEXT_TYPE_INTERNET);
+		}
+	}
 
 	gprs->netreg_watch = __ofono_modem_add_atom_watch(modem,
 					OFONO_ATOM_TYPE_NETREG,
-- 
1.7.1


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

* [PATCH 5/5] gprs-provision: add example context provisioning driver
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
                   ` (3 preceding siblings ...)
  2011-01-26 12:34 ` [PATCH 4/5] gprs: add gprs context provisioning Jukka Saunamaki
@ 2011-01-26 12:34 ` Jukka Saunamaki
  2011-01-26 20:56 ` [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Denis Kenzior
  5 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-26 12:34 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am          |    3 ++
 examples/provision.c |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 examples/provision.c

diff --git a/Makefile.am b/Makefile.am
index 9c4f383..c70dcbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -329,6 +329,9 @@ builtin_sources += examples/history.c
 
 builtin_modules += example_nettime
 builtin_sources += examples/nettime.c
+
+builtin_modules += example_provision
+builtin_sources += examples/provision.c
 endif
 
 builtin_modules += smart_messaging
diff --git a/examples/provision.c b/examples/provision.c
new file mode 100644
index 0000000..80688a4
--- /dev/null
+++ b/examples/provision.c
@@ -0,0 +1,95 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+
+#include <ofono/modem.h>
+#include <ofono/gprs-provision.h>
+#include <ofono/types.h>
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+
+static void example_provision_get_settings(const char *mcc, const char *mnc,
+				struct ofono_gprs_provision_data **settings,
+				int *count)
+{
+	ofono_debug("Provisioning...");
+	*count = 0;
+	*settings = NULL;
+
+	ofono_debug("Finding settings for MCC %s, MNC %s",
+			mcc, mnc);
+
+	if (strcmp(mcc, "246") != 0 || strcmp(mnc, "81") != 0)
+		return;
+
+	ofono_debug("Creating example settings for phonesim");
+
+	*settings = g_try_new0(struct ofono_gprs_provision_data, 2);
+	if (*settings == NULL)
+		return;
+
+	*count = 2;
+
+	/* Internet context settings */
+	(*settings)[0].proto = OFONO_GPRS_PROTO_IP;
+	(*settings)[0].type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
+	(*settings)[0].name = g_strdup("Phonesim Internet");
+	(*settings)[0].apn = g_strdup("internetapn");
+
+	/* MMS context settings */
+	(*settings)[1].proto = OFONO_GPRS_PROTO_IP;
+	(*settings)[1].type = OFONO_GPRS_CONTEXT_TYPE_MMS;
+	(*settings)[1].name = g_strdup("Phonesim MMS");
+	(*settings)[1].apn = g_strdup("mmsapn");
+	(*settings)[1].username = g_strdup("mmsuser");
+	(*settings)[1].password = g_strdup("mmspass");
+	(*settings)[1].message_proxy = g_strdup("10.11.12.13:8080");
+	(*settings)[1].message_center = g_strdup("http://mms.example.com:8000");
+}
+
+static struct ofono_gprs_provision_driver example_driver = {
+	.name		= "Example GPRS context provisioning",
+	.priority       = OFONO_PLUGIN_PRIORITY_LOW,
+	.get_settings	= example_provision_get_settings,
+};
+
+static int example_provision_init(void)
+{
+	return ofono_gprs_provision_driver_register(&example_driver);
+}
+
+static void example_provision_exit(void)
+{
+	ofono_gprs_provision_driver_unregister(&example_driver);
+}
+
+OFONO_PLUGIN_DEFINE(example_provision, "Example Provisioning Plugin",
+			VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT,
+			example_provision_init,
+			example_provision_exit)
-- 
1.7.1


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

* Re: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings
  2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
                   ` (4 preceding siblings ...)
  2011-01-26 12:34 ` [PATCH 5/5] gprs-provision: add example context provisioning driver Jukka Saunamaki
@ 2011-01-26 20:56 ` Denis Kenzior
  2011-01-27  6:41   ` Jukka Saunamaki
  5 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2011-01-26 20:56 UTC (permalink / raw)
  To: ofono

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

Hi Jukka,

On 01/26/2011 06:34 AM, Jukka Saunamaki wrote:
> Hello
> 
> And again a patchset about automatic provisioning of GPRS context settings.
> 
> Since the safe reading of EF-SPN turned out to be impossible until general solution is implemented, I must temporary give up my insistence on it.
> 
> So the following provisioning driver API must be considered as provisional. 
> When proper solution for SPN comes up, we should redesign the API. Without SPN, correct settings cannot be provisioned for all service providers, but at least for now most cases should work with just the MCC and MNC values provided with this API.
> 

I've applied all of your patches but have refactored them heavily
afterward.  Let me know if I broke anything.

Regards,
-Denis

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

* Re: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings
  2011-01-26 20:56 ` [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Denis Kenzior
@ 2011-01-27  6:41   ` Jukka Saunamaki
  2011-01-27  6:59     ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-27  6:41 UTC (permalink / raw)
  To: ofono

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

Hello Denis,

On Wed, 2011-01-26 at 14:56 -0600, ext Denis Kenzior wrote:
> > And again a patchset about automatic provisioning of GPRS context settings.
> > 
> > Since the safe reading of EF-SPN turned out to be impossible until general solution is implemented, I must temporary give up my insistence on it.
> > 
> > So the following provisioning driver API must be considered as provisional. 
> > When proper solution for SPN comes up, we should redesign the API. Without SPN, correct settings cannot be provisioned for all service providers, but at least for now most cases should work with just the MCC and MNC values provided with this API.
> > 
> 
> I've applied all of your patches but have refactored them heavily
> afterward.  Let me know if I broke anything.

Excellent. Seems to work OK, thanks.

So, now while waiting for some solution to SIM reading issue, I can
start looking at proper provisioning plugin. And looking forward to
interesting discussions regarding merits of various XML-file formats for
settings database...

--Jukka



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

* Re: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings
  2011-01-27  6:41   ` Jukka Saunamaki
@ 2011-01-27  6:59     ` Marcel Holtmann
  2011-01-27  7:00       ` Marcel Holtmann
  2011-01-27  7:21       ` EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings) Jukka Saunamaki
  0 siblings, 2 replies; 13+ messages in thread
From: Marcel Holtmann @ 2011-01-27  6:59 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

> > > And again a patchset about automatic provisioning of GPRS context settings.
> > > 
> > > Since the safe reading of EF-SPN turned out to be impossible until general solution is implemented, I must temporary give up my insistence on it.
> > > 
> > > So the following provisioning driver API must be considered as provisional. 
> > > When proper solution for SPN comes up, we should redesign the API. Without SPN, correct settings cannot be provisioned for all service providers, but at least for now most cases should work with just the MCC and MNC values provided with this API.
> > > 
> > 
> > I've applied all of your patches but have refactored them heavily
> > afterward.  Let me know if I broke anything.
> 
> Excellent. Seems to work OK, thanks.
> 
> So, now while waiting for some solution to SIM reading issue, I can
> start looking at proper provisioning plugin. And looking forward to
> interesting discussions regarding merits of various XML-file formats for
> settings database...

you can have a look on what it would take to store a) read SPN in the
SIM atom and store it and b) let netreg atom use that value.

Regards

Marcel



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

* Re: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings
  2011-01-27  6:59     ` Marcel Holtmann
@ 2011-01-27  7:00       ` Marcel Holtmann
  2011-01-27  7:21       ` EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings) Jukka Saunamaki
  1 sibling, 0 replies; 13+ messages in thread
From: Marcel Holtmann @ 2011-01-27  7:00 UTC (permalink / raw)
  To: ofono

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

Hi Jukka,

> Hi Denis,

I am still not fully up; meant to write "Hi Jukka" ;)

Regards

Marcel



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

* EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings)
  2011-01-27  6:59     ` Marcel Holtmann
  2011-01-27  7:00       ` Marcel Holtmann
@ 2011-01-27  7:21       ` Jukka Saunamaki
  2011-01-27  7:37         ` Marcel Holtmann
  1 sibling, 1 reply; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-27  7:21 UTC (permalink / raw)
  To: ofono

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

Hi Marcel,

> you can have a look on what it would take to store a) read SPN in the
> SIM atom and store it and b) let netreg atom use that value.

Simple solution for this would be something like:

During some SIM initialisation phase (at sim_ready()?), sim-atom
requests ofono_sim_read(SIM_EFSPN_FILEID).

For netreg (and gprs/provisioning) it would provide:
typedef void (*ofono_sim_spn_read_cb_t)(int ok, const char *spn,
					void *userdata);
void ofono_sim_read_spn(struct ofono_sim *sim, ofono_sim_spn_read_cb_t cb,
			void *userdata);

ofono_sim_read_spn would queue requests until SPN is received (and
immediately call callback if SPN is ready).


But this still would be asyncronous, which causes the problem in netreg
(and gprs/provisioning). Is there any way to delay netreg initialisation
until SPN is available (and are there other SIM files netreg reads)?

--Jukka



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

* Re: EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings)
  2011-01-27  7:21       ` EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings) Jukka Saunamaki
@ 2011-01-27  7:37         ` Marcel Holtmann
  2011-01-27  7:53           ` Jukka Saunamaki
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2011-01-27  7:37 UTC (permalink / raw)
  To: ofono

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

Hi Jukka,

> > you can have a look on what it would take to store a) read SPN in the
> > SIM atom and store it and b) let netreg atom use that value.
> 
> Simple solution for this would be something like:
> 
> During some SIM initialisation phase (at sim_ready()?), sim-atom
> requests ofono_sim_read(SIM_EFSPN_FILEID).
> 
> For netreg (and gprs/provisioning) it would provide:
> typedef void (*ofono_sim_spn_read_cb_t)(int ok, const char *spn,
> 					void *userdata);
> void ofono_sim_read_spn(struct ofono_sim *sim, ofono_sim_spn_read_cb_t cb,
> 			void *userdata);
> 
> ofono_sim_read_spn would queue requests until SPN is received (and
> immediately call callback if SPN is ready).

don't make this asynchronous. Just read the SPN and store it. Then it
can be easily accessed similar to MCC and MNC.

The GPRS atom and netreg for that matter will not be available before
the SIM atom has been fully initialized anyway.

If there is any race condition with this one, the we need to be really
really careful since it has a lot of consequences.

Regards

Marcel



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

* Re: EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings)
  2011-01-27  7:37         ` Marcel Holtmann
@ 2011-01-27  7:53           ` Jukka Saunamaki
  0 siblings, 0 replies; 13+ messages in thread
From: Jukka Saunamaki @ 2011-01-27  7:53 UTC (permalink / raw)
  To: ofono

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

Hi Marcel,

On Thu, 2011-01-27 at 08:37 +0100, ext Marcel Holtmann wrote:
> > > you can have a look on what it would take to store a) read SPN in the
> > > SIM atom and store it and b) let netreg atom use that value.
> > 
> > Simple solution for this would be something like:
> > ... 
> don't make this asynchronous. Just read the SPN and store it. Then it
> can be easily accessed similar to MCC and MNC.
> 
> The GPRS atom and netreg for that matter will not be available before
> the SIM atom has been fully initialized anyway.
> 
> If there is any race condition with this one, the we need to be really
> really careful since it has a lot of consequences.

This is the hard part of this, how to be sure SPN reading is ready early
enough. I am not yet familiar enough with SIM initialisation to say how
to do it. But I can start looking at it.

--Jukka



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

end of thread, other threads:[~2011-01-27  7:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 12:34 [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Jukka Saunamaki
2011-01-26 12:34 ` [PATCH 1/5] gprs-provision: add driver API header Jukka Saunamaki
2011-01-26 12:34 ` [PATCH 2/5] ofono.h: add gprs-provision Jukka Saunamaki
2011-01-26 12:34 ` [PATCH 3/5] gprs-provision: add driver API sources Jukka Saunamaki
2011-01-26 12:34 ` [PATCH 4/5] gprs: add gprs context provisioning Jukka Saunamaki
2011-01-26 12:34 ` [PATCH 5/5] gprs-provision: add example context provisioning driver Jukka Saunamaki
2011-01-26 20:56 ` [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings Denis Kenzior
2011-01-27  6:41   ` Jukka Saunamaki
2011-01-27  6:59     ` Marcel Holtmann
2011-01-27  7:00       ` Marcel Holtmann
2011-01-27  7:21       ` EF-SPN API (was: [gprs-provision PATCHv7 0/5] Plugin API for provisioning of GPRS context settings) Jukka Saunamaki
2011-01-27  7:37         ` Marcel Holtmann
2011-01-27  7:53           ` Jukka Saunamaki

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.