Skip to contentSkip to conversation

Get SID and provider name

PATCH In review Philippe Nunes 2 participants 11 messages Nov 24, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Get SID and provider name

Hi,

The goal of these patch is to:

- Merge the huaweicdmamodem driver with cdmamodem driver.
- Add the serving system entry point in cdmamodem driver
- Retrieve the provider name based on the SID provided by the modem.

Philippe Nunes (7):
Huaweicdmamodem: remove this specific driver
huaweicdmamodem: Merge this driver with cdmamodem driver
cdmamodem: Add CDMA network-registration support
cdma-netreg: Add 'serving_system' entry point to cdma-netreg to get
SID
cdmamodem: Add serving system identifier support
cdma-netreg: Make use of the new driver entry point serving_system
cdma-netreg: Add provider name support

 Makefile.am                                    |   13 +-
 drivers/cdmamodem/cdmamodem.c                  |    2 +
 drivers/cdmamodem/cdmamodem.h                  |    2 +
 drivers/cdmamodem/network-registration.c       |  278 ++++++++++++++++++++++++
 drivers/huaweicdmamodem/huaweicdmamodem.c      |   45 ----
 drivers/huaweicdmamodem/huaweicdmamodem.h      |   23 --
 drivers/huaweicdmamodem/network-registration.c |  199 -----------------
 include/cdma-netreg.h                          |    7 +
 plugins/huaweicdma.c                           |    5 +-
 src/cdma-netreg.c                              |   55 +++++
 10 files changed, 353 insertions(+), 276 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c
 delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.c
 delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.h
 delete mode 100644 drivers/huaweicdmamodem/network-registration.c
#1 lore raw

PATCH 1/7 Huaweicdmamodem: remove this specific driver

---
 Makefile.am |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
Makefile.am +0 -6
index 337aeb7..4c3ca84 100644
@@ -274,12 +274,6 @@ builtin_sources += drivers/cdmamodem/cdmamodem.h \
 			drivers/cdmamodem/voicecall.c \
 			drivers/cdmamodem/devinfo.c \
 			drivers/cdmamodem/connman.c
-
-builtin_modules += huaweicdmamodem
-builtin_sources += drivers/huaweicdmamodem/huaweicdmamodem.h \
-			drivers/huaweicdmamodem/huaweicdmamodem.c \
-			drivers/huaweicdmamodem/network-registration.c
-
 endif
 
 builtin_modules += g1
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/7 huaweicdmamodem: Merge this driver with cdmamodem driver

In reply to Philippe Nunes
---
 drivers/huaweicdmamodem/huaweicdmamodem.c      |   45 ------
 drivers/huaweicdmamodem/huaweicdmamodem.h      |   23 ---
 drivers/huaweicdmamodem/network-registration.c |  199 ------------------------
 3 files changed, 0 insertions(+), 267 deletions(-)
 delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.c
 delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.h
 delete mode 100644 drivers/huaweicdmamodem/network-registration.c
drivers/huaweicdmamodem/huaweicdmamodem.c deleted +0 -45
deleted file mode 100644
index 4e9c400..0000000
@@ -1,45 +0,0 @@
-/*
- *
- *  oFono - Open Source Telephony
- *
- *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
- *
- *  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
-
-#define OFONO_API_SUBJECT_TO_CHANGE
-#include <ofono/plugin.h>
-
-#include "huaweicdmamodem.h"
-
-static int huaweicdmamodem_init(void)
-{
-	huaweicdma_netreg_init();
-
-	return 0;
-}
-
-static void huaweicdmamodem_exit(void)
-{
-	huaweicdma_netreg_exit();
-}
-
-OFONO_PLUGIN_DEFINE(huaweicdmamodem, "Huawei CDMA modem driver", VERSION,
-			OFONO_PLUGIN_PRIORITY_DEFAULT,
-			huaweicdmamodem_init, huaweicdmamodem_exit)
drivers/huaweicdmamodem/huaweicdmamodem.h deleted +0 -23
deleted file mode 100644
index 799d3a8..0000000
@@ -1,23 +0,0 @@
-/*
- *
- *  oFono - Open Source Telephony
- *
- *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
- *
- *  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
- *
- */
-
-extern void huaweicdma_netreg_init(void);
-extern void huaweicdma_netreg_exit(void);
drivers/huaweicdmamodem/network-registration.c deleted +0 -199

199 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/7 cdmamodem: Add CDMA network-registration support

In reply to Philippe Nunes
---
 Makefile.am                              |    6 +-
 drivers/cdmamodem/cdmamodem.c            |    2 +
 drivers/cdmamodem/cdmamodem.h            |    2 +
 drivers/cdmamodem/network-registration.c |  201 ++++++++++++++++++++++++++++++
 plugins/huaweicdma.c                     |    5 +-
 5 files changed, 213 insertions(+), 3 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c
Makefile.am +4 -2
index 4c3ca84..6002eb0 100644
@@ -269,11 +269,13 @@ endif
 
 if CDMAMODEM
 builtin_modules += cdmamodem
-builtin_sources += drivers/cdmamodem/cdmamodem.h \
+builtin_sources += drivers/atmodem/atutil.h \
+			drivers/cdmamodem/cdmamodem.h \
 			drivers/cdmamodem/cdmamodem.c \
 			drivers/cdmamodem/voicecall.c \
 			drivers/cdmamodem/devinfo.c \
-			drivers/cdmamodem/connman.c
+			drivers/cdmamodem/connman.c \
+			drivers/cdmamodem/network-registration.c
 endif
 
 builtin_modules += g1
drivers/cdmamodem/cdmamodem.c +2 -0
index 50908e3..1548102 100644
@@ -37,6 +37,7 @@ static int cdmamodem_init(void)
 	cdma_voicecall_init();
 	cdma_devinfo_init();
 	cdma_connman_init();
+	cdma_netreg_init();
 
 	return 0;
 }
@@ -46,6 +47,7 @@ static void cdmamodem_exit(void)
 	cdma_voicecall_exit();
 	cdma_devinfo_exit();
 	cdma_connman_exit();
+	cdma_netreg_exit();
 }
 
 OFONO_PLUGIN_DEFINE(cdmamodem, "CDMA AT modem driver", VERSION,
drivers/cdmamodem/cdmamodem.h +2 -0
index 3554705..d496214 100644
@@ -27,3 +27,5 @@ extern void cdma_devinfo_init(void);
 extern void cdma_devinfo_exit(void);
 extern void cdma_connman_init(void);
 extern void cdma_connman_exit(void);
+extern void cdma_netreg_init(void);
+extern void cdma_netreg_exit(void);
drivers/cdmamodem/network-registration.c new file +201 -0

201 lines not on this page · raw message

plugins/huaweicdma.c +4 -1
index 4c83114..5618417 100644
@@ -38,6 +38,8 @@
 #include <ofono/cdma-connman.h>
 #include <ofono/log.h>
 
+#include <drivers/atmodem/vendor.h>
+
 struct huaweicdma_data {
 	GAtChat *modem;
 	GAtChat *pcui;
@@ -211,7 +213,8 @@ static void huaweicdma_post_online(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
-	ofono_cdma_netreg_create(modem, 0, "huaweicdmamodem", data->modem);
+	ofono_cdma_netreg_create(modem, OFONO_VENDOR_HUAWEI, "cdmamodem",
+					data->modem);
 
 	ofono_cdma_connman_create(modem, 0, "cdmamodem", data->modem);
 }
Signature · 1 line
1.7.1
#4 lore raw

PATCH 4/7 cdma-netreg: Add 'serving_system' entry point to cdma-netreg to get SID

In reply to Philippe Nunes
---
 include/cdma-netreg.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/cdma-netreg.h +7 -0
index 31ed289..529dab5 100644
@@ -36,12 +36,19 @@ enum cdma_netreg_status {
 
 struct ofono_cdma_netreg;
 
+typedef void (*ofono_cdma_netreg_serving_system_cb_t)(
+				const struct ofono_error *error,
+				const char *sid,
+				void *data);
+
 struct ofono_cdma_netreg_driver {
 	const char *name;
 	int (*probe)(struct ofono_cdma_netreg *cdma_netreg,
 				unsigned int vendor,
 				void *data);
 	void (*remove)(struct ofono_cdma_netreg *cdma_netreg);
+	void (*serving_system)(struct ofono_cdma_netreg *cdma_netreg,
+			ofono_cdma_netreg_serving_system_cb_t cb, void *data);
 };
 
 void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *netreg,
Signature · 1 line
1.7.1
#5 lore raw

Re: [PATCH 4/7] cdma-netreg: Add 'serving_system' entry point to cdma-netreg to get SID

Hi Philippe,

Quoted 4 lines · Philippe Nunes
---
 include/cdma-netreg.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#6 lore raw

PATCH 5/7 cdmamodem: Add serving system identifier support

In reply to Philippe Nunes
---
 drivers/cdmamodem/network-registration.c |   77 ++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)
drivers/cdmamodem/network-registration.c +77 -0
index a34db91..b72295c 100644
@@ -24,6 +24,7 @@
 #endif
 
 #define _GNU_SOURCE
+#include <string.h>
 #include <glib.h>
 #include <errno.h>
 
@@ -108,6 +109,66 @@ static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	ofono_cdma_netreg_status_notify(netreg, status);
 }
 
+static gboolean parse_css(GAtResult *result, const char **sid)
+{
+	GAtResultIter iter;
+	/*
+	* According TIA/EIA/IS-707, CSS query returns <AB>,<SID> but
+	* according TIA/EIA/IS-707-A , it returns <Band_Class>,<Band>,<SID>.
+	* PREV field which has been added afterward is ignored
+	*/
+
+	g_at_result_iter_init(&iter, result);
+
+	g_at_result_iter_next(&iter, NULL);
+
+	/* Skip first field since we are not interested in this */
+	if (!g_at_result_iter_skip_next(&iter))
+		return FALSE;
+
+	if (!g_at_result_iter_next_unquoted_string(&iter, sid))
+		return FALSE;
+	/*
+	* As CSS answer may differ according which revision of TIA/EIA/IS-707
+	* the modem is compliant, we need to check if this field is Band or SID
+	*/
+	if ((*sid[0] >= 'A' && *sid[0] <= 'F') || (*sid[0] == 'Z'))
+		/* This is the band field, the next field is the SID*/
+		if (!g_at_result_iter_next_unquoted_string(&iter, sid))
+			return FALSE;
+
+	if (!strcmp(*sid, "99999"))
+		/* The mobile station is not registered.*/
+		return FALSE;
+
+	return TRUE;
+}
+
+static void serving_system_cb(gboolean ok, GAtResult *result,
+				gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_cdma_netreg_serving_system_cb_t cb = cbd->cb;
+	struct ofono_error error;
+	const char* sid;
+
+	decode_at_error(&error, g_at_result_final_response(result));
+
+	if (!ok) {
+		cb(&error, NULL, cbd->data);
+		return;
+	}
+
+	if (parse_css(result, &sid) == FALSE) {
+		CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
+		return;
+	}
+
+	DBG("serving system: SID %s", sid);
+
+	cb(&error, sid, cbd->data);
+}
+
 static void mode_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_cdma_netreg *netreg = user_data;
@@ -184,10 +245,26 @@ static void cdma_netreg_remove(struct ofono_cdma_netreg *netreg)
 	g_at_chat_unref(chat);
 }
 
+static void cdma_netreg_serving_system(struct ofono_cdma_netreg *netreg,
+		ofono_cdma_netreg_serving_system_cb_t cb, void *data)
+{
+	GAtChat *chat = ofono_cdma_netreg_get_data(netreg);
+	struct cb_data *cbd = cb_data_new(cb, data);
+
+	if (g_at_chat_send(chat, "AT+CSS=?", NULL, serving_system_cb, cbd,
+				g_free) > 0)
+			return;
+
+	g_free(cbd);
+
+	CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
 static struct ofono_cdma_netreg_driver driver = {
 	.name	= "cdmamodem",
 	.probe	= cdma_netreg_probe,
 	.remove	= cdma_netreg_remove,
+	.serving_system = cdma_netreg_serving_system,
 };
 
 void cdma_netreg_init(void)
Signature · 1 line
1.7.1
#7 lore raw

PATCH 6/7 cdma-netreg: Make use of the new driver entry point serving_system

In reply to Philippe Nunes
---
 src/cdma-netreg.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
src/cdma-netreg.c +25 -0
index 739d1ef..222c3b7 100644
@@ -104,6 +104,24 @@ static GDBusSignalTable cdma_netreg_manager_signals[] = {
 	{ }
 };
 
+static void serving_system_callback(const struct ofono_error *error,
+					const char *sid, void *data)
+{
+	struct ofono_cdma_netreg *cdma_netreg = data;
+
+	if (cdma_netreg->status != CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
+			&& cdma_netreg->status !=
+				CDMA_NETWORK_REGISTRATION_STATUS_ROAMING)
+		return;
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+		DBG("Error during serving system query");
+		return;
+	}
+
+	DBG("Serving system Identifier: %s", sid);
+}
+
 static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
 						enum cdma_netreg_status status)
 {
@@ -117,6 +135,13 @@ static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
 				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
 				"Status", DBUS_TYPE_STRING,
 				&str_status);
