Skip to contentSkip to conversation

Provider name and SID

PATCH Superseded Philippe Nunes 3 participants 22 messages Dec 8, 2011 – Dec 9, 2011 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Provider name and SID

Hi,

change log from previous version:

- Fix the copyrigths.
- Add Qualcomm Diagnostic Monitor port support to get the SID with the command 'station status'. This diagnostic port is especially needed in case of EV-DO capable hardware for which the AT command AT+CSS? may not return a valid answer.
- Assign by default the huawei QCDM port to the second interface (this rule is issued from a practical observation)
- Fix the 'sysinfo' parsing. When the service domain is set to 'CDMA not supported' with EV-DO capable hardware, it doesn't mean that the network is not registered.

Regards,

Philippe.

Philippe Nunes (12):
cdma-providers: add driver APIs header
ofono.h: add cdma-providers
cdma-providers: add driver APIs implementation
providers: Add cdma provider name plugin
cdma-netreg: Add provider name and SID support
gatchat: Add possibility to associate a diagnostic monitor to the
AT-capable port
huaweicdma: Use pcui port for cdma_netreg
huaweicdma: Open qcdm port to be used for signal quality or network
status
huaweicdmamodem: Probe the QCDM port with the version info request
huaweicdmamodem: Add 'serving_system' entry point to get SID
udevng: Add a default assignment for Huawei QCDM port
huaweicdmamodem: Fix sysinfo parsing

 Makefile.am                                    |    4 +-
 drivers/huaweicdmamodem/network-registration.c |  247 ++++++++++++++++++++++-
 gatchat/gatchat.c                              |   26 +++
 gatchat/gatchat.h                              |    4 +
 include/cdma-providers.h                       |   44 +++++
 plugins/huaweicdma.c                           |   46 +++++-
 plugins/providers.c                            |   79 ++++++++
 plugins/udevng.c                               |   30 ++-
 src/cdma-netreg.c                              |   40 ++++
 src/cdma-providers.c                           |   80 ++++++++
 src/ofono.h                                    |    4 +
 11 files changed, 581 insertions(+), 23 deletions(-)
 create mode 100644 include/cdma-providers.h
 create mode 100644 plugins/providers.c
 create mode 100644 src/cdma-providers.c
#1 lore raw

PATCH v2 1/12 cdma-providers: add driver APIs header

---
 include/cdma-providers.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 include/cdma-providers.h
include/cdma-providers.h new file +44 -0
new file mode 100644
index 0000000..6878087
@@ -0,0 +1,44 @@
+/*
+ *
+ *  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
+ *
+ */
+
+#ifndef __OFONO_CDMA_PROVIDERS_H
+#define __OFONO_CDMA_PROVIDERS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ofono_cdma_providers_driver {
+	const char *name;
+	int priority;
+	int (*get_provider_name)(const char *sid, char **name);
+};
+
+int ofono_cdma_providers_driver_register(
+		const struct ofono_cdma_providers_driver *driver);
+void ofono_cdma_providers_driver_unregister(
+		const struct ofono_cdma_providers_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_PROVIDERS_H */
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH v2 01/12] cdma-providers: add driver APIs header

Hi Philippe,

Quoted 34 lines · Philippe Nunes
---
 include/cdma-providers.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 include/cdma-providers.h
include/cdma-providers.h new file +23 -0
new file mode 100644
index 0000000..6878087
@@ -0,0 +1,44 @@
+/*
+ *
+ *  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
+ *
+ */
+
+#ifndef __OFONO_CDMA_PROVIDERS_H
+#define __OFONO_CDMA_PROVIDERS_H

include/cdma-providers.h line 33

Quoted 10 lines
include/cdma-providers.h new file +10 -0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ofono_cdma_providers_driver {
+	const char *name;
+	int priority;
+	int (*get_provider_name)(const char *sid, char **name);
+};

Please rename this to ofono_cdma_provision_driver. We can later expand this to provision username and password settings.

include/cdma-providers.h line 44

