Skip to contentSkip to conversation

gprs: Support probing provision data from device.

PATCH In review Forest Bond 1 participant 1 message Dec 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gprs: Support probing provision data from device.

From: Forest Bond <[email protected]>

Many devices retain previously defined PDP context parameters. Now drivers can retrieve and store this information during probe and it is used as a fallback if normal provisioning fails.

---
 include/gprs.h |    3 +++
 src/gprs.c     |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
include/gprs.h +3 -0
index 6c46d18..72ac0fa 100644
@@ -30,6 +30,7 @@ extern "C" {
 
 struct ofono_gprs;
 struct ofono_gprs_context;
+struct ofono_gprs_provision_data;
 
 typedef void (*ofono_gprs_status_cb_t)(const struct ofono_error *error,
 						int status, void *data);
@@ -75,6 +76,8 @@ void *ofono_gprs_get_data(struct ofono_gprs *gprs);
 
 void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
 				unsigned int min, unsigned int max);
+void ofono_gprs_set_probed_ap(struct ofono_gprs *gprs,
+				struct ofono_gprs_provision_data *ap);
 void ofono_gprs_add_context(struct ofono_gprs *gprs,
 				struct ofono_gprs_context *gc);
 
src/gprs.c +12 -0
index e379f7b..5768642 100644
@@ -96,6 +96,7 @@ struct ofono_gprs {
 	void *driver_data;
 	struct ofono_atom *atom;
 	unsigned int spn_watch;
+	struct ofono_gprs_provision_data *probed_ap;
 };
 
 struct ipv4_settings {
@@ -2594,6 +2595,8 @@ static void gprs_unregister(struct ofono_atom *atom)
 		ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
 	}
 
+	g_free(gprs->probed_ap);
+
 	ofono_modem_remove_interface(modem,
 					OFONO_CONNECTION_MANAGER_INTERFACE);
 	g_dbus_unregister_interface(conn, path,
@@ -3016,6 +3019,12 @@ static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
 	__ofono_atom_register(gprs->atom, gprs_unregister);
 }
 
+void ofono_gprs_set_probed_ap(struct ofono_gprs *gprs,
+				struct ofono_gprs_provision_data *ap)
+{
+	gprs->probed_ap = ap;
+}
+
 static void spn_read_cb(const char *spn, const char *dc, void *data)
 {
 	struct ofono_gprs *gprs	= data;
@@ -3027,6 +3036,9 @@ static void spn_read_cb(const char *spn, const char *dc, void *data)
 
 	ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
 
+	if (gprs->contexts == NULL && gprs->probed_ap != NULL)
+		provision_context(gprs->probed_ap, gprs);
+
 	ofono_gprs_finish_register(gprs);
 }
 
Signature · 1 line
1.7.0.4