+
+	if (cdma_netreg->status == CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
+			|| cdma_netreg->status ==
+				CDMA_NETWORK_REGISTRATION_STATUS_ROAMING)
+		if (cdma_netreg->driver->serving_system != NULL)
+			cdma_netreg->driver->serving_system(cdma_netreg,
+				serving_system_callback, cdma_netreg);
 }
 
 void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *cdma_netreg,
Signature · 1 line
1.7.1
#8 lore raw

Re: [PATCH 6/7] cdma-netreg: Make use of the new driver entry point serving_system

Hi Philippe,

Quoted 4 lines · Philippe Nunes
---
 src/cdma-netreg.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#9 lore raw

PATCH 7/7 cdma-netreg: Add provider name support

In reply to Philippe Nunes
---
 Makefile.am       |    3 ++-
 src/cdma-netreg.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletions(-)
Makefile.am +2 -1
index 6002eb0..978ac9f 100644
@@ -275,7 +275,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/cdmamodem/voicecall.c \
 			drivers/cdmamodem/devinfo.c \
 			drivers/cdmamodem/connman.c \
-			drivers/cdmamodem/network-registration.c
+			drivers/cdmamodem/network-registration.c \
+			plugins/mbpi.c plugins/mbpi.h
 endif
 
 builtin_modules += g1
src/cdma-netreg.c +30 -0
index 222c3b7..19947ab 100644
@@ -28,6 +28,7 @@
 #include <gdbus.h>
 
 #include "ofono.h"
+#include "plugins/mbpi.h"
 
 static GSList *g_drivers;
 
@@ -38,6 +39,7 @@ struct ofono_cdma_netreg {
 	const struct ofono_cdma_netreg_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
+	char *provider_name;
 };
 
 static const char *cdma_netreg_status_to_string(enum cdma_netreg_status status)
@@ -90,6 +92,10 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
 					&strength);
 	}
 
+	if (cdma_netreg->provider_name)
+		ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING,
+						&cdma_netreg->provider_name);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
@@ -108,6 +114,9 @@ static void serving_system_callback(const struct ofono_error *error,
 					const char *sid, void *data)
 {
 	struct ofono_cdma_netreg *cdma_netreg = data;
+	const char *path = __ofono_atom_get_path(cdma_netreg->atom);
+	DBusConnection *conn = ofono_dbus_get_connection();
+	GError *err = NULL;
 
 	if (cdma_netreg->status != CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
 			&& cdma_netreg->status !=
@@ -120,6 +129,20 @@ static void serving_system_callback(const struct ofono_error *error,
 	}
 
 	DBG("Serving system Identifier: %s", sid);
+
+	g_free(cdma_netreg->provider_name);
+	cdma_netreg->provider_name = NULL;
+	cdma_netreg->provider_name = mbpi_lookup_cdma_provider_name(sid, &err);
+
+	if (cdma_netreg->provider_name)
+		ofono_dbus_signal_property_changed(conn, path,
+				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+				"Name", DBUS_TYPE_STRING,
+				&cdma_netreg->provider_name);
+	else if (err != NULL) {
+		ofono_error("%s", err->message);
+		g_error_free(err);
+	}
 }
 
 static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
@@ -136,6 +159,12 @@ static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
 				"Status", DBUS_TYPE_STRING,
 				&str_status);
 
+	if (cdma_netreg->status ==
+			CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED) {
+		g_free(cdma_netreg->provider_name);
+		cdma_netreg->provider_name = NULL;
+	}
+
 	if (cdma_netreg->status == CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
 			|| cdma_netreg->status ==
 				CDMA_NETWORK_REGISTRATION_STATUS_ROAMING)
@@ -251,6 +280,7 @@ static void cdma_netreg_remove(struct ofono_atom *atom)
 	if (cdma_netreg->driver && cdma_netreg->driver->remove)
 		cdma_netreg->driver->remove(cdma_netreg);
 
+	g_free(cdma_netreg->provider_name);
 	g_free(cdma_netreg);
 }
 
Signature · 1 line
1.7.1
#10 lore raw

Re: [PATCH 7/7] cdma-netreg: Add provider name support

Hi Philippe,

Quoted 24 lines · Philippe Nunes
---
 Makefile.am       |    3 ++-
 src/cdma-netreg.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletions(-)
Makefile.am +2 -1
index 6002eb0..978ac9f 100644
@@ -275,7 +275,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/cdmamodem/voicecall.c \
 			drivers/cdmamodem/devinfo.c \
 			drivers/cdmamodem/connman.c \
-			drivers/cdmamodem/network-registration.c
+			drivers/cdmamodem/network-registration.c \
+			plugins/mbpi.c plugins/mbpi.h
 endif
 
 builtin_modules += g1
src/cdma-netreg.c +0 -0
index 222c3b7..19947ab 100644

src/cdma-netreg.c line 31

Quoted 4 lines
src/cdma-netreg.c +1 -0
@@ -28,6 +28,7 @@
 #include <gdbus.h>
 
 #include "ofono.h"
+#include "plugins/mbpi.h"

Don't do this, see below

Quoted 12 lines
src/cdma-netreg.c +1 -0
 static GSList *g_drivers;
 
@@ -38,6 +39,7 @@ struct ofono_cdma_netreg {
 	const struct ofono_cdma_netreg_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
+	char *provider_name;
 };
 
 static const char *cdma_netreg_status_to_string(enum cdma_netreg_status status)

src/cdma-netreg.c static DBusMessage *network_get_properties(DBusConnection *conn, · line 98

Quoted 7 lines
src/cdma-netreg.c +4 -0
@@ -90,6 +92,10 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
 					&strength);
 	}
 
+	if (cdma_netreg->provider_name)
+		ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING,
+						&cdma_netreg->provider_name);
+

You might also want to export the SystemIdentifier property here

Quoted 14 lines
src/cdma-netreg.c +3 -0
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
@@ -108,6 +114,9 @@ static void serving_system_callback(const struct ofono_error *error,
 					const char *sid, void *data)
 {
 	struct ofono_cdma_netreg *cdma_netreg = data;
+	const char *path = __ofono_atom_get_path(cdma_netreg->atom);
+	DBusConnection *conn = ofono_dbus_get_connection();
+	GError *err = NULL;
 
 	if (cdma_netreg->status != CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
 			&& cdma_netreg->status !=

src/cdma-netreg.c static void serving_system_callback(const struct ofono_error *error, · line 135

Quoted 7 lines
src/cdma-netreg.c +4 -0
@@ -120,6 +129,20 @@ static void serving_system_callback(const struct ofono_error *error,
 	}
 
 	DBG("Serving system Identifier: %s", sid);
+
+	g_free(cdma_netreg->provider_name);
+	cdma_netreg->provider_name = NULL;
+	cdma_netreg->provider_name = mbpi_lookup_cdma_provider_name(sid, &err);

Please don't do it this way, this part should be abstracted behind a provider name lookup plugin, similar to how context provisioning for GSM is done. Mobile Broadband Provider Info database might not be the only source of this information, in fact manufacturers might have their own (better) databases.

src/cdma-netreg.c static void serving_system_callback(const struct ofono_error *error, · line 145

Quoted 10 lines
src/cdma-netreg.c +10 -0
+
+	if (cdma_netreg->provider_name)
+		ofono_dbus_signal_property_changed(conn, path,
+				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+				"Name", DBUS_TYPE_STRING,
+				&cdma_netreg->provider_name);
+	else if (err != NULL) {
+		ofono_error("%s", err->message);
+		g_error_free(err);
+	}

Are you sure you want to perform the lookup every time? Why don't you cache the last result and not perform the query if the SID is the same as the last one obtained. We're highly unlikely to get a different SID under normal circumstances (e.g. signal loss, etc) so re-querying seems wasteful.

src/cdma-netreg.c static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg, · line 165

Quoted 11 lines
src/cdma-netreg.c +4 -0
 }
 
 static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
@@ -136,6 +159,12 @@ static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
 				"Status", DBUS_TYPE_STRING,
 				&str_status);
 
+	if (cdma_netreg->status ==
+			CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED) {
+		g_free(cdma_netreg->provider_name);
+		cdma_netreg->provider_name = NULL;

See comment above

src/cdma-netreg.c static void cdma_netreg_remove(struct ofono_atom *atom) · line 286

Quoted 13 lines
src/cdma-netreg.c +3 -0
+	}
+
 	if (cdma_netreg->status == CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
 			|| cdma_netreg->status ==
 				CDMA_NETWORK_REGISTRATION_STATUS_ROAMING)
@@ -251,6 +280,7 @@ static void cdma_netreg_remove(struct ofono_atom *atom)
 	if (cdma_netreg->driver && cdma_netreg->driver->remove)
 		cdma_netreg->driver->remove(cdma_netreg);
 
+	g_free(cdma_netreg->provider_name);
 	g_free(cdma_netreg);
 }
 

Regards,
-Denis