Quoted 11 lines
include/cdma-providers.h new file +11 -0
+
+int ofono_cdma_providers_driver_register(
+		const struct ofono_cdma_providers_driver *driver);
+void ofono_cdma_providers_driver_unregister(
+		const struct ofono_cdma_providers_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_PROVIDERS_H */

Regards

#3 lore raw

PATCH v2 2/12 ofono.h: add cdma-providers

In reply to Philippe Nunes
---
 src/ofono.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
src/ofono.h +4 -0
index bfb534d..a26c06d 100644
@@ -487,6 +487,10 @@ void __ofono_gprs_provision_free_settings(
 #include <ofono/gnss.h>
 #include <ofono/cdma-sms.h>
 #include <ofono/cdma-netreg.h>
+
+#include <ofono/cdma-providers.h>
+ofono_bool_t __ofono_cdma_providers_get_name(const char *sid, char **name);
+
 #include <ofono/private-network.h>
 
 void __ofono_private_network_release(int id);
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH v2 02/12] ofono.h: add cdma-providers

Hi Philippe,

Quoted 9 lines · Philippe Nunes
---
 src/ofono.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
src/ofono.h +0 -0
index bfb534d..a26c06d 100644

src/ofono.h void __ofono_gprs_provision_free_settings( · line 493

Quoted 7 lines
src/ofono.h +4 -0
@@ -487,6 +487,10 @@ void __ofono_gprs_provision_free_settings(
 #include <ofono/gnss.h>
 #include <ofono/cdma-sms.h>
 #include <ofono/cdma-netreg.h>
+
+#include <ofono/cdma-providers.h>
+ofono_bool_t __ofono_cdma_providers_get_name(const char *sid, char **name);
+

Similarly, please name this cdma_provision_get_name..

src/ofono.h void __ofono_gprs_provision_free_settings( · line 496

Quoted 3 lines
src/ofono.h +0 -0
 #include <ofono/private-network.h>
 
 void __ofono_private_network_release(int id);

Regards,
-Denis

#5 lore raw

PATCH v2 3/12 cdma-providers: add driver APIs implementation

In reply to Philippe Nunes
---
 Makefile.am          |    4 +-
 src/cdma-providers.c |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 2 deletions(-)
 create mode 100644 src/cdma-providers.c
Makefile.am +2 -2
index 337aeb7..dca9984 100644
@@ -18,7 +18,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
 			include/location-reporting.h \
 			include/cdma-connman.h include/gnss.h \
 			include/private-network.h include/cdma-netreg.h \
-			include/handsfree.h
+			include/cdma-providers.h include/handsfree.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
@@ -430,7 +430,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
 			src/gnssagent.c src/gnssagent.h \
 			src/cdma-smsutil.h src/cdma-smsutil.c \
 			src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
-			src/handsfree.c
+			src/cdma-providers.c src/handsfree.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
src/cdma-providers.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
1.7.1
#6 lore raw

PATCH v2 4/12 providers: Add cdma provider name plugin

In reply to Philippe Nunes
---
 plugins/providers.c |   79 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 plugins/providers.c
plugins/providers.c new file +79 -0
new file mode 100644
index 0000000..f267db9
@@ -0,0 +1,79 @@
+/*
+ *
+ *  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
+
+#include <errno.h>
+#include <string.h>
+
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/types.h>
+#include <ofono/log.h>
+#include <ofono/plugin.h>
+#include <ofono/modem.h>
+#include <ofono/gprs-provision.h>
+#include <ofono/cdma-providers.h>
+
+#include "mbpi.h"
+
+static int providers_get_name(const char *sid, char **name)
+{
+	GError *error = NULL;
+
+	DBG("Search provider name for SID %s", sid);
+
+	*name = mbpi_lookup_cdma_provider_name(sid, &error);
+	if (*name == NULL) {
+		if (error != NULL) {
+			ofono_error("%s", error->message);
+			g_error_free(error);
+		}
+
+		return -ENOENT;
+	}
+
+	DBG("Found provider name: %s", *name);
+
+	return 0;
+}
+
+static struct ofono_cdma_providers_driver providers_driver = {
+	.name = "Mobile providers",
+	.get_provider_name = providers_get_name
+};
+
+static int providers_init(void)
+{
+	return ofono_cdma_providers_driver_register(&providers_driver);
+}
+
+static void providers_exit(void)
+{
+	ofono_cdma_providers_driver_unregister(&providers_driver);
+}
+
+OFONO_PLUGIN_DEFINE(providers, "Mobile providers Plugin", VERSION,
+			OFONO_PLUGIN_PRIORITY_DEFAULT,
+			providers_init, providers_exit)
Signature · 1 line
1.7.1
#7 lore raw

PATCH v2 5/12 cdma-netreg: Add provider name and SID support

In reply to Philippe Nunes
---
 src/cdma-netreg.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
src/cdma-netreg.c +40 -0
index 222c3b7..eaa4524 100644
@@ -24,6 +24,7 @@
 #endif
 
 #include <errno.h>
+#include <string.h>
 
 #include <gdbus.h>
 
@@ -38,6 +39,8 @@ struct ofono_cdma_netreg {
 	const struct ofono_cdma_netreg_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
+	char *provider_name;
+	char *sid;
 };
 
 static const char *cdma_netreg_status_to_string(enum cdma_netreg_status status)
@@ -90,6 +93,15 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
 					&strength);
 	}
 
+	if (cdma_netreg->sid)
+		ofono_dbus_dict_append(&dict, "SystemIdentifier",
+						DBUS_TYPE_STRING,
+						&cdma_netreg->sid);
+
+	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 +120,8 @@ 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();
 
 	if (cdma_netreg->status != CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED
 			&& cdma_netreg->status !=
@@ -120,6 +134,30 @@ static void serving_system_callback(const struct ofono_error *error,
 	}
 
 	DBG("Serving system Identifier: %s", sid);
+
+	if (cdma_netreg->sid != NULL && !strcmp(cdma_netreg->sid, sid))
+		return;
+
+	g_free(cdma_netreg->provider_name);
+	g_free(cdma_netreg->sid);
+	cdma_netreg->provider_name = NULL;
+	cdma_netreg->sid = g_strdup(sid);
+
+	ofono_dbus_signal_property_changed(conn, path,
+				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+				"SystemIdentifier", DBUS_TYPE_STRING,
+				&cdma_netreg->sid);
+
+	if (__ofono_cdma_providers_get_name(sid,
+				&cdma_netreg->provider_name) == FALSE) {
+		ofono_warn("Provider name not found");
+		return;
+	}
+
+	ofono_dbus_signal_property_changed(conn, path,
+				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+				"Name", DBUS_TYPE_STRING,
+				&cdma_netreg->provider_name);
 }
 
 static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
@@ -251,6 +289,8 @@ 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->sid);
+	g_free(cdma_netreg->provider_name);
 	g_free(cdma_netreg);
 }
 
Signature · 1 line
1.7.1
#8 lore raw

PATCH v2 6/12 gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

In reply to Philippe Nunes
---
 gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
 gatchat/gatchat.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +26 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
 #include "ringbuffer.h"
 #include "gatchat.h"
 #include "gatio.h"
+#include "gathdlc.h"
 
 /* #define WRITE_SCHEDULER_DEBUG 1 */
 
@@ -110,6 +111,7 @@ struct _GAtChat {
 	struct at_chat *parent;
 	guint group;
 	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
 };
 
 struct terminator_info {
@@ -1354,6 +1356,30 @@ GAtChat *g_at_chat_get_slave(GAtChat *chat)
 	return chat->slave;
 }
 
+GAtHDLC *g_at_chat_associate_diag_monitor(GAtChat *chat, GAtHDLC *diag)
+{
+	if (chat == NULL)
+		return NULL;
+
+	if (chat->diag_monitor != NULL)
+		g_at_hdlc_unref(chat->diag_monitor);
+
+	if (diag != NULL)
+		chat->diag_monitor = g_at_hdlc_ref(diag);
+	else
+		chat->diag_monitor = NULL;
+
+	return chat->diag_monitor;
+}
+
+GAtHDLC *g_at_chat_get_diag_monitor(GAtChat *chat)
+{
+	if (chat == NULL)
+		return NULL;
+
+	return chat->diag_monitor;
+}
+
 GIOChannel *g_at_chat_get_channel(GAtChat *chat)
 {
 	if (chat == NULL || chat->parent->io == NULL)
gatchat/gatchat.h +4 -0
index 367581e..d8863b8 100644
@@ -30,6 +30,7 @@ extern "C" {
 #include "gatsyntax.h"
 #include "gatutil.h"
 #include "gatio.h"
+#include "gathdlc.h"
 
 struct _GAtChat;
 
@@ -68,6 +69,9 @@ GAtChat *g_at_chat_clone(GAtChat *chat);
 GAtChat *g_at_chat_set_slave(GAtChat *chat, GAtChat *slave);
 GAtChat *g_at_chat_get_slave(GAtChat *chat);
 
+GAtHDLC *g_at_chat_associate_diag_monitor(GAtChat *chat, GAtHDLC *diag);
+GAtHDLC *g_at_chat_get_diag_monitor(GAtChat *chat);
+
 void g_at_chat_suspend(GAtChat *chat);
 void g_at_chat_resume(GAtChat *chat);
 
Signature · 1 line
1.7.1
#9 lore raw

Re: [PATCH v2 06/12] gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

Hi Philippe,

Quoted 17 lines
 gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
 gatchat/gatchat.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +1 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
 #include "ringbuffer.h"
 #include "gatchat.h"
 #include "gatio.h"
+#include "gathdlc.h"
 
 /* #define WRITE_SCHEDULER_DEBUG 1 */
 

gatchat/gatchat.c struct _GAtChat { · line 115

Quoted 5 lines
gatchat/gatchat.c +1 -0
@@ -110,6 +111,7 @@ struct _GAtChat {
 	struct at_chat *parent;
 	guint group;
 	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
 };

what is this for? I don't see this needed at all. You are not crossing atom driver implementations anyway.

Regards

Marcel

#10 lore raw

Re: [PATCH v2 06/12] gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

Hi Marcel,

Quoted 18 lines · Marcel Holtmann

Hi Philippe,

Quoted 16 lines
  gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
  gatchat/gatchat.h |    4 ++++
  2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +1 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
  #include "ringbuffer.h"
  #include "gatchat.h"
  #include "gatio.h"
+#include "gathdlc.h"
 
  /* #define WRITE_SCHEDULER_DEBUG 1 */
 
Quoted 9 lines

gatchat/gatchat.c struct _GAtChat { · line 115

Quoted 6 lines
gatchat/gatchat.c +1 -0
@@ -110,6 +111,7 @@ struct _GAtChat {
  	struct at_chat *parent;
  	guint group;
  	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
  };

what is this for? I don't see this needed at all. You are not crossing atom driver implementations anyway.

Here, the idea is to link one AT capable port to one Diagnostic port. Commonly, we are specifying only one AT capable channel (GAtChat) when creating an atom.
For cdma_netreg, I need both (AT and QCDM). Indeed, with some EV-DO capable hardware, the result of some AT commands (like AT+CSS?) may be wrong. That's why, I introduced the QCDM support. To retrieve the GAtHDLC from the driver implementation, I chose to use a solution similar to 'g_at_chat_get_slave'.

Regards,

Philippe.

#11 lore raw

Re: [PATCH v2 06/12] gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

Hi Philippe,

Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
  gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
  gatchat/gatchat.h |    4 ++++
  2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +1 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
  #include "ringbuffer.h"
  #include "gatchat.h"
  #include "gatio.h"
+#include "gathdlc.h"
 
  /* #define WRITE_SCHEDULER_DEBUG 1 */
 
Quoted 9 lines

gatchat/gatchat.c struct _GAtChat { · line 115

Quoted 6 lines
gatchat/gatchat.c +1 -0
@@ -110,6 +111,7 @@ struct _GAtChat {
  	struct at_chat *parent;
  	guint group;
  	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
  };

what is this for? I don't see this needed at all. You are not crossing atom driver implementations anyway.

Quoted 8 lines

Here, the idea is to link one AT capable port to one Diagnostic port. Commonly, we are specifying only one AT capable channel (GAtChat) when creating an atom.
For cdma_netreg, I need both (AT and QCDM). Indeed, with some EV-DO capable hardware, the result of some AT commands (like AT+CSS?) may be wrong. That's why, I introduced the QCDM support. To retrieve the GAtHDLC from the driver implementation, I chose to use a solution similar to 'g_at_chat_get_slave'.

why both? Isn't QCDM only enough?

Regards

Marcel

#12 lore raw

Re: [PATCH v2 06/12] gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

Hi Marcel,

Quoted 37 lines · Marcel Holtmann

Hi Philippe,

Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
   gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
   gatchat/gatchat.h |    4 ++++
   2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +1 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
   #include "ringbuffer.h"
   #include "gatchat.h"
   #include "gatio.h"
+#include "gathdlc.h"
 
   /* #define WRITE_SCHEDULER_DEBUG 1 */
 
Quoted 9 lines

gatchat/gatchat.c struct _GAtChat { · line 115

Quoted 6 lines
gatchat/gatchat.c +1 -0
@@ -110,6 +111,7 @@ struct _GAtChat {
   	struct at_chat *parent;
   	guint group;
   	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
   };

what is this for? I don't see this needed at all. You are not crossing atom driver implementations anyway.

Quoted 8 lines

Here, the idea is to link one AT capable port to one Diagnostic port. Commonly, we are specifying only one AT capable channel (GAtChat) when creating an atom.
For cdma_netreg, I need both (AT and QCDM). Indeed, with some EV-DO capable hardware, the result of some AT commands (like AT+CSS?) may be wrong. That's why, I introduced the QCDM support. To retrieve the GAtHDLC from the driver implementation, I chose to use a solution similar to 'g_at_chat_get_slave'.

Quoted 2 lines

why both? Isn't QCDM only enough?

Yes, I presume we could manage by using only QCDM but according to me, it would be more complex. Without unsolicited result codes, we are obliged to perform a network status pooling and to cover all the features (1x/HDR signal quality, dormancy state) we need to extend greatly our QCDM handler.
Now, I feel too bad to not use an available AT capable port.

Regards,

Philippe.

Quoted 10 lines

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#13 lore raw

Re: [PATCH v2 06/12] gatchat: Add possibility to associate a diagnostic monitor to the AT-capable port

In reply to Philippe Nunes

Hi Philippe,

Quoted 69 lines · Philippe Nunes
---
 gatchat/gatchat.c |   26 ++++++++++++++++++++++++++
 gatchat/gatchat.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)
gatchat/gatchat.c +26 -0
index 7a0ef35..00e5fa8 100644
@@ -35,6 +35,7 @@
 #include "ringbuffer.h"
 #include "gatchat.h"
 #include "gatio.h"
+#include "gathdlc.h"
 
 /* #define WRITE_SCHEDULER_DEBUG 1 */
 
@@ -110,6 +111,7 @@ struct _GAtChat {
 	struct at_chat *parent;
 	guint group;
 	GAtChat *slave;
+	GAtHDLC	*diag_monitor;
 };
 
 struct terminator_info {
@@ -1354,6 +1356,30 @@ GAtChat *g_at_chat_get_slave(GAtChat *chat)
 	return chat->slave;
 }
 
+GAtHDLC *g_at_chat_associate_diag_monitor(GAtChat *chat, GAtHDLC *diag)
+{
+	if (chat == NULL)
+		return NULL;
+
+	if (chat->diag_monitor != NULL)
+		g_at_hdlc_unref(chat->diag_monitor);
+
+	if (diag != NULL)
+		chat->diag_monitor = g_at_hdlc_ref(diag);
+	else
+		chat->diag_monitor = NULL;
+
+	return chat->diag_monitor;
+}
+
+GAtHDLC *g_at_chat_get_diag_monitor(GAtChat *chat)
+{
+	if (chat == NULL)
+		return NULL;
+
+	return chat->diag_monitor;
+}
+
 GIOChannel *g_at_chat_get_channel(GAtChat *chat)
 {
 	if (chat == NULL || chat->parent->io == NULL)
gatchat/gatchat.h +1 -0
index 367581e..d8863b8 100644
@@ -30,6 +30,7 @@ extern "C" {
 #include "gatsyntax.h"
 #include "gatutil.h"
 #include "gatio.h"
+#include "gathdlc.h"
 
 struct _GAtChat;
 

gatchat/gatchat.h GAtChat *g_at_chat_clone(GAtChat *chat); · line 73

Quoted 5 lines
gatchat/gatchat.h +2 -0
@@ -68,6 +69,9 @@ GAtChat *g_at_chat_clone(GAtChat *chat);
 GAtChat *g_at_chat_set_slave(GAtChat *chat, GAtChat *slave);
 GAtChat *g_at_chat_get_slave(GAtChat *chat);
 
+GAtHDLC *g_at_chat_associate_diag_monitor(GAtChat *chat, GAtHDLC *diag);
+GAtHDLC *g_at_chat_get_diag_monitor(GAtChat *chat);

I'm not happy with the naming, can we use something like g_at_chat_set_slave_qcdm. GAtChat is not the best example of naming consistency, but lets try to be consistent whenever we can ;)

gatchat/gatchat.h GAtChat *g_at_chat_clone(GAtChat *chat); · line 77

Quoted 4 lines
gatchat/gatchat.h +1 -0
+
 void g_at_chat_suspend(GAtChat *chat);
 void g_at_chat_resume(GAtChat *chat);
 

Regards,
-Denis

#14 lore raw

PATCH v2 7/12 huaweicdma: Use pcui port for cdma_netreg

In reply to Philippe Nunes
---
 plugins/huaweicdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
plugins/huaweicdma.c +1 -1
index 4c83114..9151ba8 100644
@@ -211,7 +211,7 @@ 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, 0, "huaweicdmamodem", data->pcui);
 
 	ofono_cdma_connman_create(modem, 0, "cdmamodem", data->modem);
 }
Signature · 1 line
1.7.1
#15 lore raw

Re: [PATCH v2 07/12] huaweicdma: Use pcui port for cdma_netreg

Hi Philippe,

Quoted 4 lines · Philippe Nunes
---
 plugins/huaweicdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#16 lore raw

PATCH v2 8/12 huaweicdma: Open qcdm port to be used for signal quality or network status

In reply to Philippe Nunes
---
 plugins/huaweicdma.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
plugins/huaweicdma.c +44 -0
index 9151ba8..0036b20 100644
@@ -41,6 +41,7 @@
 struct huaweicdma_data {
 	GAtChat *modem;
 	GAtChat *pcui;
+	GAtHDLC *hdlc;
 };
 
 static void huaweicdma_debug(const char *str, void *data)
@@ -75,6 +76,7 @@ static void huaweicdma_remove(struct ofono_modem *modem)
 
 	/* Cleanup after hot-unplug */
 	g_at_chat_unref(data->pcui);
+	g_at_hdlc_unref(data->hdlc);
 
 	g_free(data);
 }
@@ -92,6 +94,9 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 
 		g_at_chat_unref(data->pcui);
 		data->pcui = NULL;
+
+		g_at_hdlc_unref(data->hdlc);
+		data->hdlc = NULL;
 	}
 
 	ofono_modem_set_powered(modem, ok);
@@ -130,6 +135,38 @@ static GAtChat *open_device(struct ofono_modem *modem,
 	return chat;
 }
 
+static GAtHDLC *open_qcdm(struct ofono_modem *modem)
+{
+	const char *device;
+	GIOChannel *channel;
+	GAtHDLC *hdlc;
+
+	device = ofono_modem_get_string(modem, "Diag");
+	if (device == NULL)
+		return NULL;
+
+	DBG("Diagnostic Monitor %s", device);
+
+	channel = g_at_tty_open_qcdm(device);
+	if (channel == NULL)
+		return NULL;
+
+	hdlc = g_at_hdlc_new(channel);
+
+	g_io_channel_unref(channel);
+
+	if (hdlc == NULL)
+		return NULL;
+
+	if (getenv("OFONO_AT_DEBUG"))
+		g_at_hdlc_set_debug(hdlc, huaweicdma_debug, "HDLC: ");
+
+	g_at_hdlc_set_xmit_accm(hdlc, 0);
+	g_at_hdlc_set_recv_accm(hdlc, 0);
+
+	return hdlc;
+}
+
 static int huaweicdma_enable(struct ofono_modem *modem)
 {
 	struct huaweicdma_data *data = ofono_modem_get_data(modem);
@@ -147,6 +184,10 @@ static int huaweicdma_enable(struct ofono_modem *modem)
 		return -EIO;
 	}
 
+	data->hdlc = open_qcdm(modem);
+	if (data->hdlc != NULL)
+		g_at_chat_associate_diag_monitor(data->pcui, data->hdlc);
+
 	g_at_chat_send(data->modem, "ATE0 &C0 +CMEE=1", NULL, NULL, NULL, NULL);
 	g_at_chat_send(data->pcui, "ATE0 &C0 +CMEE=1", NULL, NULL, NULL, NULL);
 
@@ -182,6 +223,9 @@ static int huaweicdma_disable(struct ofono_modem *modem)
 	g_at_chat_unref(data->modem);
 	data->modem = NULL;
 
+	g_at_hdlc_unref(data->hdlc);
+	data->hdlc = NULL;
+
 	g_at_chat_cancel_all(data->pcui);
 	g_at_chat_unregister_all(data->pcui);
 
Signature · 1 line
1.7.1
#17 lore raw

PATCH v2 9/12 huaweicdmamodem: Probe the QCDM port with the version info request

In reply to Philippe Nunes
---
 drivers/huaweicdmamodem/network-registration.c |  104 +++++++++++++++++++++---
 1 files changed, 94 insertions(+), 10 deletions(-)
drivers/huaweicdmamodem/network-registration.c +94 -10
index fc054d5..2432bf1 100644
@@ -24,6 +24,8 @@
 #endif
 
 #define _GNU_SOURCE
+#include <string.h>
+#include <stdio.h>
 #include <glib.h>
 #include <errno.h>
 
@@ -35,8 +37,32 @@
 
 #include "huaweicdmamodem.h"
 
+#define DIAG_CMD_VERSION_INFO	0	/* Version info */
+
 static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL };
 
+struct netreg_data {
+	GAtChat *chat;
+	GAtHDLC *diag;
+	guint8 cmd;
+};
+
+struct version_info {
+	guint8 code;
+	char comp_date[11];
+	char comp_time[8];
+	char rel_date[11];
+	char rel_time[8];
+	char model[8];
+	guint8 scm;
+	guint8 mob_cai_rev;
+	guint8 mob_model;
+	guint16 mob_firmware_rev;
+	guint8 slot_cycle_index;
+	guint8 msm_ver;
+	guint8 unknown;
+} __attribute__ ((packed));
+
 static gboolean parse_sysinfo(GAtResult *result, gint *status)
 {
 	GAtResultIter iter;
@@ -107,12 +133,56 @@ static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	ofono_cdma_netreg_status_notify(netreg, status);
 }
 
+static void send_command(GAtHDLC *hdlc, guint8 cmd)
+{
+	unsigned char cmdbuf[1];
+
+	cmdbuf[0] = cmd;
+
+	g_at_hdlc_send(hdlc, cmdbuf, sizeof(cmdbuf));
+}
+
+static void hdlc_receive(const unsigned char *buf, gsize len, void *user_data)
+{
+	struct ofono_cdma_netreg *netreg = user_data;
+	struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+
+	if (nd->cmd == DIAG_CMD_VERSION_INFO) {
+		struct version_info *verinfo;
+		char str[12];
+
+		if (len < 1 || len > sizeof(struct version_info) ||
+				nd->cmd != buf[0]) {
+			/* This is probably not a QCDM port */
+			g_at_hdlc_unref(nd->diag);
+			nd->diag = NULL;
+			return;
+		}
+
+		DBG("Version information\n");
+		verinfo = (struct version_info *)buf;
+		snprintf(str, 12, "%s", verinfo->comp_date);
+		DBG("Compiled Date: %s\n", str);
+		snprintf(str, 9, "%s", verinfo->comp_time);
+		DBG("Compiled Time: %s\n", str);
+		snprintf(str, 12, "%s", verinfo->rel_date);
+		DBG("Release Date: %s\n", str);
+		snprintf(str, 9, "%s", verinfo->rel_time);
+		DBG("Release Time: %s\n", str);
+		snprintf(str, 9, "%s", verinfo->model);
+		DBG("Model: %s\n", str);
+		DBG("MSM version: %d\n", verinfo->msm_ver);
+	}
+
+	return;
+}
+
 static void mode_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_cdma_netreg *netreg = user_data;
-	GAtChat *chat = ofono_cdma_netreg_get_data(netreg);
+	struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
 
-	g_at_chat_send(chat, "AT^SYSINFO", sysinfo_prefix,
+	g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix,
 				sysinfo_cb, netreg, NULL);
 }
 
@@ -169,17 +239,17 @@ error:
 static void probe_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_cdma_netreg *netreg = user_data;
-	GAtChat *chat = ofono_cdma_netreg_get_data(netreg);
+	struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
 
 	if (!ok) {
 		ofono_cdma_netreg_remove(netreg);
 		return;
 	}
 
-	g_at_chat_register(chat, "^MODE:",
+	g_at_chat_register(nd->chat, "^MODE:",
 				mode_notify, FALSE, netreg, NULL);
 
-	g_at_chat_register(chat, "^RSSILVL:",
+	g_at_chat_register(nd->chat, "^RSSILVL:",
 				rssilvl_notify, FALSE, netreg, NULL);
 
 	g_at_chat_register(chat, "^HRSSILVL:",
@@ -191,23 +261,37 @@ static void probe_cb(gboolean ok, GAtResult *result, gpointer user_data)
 static int huaweicdma_netreg_probe(struct ofono_cdma_netreg *netreg,
 				unsigned int vendor, void *data)
 {
-	GAtChat *chat = g_at_chat_clone(data);
+	struct netreg_data *nd;
+
+	nd = g_new0(struct netreg_data, 1);
+
+	nd->chat = g_at_chat_clone(data);
+	nd->diag = g_at_chat_get_diag_monitor(data);
 
-	ofono_cdma_netreg_set_data(netreg, chat);
+	ofono_cdma_netreg_set_data(netreg, nd);
 
-	g_at_chat_send(chat, "AT^SYSINFO", sysinfo_prefix,
+	g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix,
 				probe_cb, netreg, NULL);
 
+	if (nd->diag) {
+		g_at_hdlc_set_receive(nd->diag, hdlc_receive, netreg);
+		/* Request version info to probe the QCDM port */
+		nd->cmd = DIAG_CMD_VERSION_INFO;
+		send_command(nd->diag, nd->cmd);
+	}
+
 	return 0;
 }
 
 static void huaweicdma_netreg_remove(struct ofono_cdma_netreg *netreg)
 {
-	GAtChat *chat = ofono_cdma_netreg_get_data(netreg);
+	struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
 
 	ofono_cdma_netreg_set_data(netreg, NULL);
 
-	g_at_chat_unref(chat);
+	g_at_chat_unref(nd->chat);
+	g_at_hdlc_unref(nd->diag);
+	g_free(nd);
 }
 
 static struct ofono_cdma_netreg_driver driver = {
Signature · 1 line
1.7.1
#18 lore raw

PATCH v2 10/12 huaweicdmamodem: Add 'serving_system' entry point to get SID

In reply to Philippe Nunes
---
 drivers/huaweicdmamodem/network-registration.c |  141 ++++++++++++++++++++++++
 1 files changed, 141 insertions(+), 0 deletions(-)
drivers/huaweicdmamodem/network-registration.c +141 -0
index 2432bf1..8b6378c 100644
@@ -36,8 +36,10 @@
 #include "gatchat.h"
 
 #include "huaweicdmamodem.h"
+#include <drivers/atmodem/atutil.h>
 
 #define DIAG_CMD_VERSION_INFO	0	/* Version info */
+#define DIAG_CMD_STATUS		12	/* Station status */
 
 static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL };
 
@@ -45,6 +47,8 @@ struct netreg_data {
 	GAtChat *chat;
 	GAtHDLC *diag;
 	guint8 cmd;
+	void *cb;
+	void *cb_data;
 };
 
 struct version_info {
@@ -63,6 +67,32 @@ struct version_info {
 	guint8 unknown;
 } __attribute__ ((packed));
 
+struct cdma_status {
+	guint8 code;
+	guint8 _unknown[3];
+	guint8 esn[4];
+	guint16 rf_mode;
+	guint8 min1_analog[4];
+	guint8 min1_cdma[4];
+	guint8 min2_analog[2];
+	guint8 min2_cdma[2];
+	guint8 _unknown1;
+	guint16 cdma_rx_state;
+	guint8 good_frames;
+	guint16 analog_corrected_frames;
+	guint16 analog_bad_frames;
+	guint16 analog_word_syncs;
+	guint16 entry_reason;
+	guint16 curr_chan;
+	guint8 cdma_code_chan;
+	guint16 pilot_base;
+	guint16 sid;
+	guint16 nid;
+	guint16 analog_locaid;
+	guint16 analog_rssi;
+	guint8 analog_power;
+} __attribute__ ((packed));
+
 static gboolean parse_sysinfo(GAtResult *result, gint *status)
 {
 	GAtResultIter iter;
@@ -133,6 +163,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 send_command(GAtHDLC *hdlc, guint8 cmd)
 {
 	unsigned char cmdbuf[1];
@@ -172,6 +262,35 @@ static void hdlc_receive(const unsigned char *buf, gsize len, void *user_data)
 		snprintf(str, 9, "%s", verinfo->model);
 		DBG("Model: %s\n", str);
 		DBG("MSM version: %d\n", verinfo->msm_ver);
+	} else if (nd->cmd == DIAG_CMD_STATUS) {
+		ofono_cdma_netreg_serving_system_cb_t cb = nd->cb;
+		struct cdma_status *status;
+		char str[6];
+
+		if (len < 1 || len > sizeof(struct cdma_status) ||
+				nd->cmd != buf[0]) {
+			/* fall back to use +CSS */
+			if (g_at_chat_send(nd->chat, "AT+CSS=?", NULL,
+					serving_system_cb, netreg, NULL) > 0)
+			return;
+
+			CALLBACK_WITH_FAILURE(cb, NULL, nd->cb_data);
+			return;
+		}
+
+		DBG("Status command response\n");
+		status = (struct cdma_status *) (buf);
+		DBG("Serving Identification number: SID %d", status->sid);
+		DBG("Network Identification number NID: %d", status->nid);
+
+		/* check if network is registered */
+		if (status->cdma_rx_state == 0) {
+			CALLBACK_WITH_FAILURE(cb, NULL, nd->cb_data);
+			return;
+		}
+
+		snprintf(str, 6, "%d", status->sid);
+		CALLBACK_WITH_SUCCESS(cb, str, nd->cb_data);
 	}
 
 	return;
@@ -294,10 +413,32 @@ static void huaweicdma_netreg_remove(struct ofono_cdma_netreg *netreg)
 	g_free(nd);
 }
 
+static void huaweicdma_netreg_serving_system(struct ofono_cdma_netreg *netreg,
+		ofono_cdma_netreg_serving_system_cb_t cb, void *data)
+{
+	struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+
+	nd->cb = cb;
+	nd->cb_data = data;
+
+	/* First use QCDM port if any */
+	if (nd->diag) {
+		/* Request Station status */
+		nd->cmd = 0x0c;
+		send_command(nd->diag, nd->cmd);
+		return;
+	} else if (g_at_chat_send(nd->chat, "AT+CSS=?", NULL,
+					serving_system_cb, netreg, NULL) > 0)
+		return;
+
+	CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
 static struct ofono_cdma_netreg_driver driver = {
 	.name	= "huaweicdmamodem",
 	.probe	= huaweicdma_netreg_probe,
 	.remove	= huaweicdma_netreg_remove,
+	.serving_system = huaweicdma_netreg_serving_system,
 };
 
 void huaweicdma_netreg_init(void)
Signature · 1 line
1.7.1
#19 lore raw

PATCH v2 11/12 udevng: Add a default assignment for Huawei QCDM port

In reply to Philippe Nunes
---
 plugins/udevng.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)
plugins/udevng.c +21 -9
index be87320..67660e3 100644
@@ -235,6 +235,7 @@ static gboolean setup_sierra(struct modem_info *modem)
 static gboolean setup_huawei(struct modem_info *modem)
 {
 	const char *mdm = NULL, *pcui = NULL, *diag = NULL;
+	const char *default_pcui = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -264,22 +265,33 @@ static gboolean setup_huawei(struct modem_info *modem)
 			if (mdm != NULL && pcui != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "00") == 0)
+			if (mdm == NULL && g_strcmp0(info->number, "00") == 0)
 				mdm = info->devnode;
-			else if (g_strcmp0(info->number, "01") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "02") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "03") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "04") == 0)
-				pcui = info->devnode;
+			else if (diag == NULL) {
+				if (g_strcmp0(info->number, "01") == 0)
+					diag = info->devnode;
+			} else if (pcui == NULL) {
+				if (g_strcmp0(info->number, "01") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "02") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "03") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "04") == 0)
+					default_pcui = info->devnode;
+			}
 		}
 	}
 
+	if (pcui == NULL && default_pcui != NULL)
+		pcui = default_pcui;
+
 	if (mdm == NULL || pcui == NULL)
 		return FALSE;
 
+	if (diag != NULL && g_strcmp0(diag, pcui) == 0)
+		diag = NULL;
+
 	DBG("modem=%s pcui=%s diag=%s", mdm, pcui, diag);
 
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
Signature · 1 line
1.7.1
#20 lore raw

PATCH v2 12/12 huaweicdmamodem: Fix sysinfo parsing

In reply to Philippe Nunes

In practice, the service domain is set to 255 (cdma not supported) with an EV-DO capable hardware.

---
 drivers/huaweicdmamodem/network-registration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/huaweicdmamodem/network-registration.c +1 -1
index 8b6378c..ca746f8 100644
@@ -134,13 +134,13 @@ static gboolean parse_sysinfo(GAtResult *result, gint *status)
 
 	switch (srv_domain) {
 	case 0: /* No service */
-	case 255: /* CDMA not supported */
 		*status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
 		break;
 	case 1: /* Only CS */
 	case 2: /* Only PS */
 	case 3: /* CS  PS */
 	case 4: /* CS registered, PS in searching state */
+	case 255: /* CDMA not supported */
 		break;
 	}
 
Signature · 1 line
1.7.1
#21 lore raw

Re: [PATCH v2 12/12] huaweicdmamodem: Fix sysinfo parsing

Hi Philippe,

Quoted 6 lines · Philippe Nunes

In practice, the service domain is set to 255 (cdma not supported) with an EV-DO capable hardware.

---
 drivers/huaweicdmamodem/network-registration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis