All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Sierra Wireless CDMA modem support
@ 2012-12-28 19:31 Forest Bond
  2012-12-28 19:34 ` [PATCH 1/8] sierramodem: Add skeleton for Sierra Wireless modem driver Forest Bond
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:31 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

This series adds support for Sierra Wireless CDMA modems.  Tested with
the MC5728V on the Sprint CDMA network.

Forest Bond (8):
  sierramodem: Add skeleton for Sierra Wireless modem driver
  sierramodem: Add skeleton cdma netreg driver
  sierramodem: Add ERI parsing functions
  sierramodem: Report network registration status
  sierra: Create GPRS context in post_sim function
  sierra: Initialize GSM error reporting separately
  sierra: Support CDMA modems
  udevng: Support single-interface sierra devices

 Makefile.am                       |    8 +
 drivers/sierramodem/cdma-netreg.c |  385 +++++++++++++++++++++++++++++++++++++
 drivers/sierramodem/eri.c         |  282 +++++++++++++++++++++++++++
 drivers/sierramodem/eri.h         |   23 +++
 drivers/sierramodem/sierramodem.c |   50 +++++
 drivers/sierramodem/sierramodem.h |   26 +++
 plugins/sierra.c                  |  117 +++++++++---
 plugins/udevng.c                  |   43 ++++-
 8 files changed, 900 insertions(+), 34 deletions(-)
 create mode 100644 drivers/sierramodem/cdma-netreg.c
 create mode 100644 drivers/sierramodem/eri.c
 create mode 100644 drivers/sierramodem/eri.h
 create mode 100644 drivers/sierramodem/sierramodem.c
 create mode 100644 drivers/sierramodem/sierramodem.h

-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

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

* [PATCH 1/8] sierramodem: Add skeleton for Sierra Wireless modem driver
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
@ 2012-12-28 19:34 ` Forest Bond
  2012-12-28 19:34 ` [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver Forest Bond
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:34 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

---
 Makefile.am                       |    5 ++++
 drivers/sierramodem/sierramodem.c |   47 +++++++++++++++++++++++++++++++++++++
 drivers/sierramodem/sierramodem.h |   23 ++++++++++++++++++
 3 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 drivers/sierramodem/sierramodem.c
 create mode 100644 drivers/sierramodem/sierramodem.h

diff --git a/Makefile.am b/Makefile.am
index 0d2ba9f..ca488a7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -317,6 +317,11 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/speedupmodem/speedupmodem.c \
 			drivers/speedupmodem/ussd.c
 
+builtin_modules += sierramodem
+builtin_sources += drivers/atmodem/atutil.h \
+			drivers/sierramodem/sierramodem.h \
+			drivers/sierramodem/sierramodem.c
+
 if PHONESIM
 builtin_modules += phonesim
 builtin_sources += plugins/phonesim.c
diff --git a/drivers/sierramodem/sierramodem.c b/drivers/sierramodem/sierramodem.c
new file mode 100644
index 0000000..f31dd84
--- /dev/null
+++ b/drivers/sierramodem/sierramodem.c
@@ -0,0 +1,47 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2012  Outpost Embedded, LLC. 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 <glib.h>
+#include <gatchat.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/types.h>
+
+#include "sierramodem.h"
+
+static int sierramodem_init(void)
+{
+	return 0;
+}
+
+static void sierramodem_exit(void)
+{
+}
+
+OFONO_PLUGIN_DEFINE(sierramodem, "Sierra Wireless modem driver", VERSION,
+			OFONO_PLUGIN_PRIORITY_DEFAULT,
+			sierramodem_init, sierramodem_exit)
diff --git a/drivers/sierramodem/sierramodem.h b/drivers/sierramodem/sierramodem.h
new file mode 100644
index 0000000..35e8b49
--- /dev/null
+++ b/drivers/sierramodem/sierramodem.h
@@ -0,0 +1,23 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2012  Outpost Embedded, LLC. 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
+ *
+ */
+
+#include <drivers/atmodem/atutil.h>
-- 
1.7.0.4

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

* [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
  2012-12-28 19:34 ` [PATCH 1/8] sierramodem: Add skeleton for Sierra Wireless modem driver Forest Bond
@ 2012-12-28 19:34 ` Forest Bond
  2012-12-31  2:11   ` Denis Kenzior
  2012-12-28 19:35 ` [PATCH 3/8] sierramodem: Add ERI parsing functions Forest Bond
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:34 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

---
 Makefile.am                       |    3 +-
 drivers/sierramodem/cdma-netreg.c |   85 +++++++++++++++++++++++++++++++++++++
 drivers/sierramodem/sierramodem.c |    3 +
 drivers/sierramodem/sierramodem.h |    3 +
 4 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100644 drivers/sierramodem/cdma-netreg.c

diff --git a/Makefile.am b/Makefile.am
index ca488a7..074326c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -320,7 +320,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 builtin_modules += sierramodem
 builtin_sources += drivers/atmodem/atutil.h \
 			drivers/sierramodem/sierramodem.h \
-			drivers/sierramodem/sierramodem.c
+			drivers/sierramodem/sierramodem.c \
+			drivers/sierramodem/cdma-netreg.c
 
 if PHONESIM
 builtin_modules += phonesim
diff --git a/drivers/sierramodem/cdma-netreg.c b/drivers/sierramodem/cdma-netreg.c
new file mode 100644
index 0000000..109b245
--- /dev/null
+++ b/drivers/sierramodem/cdma-netreg.c
@@ -0,0 +1,85 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2012  Outpost Embedded, LLC. 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 _GNU_SOURCE
+#include <glib.h>
+#include <errno.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/cdma-netreg.h>
+
+#include "gatchat.h"
+
+#include "sierramodem.h"
+
+struct sierra_netreg_data {
+	GAtChat *chat;
+};
+
+static int sierra_cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
+				unsigned int vendor, void *chat)
+{
+	struct sierra_netreg_data *data;
+
+	data = g_try_new0(struct sierra_netreg_data, 1);
+	if (data == NULL)
+		return -ENOMEM;
+
+	ofono_cdma_netreg_set_data(netreg, data);
+
+	data->chat = g_at_chat_clone(chat);
+
+	ofono_cdma_netreg_register(netreg);
+
+	return 0;
+}
+
+static void sierra_cdma_netreg_remove(struct ofono_cdma_netreg *netreg)
+{
+	struct sierra_netreg_data *data = ofono_cdma_netreg_get_data(netreg);
+
+	ofono_cdma_netreg_set_data(netreg, NULL);
+
+	g_at_chat_unref(data->chat);
+	data->chat = NULL;
+}
+
+static struct ofono_cdma_netreg_driver driver = {
+	.name	= "sierramodem",
+	.probe	= sierra_cdma_netreg_probe,
+	.remove	= sierra_cdma_netreg_remove,
+};
+
+void sierra_cdma_netreg_init(void)
+{
+	ofono_cdma_netreg_driver_register(&driver);
+}
+
+void sierra_cdma_netreg_exit(void)
+{
+	ofono_cdma_netreg_driver_unregister(&driver);
+}
diff --git a/drivers/sierramodem/sierramodem.c b/drivers/sierramodem/sierramodem.c
index f31dd84..8f42aff 100644
--- a/drivers/sierramodem/sierramodem.c
+++ b/drivers/sierramodem/sierramodem.c
@@ -35,11 +35,14 @@
 
 static int sierramodem_init(void)
 {
+	sierra_cdma_netreg_init();
+
 	return 0;
 }
 
 static void sierramodem_exit(void)
 {
+	sierra_cdma_netreg_exit();
 }
 
 OFONO_PLUGIN_DEFINE(sierramodem, "Sierra Wireless modem driver", VERSION,
diff --git a/drivers/sierramodem/sierramodem.h b/drivers/sierramodem/sierramodem.h
index 35e8b49..c225e86 100644
--- a/drivers/sierramodem/sierramodem.h
+++ b/drivers/sierramodem/sierramodem.h
@@ -21,3 +21,6 @@
  */
 
 #include <drivers/atmodem/atutil.h>
+
+extern void sierra_cdma_netreg_init(void);
+extern void sierra_cdma_netreg_exit(void);
-- 
1.7.0.4

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

* [PATCH 3/8] sierramodem: Add ERI parsing functions
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
  2012-12-28 19:34 ` [PATCH 1/8] sierramodem: Add skeleton for Sierra Wireless modem driver Forest Bond
  2012-12-28 19:34 ` [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver Forest Bond
@ 2012-12-28 19:35 ` Forest Bond
  2012-12-31  2:19   ` Denis Kenzior
  2012-12-28 19:35 ` [PATCH 4/8] sierramodem: Report network registration status Forest Bond
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:35 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

These were borrowed from ModemManager.
---
 Makefile.am               |    2 +
 drivers/sierramodem/eri.c |  282 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/sierramodem/eri.h |   23 ++++
 3 files changed, 307 insertions(+), 0 deletions(-)
 create mode 100644 drivers/sierramodem/eri.c
 create mode 100644 drivers/sierramodem/eri.h

diff --git a/Makefile.am b/Makefile.am
index 074326c..f799874 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,8 @@ builtin_modules += sierramodem
 builtin_sources += drivers/atmodem/atutil.h \
 			drivers/sierramodem/sierramodem.h \
 			drivers/sierramodem/sierramodem.c \
+			drivers/sierramodem/eri.h \
+			drivers/sierramodem/eri.c \
 			drivers/sierramodem/cdma-netreg.c
 
 if PHONESIM
diff --git a/drivers/sierramodem/eri.c b/drivers/sierramodem/eri.c
new file mode 100644
index 0000000..0a7929f
--- /dev/null
+++ b/drivers/sierramodem/eri.c
@@ -0,0 +1,282 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2009  Novell, Inc.
+ *  Copyright (C) 2009-2012  Red Hat, Inc.
+ *  Copyright (C) 2011-2012  Google, Inc.
+ *  Copyright (C) 2012  Outpost Embedded, LLC. 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 _GNU_SOURCE
+#include <glib.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* NOTE: The following functions originated in ModemManager. */
+
+static gboolean get_uint_from_str(const gchar *str, guint *out)
+{
+	gulong num;
+
+	if (!str || !str[0])
+		return FALSE;
+
+	for (num = 0; str[num]; num++) {
+		if (!g_ascii_isdigit(str[num]))
+			return FALSE;
+	}
+
+	errno = 0;
+	num = strtoul(str, NULL, 10);
+	if (!errno && num <= G_MAXUINT) {
+		*out = (guint)num;
+		return TRUE;
+	}
+	return FALSE;
+}
+
+typedef struct {
+	gint num;
+	gboolean roam_ind;
+	const gchar *banner;
+} EriItem;
+
+/* NOTE: these may be Sprint-specific for now... */
+static const EriItem eris[] = {
+	{ 0, TRUE, "Digital or Analog Roaming" },
+	{ 1, FALSE, "Home" },
+	{ 2, TRUE, "Digital or Analog Roaming" },
+	{ 3, TRUE, "Out of neighborhood" },
+	{ 4, TRUE, "Out of building" },
+	{ 5, TRUE, "Preferred system" },
+	{ 6, TRUE, "Available System" },
+	{ 7, TRUE, "Alliance Partner" },
+	{ 8, TRUE, "Premium Partner" },
+	{ 9, TRUE, "Full Service Functionality" },
+	{ 10, TRUE, "Partial Service Functionality" },
+	{ 64, TRUE, "Preferred system" },
+	{ 65, TRUE, "Available System" },
+	{ 66, TRUE, "Alliance Partner" },
+	{ 67, TRUE, "Premium Partner" },
+	{ 68, TRUE, "Full Service Functionality" },
+	{ 69, TRUE, "Partial Service Functionality" },
+	{ 70, TRUE, "Analog A" },
+	{ 71, TRUE, "Analog B" },
+	{ 72, TRUE, "CDMA 800 A" },
+	{ 73, TRUE, "CDMA 800 B" },
+	{ 74, TRUE, "International Roaming" },
+	{ 75, TRUE, "Extended Network" },
+	{ 76, FALSE, "Campus" },
+	{ 77, FALSE, "In Building" },
+	{ 78, TRUE, "Regional" },
+	{ 79, TRUE, "Community" },
+	{ 80, TRUE, "Business" },
+	{ 81, TRUE, "Zone 1" },
+	{ 82, TRUE, "Zone 2" },
+	{ 83, TRUE, "National" },
+	{ 84, TRUE, "Local" },
+	{ 85, TRUE, "City" },
+	{ 86, TRUE, "Government" },
+	{ 87, TRUE, "USA" },
+	{ 88, TRUE, "State" },
+	{ 89, TRUE, "Resort" },
+	{ 90, TRUE, "Headquarters" },
+	{ 91, TRUE, "Personal" },
+	{ 92, FALSE, "Home" },
+	{ 93, TRUE, "Residential" },
+	{ 94, TRUE, "University" },
+	{ 95, TRUE, "College" },
+	{ 96, TRUE, "Hotel Guest" },
+	{ 97, TRUE, "Rental" },
+	{ 98, FALSE, "Corporate" },
+	{ 99, FALSE, "Home Provider" },
+	{ 100, FALSE, "Campus" },
+	{ 101, FALSE, "In Building" },
+	{ 102, TRUE, "Regional" },
+	{ 103, TRUE, "Community" },
+	{ 104, TRUE, "Business" },
+	{ 105, TRUE, "Zone 1" },
+	{ 106, TRUE, "Zone 2" },
+	{ 107, TRUE, "National" },
+	{ 108, TRUE, "Local" },
+	{ 109, TRUE, "City" },
+	{ 110, TRUE, "Government" },
+	{ 111, TRUE, "USA" },
+	{ 112, TRUE, "State" },
+	{ 113, TRUE, "Resort" },
+	{ 114, TRUE, "Headquarters" },
+	{ 115, TRUE, "Personal" },
+	{ 116, FALSE, "Home" },
+	{ 117, TRUE, "Residential" },
+	{ 118, TRUE, "University" },
+	{ 119, TRUE, "College" },
+	{ 120, TRUE, "Hotel Guest" },
+	{ 121, TRUE, "Rental" },
+	{ 122, FALSE, "Corporate" },
+	{ 123, FALSE, "Home Provider" },
+	{ 124, TRUE, "International" },
+	{ 125, TRUE, "International" },
+	{ 126, TRUE, "International" },
+	{ 127, FALSE, "Premium Service" },
+	{ 128, FALSE, "Enhanced Service" },
+	{ 129, FALSE, "Enhanced Digital" },
+	{ 130, FALSE, "Enhanced Roaming" },
+	{ 131, FALSE, "Alliance Service" },
+	{ 132, FALSE, "Alliance Network" },
+	{ 133, FALSE, "Data Roaming" },	/* Sprint: Vision Roaming */
+	{ 134, FALSE, "Extended Service" },
+	{ 135, FALSE, "Expanded Services" },
+	{ 136, FALSE, "Expanded Network" },
+	{ 137, TRUE, "Premium Service" },
+	{ 138, TRUE, "Enhanced Service" },
+	{ 139, TRUE, "Enhanced Digital" },
+	{ 140, TRUE, "Enhanced Roaming" },
+	{ 141, TRUE, "Alliance Service" },
+	{ 142, TRUE, "Alliance Network" },
+	{ 143, TRUE, "Data Roaming" },	/* Sprint: Vision Roaming */
+	{ 144, TRUE, "Extended Service" },
+	{ 145, TRUE, "Expanded Services" },
+	{ 146, TRUE, "Expanded Network" },
+	{ 147, TRUE, "Premium Service" },
+	{ 148, TRUE, "Enhanced Service" },
+	{ 149, TRUE, "Enhanced Digital" },
+	{ 150, TRUE, "Enhanced Roaming" },
+	{ 151, TRUE, "Alliance Service" },
+	{ 152, TRUE, "Alliance Network" },
+	{ 153, TRUE, "Data Roaming" },	/* Sprint: Vision Roaming */
+	{ 154, TRUE, "Extended Service" },
+	{ 155, TRUE, "Expanded Services" },
+	{ 156, TRUE, "Expanded Network" },
+	{ 157, TRUE, "Premium International" },
+	{ 158, TRUE, "Premium International" },
+	{ 159, TRUE, "Premium International" },
+	{ 160, TRUE, NULL },
+	{ 161, TRUE, NULL },
+	{ 162, FALSE, NULL },
+	{ 163, FALSE, NULL },
+	{ 164, FALSE, "Extended Voice/Data Network" },
+	{ 165, FALSE, "Extended Voice/Data Network" },
+	{ 166, TRUE, "Extended Voice/Data Network" },
+	{ 167, FALSE, "Extended Broadband" },
+	{ 168, FALSE, "Extended Broadband" },
+	{ 169, TRUE, "Extended Broadband" },
+	{ 170, FALSE, "Extended Data" },
+	{ 171, FALSE, "Extended Data" },
+	{ 172, TRUE, "Extended Data" },
+	{ 173, FALSE, "Extended Data Network" },
+	{ 174, FALSE, "Extended Data Network" },
+	{ 175, TRUE, "Extended Data Network" },
+	{ 176, FALSE, "Extended Network" },
+	{ 177, FALSE, "Extended Network" },
+	{ 178, TRUE, "Extended Network" },
+	{ 179, FALSE, "Extended Service" },
+	{ 180, TRUE, "Extended Service" },
+	{ 181, FALSE, "Extended Voice" },
+	{ 182, FALSE, "Extended Voice" },
+	{ 183, TRUE, "Extended Voice" },
+	{ 184, FALSE, "Extended Voice/Data" },
+	{ 185, FALSE, "Extended Voice/Data" },
+	{ 186, TRUE, "Extended Voice/Data" },
+	{ 187, FALSE, "Extended Voice Network" },
+	{ 188, FALSE, "Extended Voice Network" },
+	{ 189, TRUE, "Extended Voice Network" },
+	{ 190, FALSE, "Extended Voice/Data" },
+	{ 191, FALSE, "Extended Voice/Data" },
+	{ 192, TRUE, "Extended Voice/Data" },
+	{ 193, TRUE, "International" },
+	{ 194, FALSE, "International Services" },
+	{ 195, FALSE, "International Voice" },
+	{ 196, FALSE, "International Voice/Data" },
+	{ 197, FALSE, "International Voice/Data" },
+	{ 198, TRUE, "International Voice/Data" },
+	{ 199, FALSE, "Extended Voice/Data Network" },
+	{ 200, TRUE, "Extended Voice/Data Network" },
+	{ 201, TRUE, "Extended Voice/Data Network" },
+	{ 202, FALSE, "Extended Broadband" },
+	{ 203, TRUE, "Extended Broadband" },
+	{ 204, TRUE, "Extended Broadband" },
+	{ 205, FALSE, "Extended Data" },
+	{ 206, TRUE, "Extended Data" },
+	{ 207, TRUE, "Extended Data" },
+	{ 208, FALSE, "Extended Data Network" },
+	{ 209, TRUE, "Extended Data Network" },
+	{ 210, TRUE, "Extended Data Network" },
+	{ 211, FALSE, "Extended Network" },
+	{ 212, TRUE, "Extended Network" },
+	{ 213, FALSE, "Extended Service" },
+	{ 214, TRUE, "Extended Service" },
+	{ 215, TRUE, "Extended Service" },
+	{ 216, FALSE, "Extended Voice" },
+	{ 217, TRUE, "Extended Voice" },
+	{ 218, TRUE, "Extended Voice" },
+	{ 219, FALSE, "Extended Voice/Data" },
+	{ 220, TRUE, "Extended Voice/Data" },
+	{ 221, TRUE, "Extended Voice/Data" },
+	{ 222, FALSE, "Extended Voice Network" },
+	{ 223, FALSE, "Extended Voice Network" },
+	{ 224, TRUE, "Extended Voice Network" },
+	{ 225, FALSE, "Extended Voice/Data" },
+	{ 226, TRUE, "Extended Voice/Data" },
+	{ 227, TRUE, "Extended Voice/Data" },
+	{ 228, TRUE, "International" },
+	{ 229, TRUE, "International" },
+	{ 230, TRUE, "International Services" },
+	{ 231, TRUE, "International Voice" },
+	{ 232, FALSE, "International Voice/Data" },
+	{ 233, TRUE, "International Voice/Data" },
+	{ 234, TRUE, "International Voice/Data" },
+	{ 235, TRUE, "Premium International" },
+	{ 236, TRUE, NULL },
+	{ 237, TRUE, NULL },
+	{ 238, FALSE, NULL },
+	{ 239, FALSE, NULL },
+	{ -1, FALSE, NULL },
+};
+
+gboolean sierramodem_parse_eri(const gchar *reply, gboolean *out_roaming,
+					guint *out_ind, const gchar **out_desc)
+{
+	guint ind;
+	const EriItem *iter = &eris[0];
+	gboolean found = FALSE;
+
+	g_return_val_if_fail(reply != NULL, FALSE);
+	g_return_val_if_fail(out_roaming != NULL, FALSE);
+
+	if (get_uint_from_str(reply, &ind)) {
+		if (out_ind)
+			*out_ind = ind;
+
+		while (iter->num != -1) {
+			if (iter->num == ind) {
+				*out_roaming = iter->roam_ind;
+				if (out_desc)
+					*out_desc = iter->banner;
+				found = TRUE;
+				break;
+			}
+			iter++;
+		}
+	}
+
+	return found;
+}
diff --git a/drivers/sierramodem/eri.h b/drivers/sierramodem/eri.h
new file mode 100644
index 0000000..cecb0c5
--- /dev/null
+++ b/drivers/sierramodem/eri.h
@@ -0,0 +1,23 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2012  Outpost Embedded, LLC. 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
+ *
+ */
+
+gboolean sierramodem_parse_eri(const gchar *reply, gboolean *out_roaming,
+					guint *out_ind, const gchar **out_desc);
-- 
1.7.0.4

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

* [PATCH 4/8] sierramodem: Report network registration status
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
                   ` (2 preceding siblings ...)
  2012-12-28 19:35 ` [PATCH 3/8] sierramodem: Add ERI parsing functions Forest Bond
@ 2012-12-28 19:35 ` Forest Bond
  2012-12-31  2:26   ` Denis Kenzior
  2012-12-28 19:35 ` [PATCH 5/8] sierra: Create GPRS context in post_sim function Forest Bond
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:35 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

The modem is polled every 5 seconds (unless inhibited by PPP)
using AT!STATUS.
---
 drivers/sierramodem/cdma-netreg.c |  300 +++++++++++++++++++++++++++++++++++++
 1 files changed, 300 insertions(+), 0 deletions(-)

diff --git a/drivers/sierramodem/cdma-netreg.c b/drivers/sierramodem/cdma-netreg.c
index 109b245..4cca769 100644
--- a/drivers/sierramodem/cdma-netreg.c
+++ b/drivers/sierramodem/cdma-netreg.c
@@ -3,6 +3,9 @@
  *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2008-2009  Novell, Inc.
+ *  Copyright (C) 2009-2012  Red Hat, Inc.
+ *  Copyright (C) 2012  Lanedo GmbH.
  *  Copyright (C) 2012  Outpost Embedded, LLC. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -27,6 +30,8 @@
 #define _GNU_SOURCE
 #include <glib.h>
 #include <errno.h>
+#include <ctype.h>
+#include <string.h>
 
 #include <ofono/log.h>
 #include <ofono/modem.h>
@@ -35,11 +40,300 @@
 #include "gatchat.h"
 
 #include "sierramodem.h"
+#include "eri.h"
 
 struct sierra_netreg_data {
 	GAtChat *chat;
+	guint status_id;
+	guint status_source;
 };
 
+/* NOTE: STATUS parsing functions originated in ModemManager. */
+
+typedef enum {
+	SYS_MODE_UNKNOWN,
+	SYS_MODE_NO_SERVICE,
+	SYS_MODE_CDMA_1X,
+	SYS_MODE_EVDO_REV0,
+	SYS_MODE_EVDO_REVA
+} SysMode;
+
+#define MODEM_REG_TAG "Modem has registered"
+#define GENERIC_ROAM_TAG "Roaming:"
+#define ROAM_1X_TAG "1xRoam:"
+#define ROAM_EVDO_TAG "HDRRoam:"
+#define SYS_MODE_TAG "Sys Mode:"
+#define SYS_MODE_NO_SERVICE_TAG "NO SRV"
+#define SYS_MODE_EVDO_TAG "HDR"
+#define SYS_MODE_1X_TAG "1x"
+#define SYS_MODE_CDMA_TAG "CDMA"
+#define EVDO_REV_TAG "HDR Revision:"
+#define SID_TAG "SID:"
+
+static ofono_bool_t get_roam_value(const gchar *reply, const gchar *tag,
+			ofono_bool_t is_eri, ofono_bool_t *out_roaming)
+{
+	gchar *p;
+	ofono_bool_t success;
+	guint32 ind = 0;
+
+	p = strstr(reply, tag);
+	if (!p)
+		return FALSE;
+
+	p += strlen(tag);
+	while (*p && isspace(*p))
+		p++;
+
+	/* Use generic ERI parsing if it's an ERI */
+	if (is_eri) {
+		success = sierramodem_parse_eri(p, out_roaming, &ind, NULL);
+		if (success) {
+			/* Sierra redefines ERI 0, 1, and 2 */
+			if (ind == 0)
+				*out_roaming = FALSE;  /* home */
+			else if (ind == 1 || ind == 2)
+				*out_roaming = TRUE;   /* roaming */
+		}
+		return success;
+	}
+
+	/* If it's not an ERI, roaming is just true/false */
+	if (*p == '1') {
+		*out_roaming = TRUE;
+		return TRUE;
+	} else if (*p == '0') {
+		*out_roaming = FALSE;
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static ofono_bool_t sys_mode_has_service(SysMode mode)
+{
+	return (mode == SYS_MODE_CDMA_1X || mode == SYS_MODE_EVDO_REV0 ||
+						mode == SYS_MODE_EVDO_REVA);
+}
+
+static ofono_bool_t sys_mode_is_evdo(SysMode mode)
+{
+	return (mode == SYS_MODE_EVDO_REV0 || mode == SYS_MODE_EVDO_REVA);
+}
+
+static ofono_bool_t sys_mode_is_cdma(SysMode mode)
+{
+	return (mode == SYS_MODE_CDMA_1X);
+}
+
+static ofono_bool_t parse_status(GAtResult *result, gint *status)
+{
+	GAtResultIter iter;
+	const char *line;
+	ofono_bool_t registered = FALSE;
+	ofono_bool_t have_sid = FALSE;
+	SysMode evdo_mode = SYS_MODE_UNKNOWN;
+	SysMode sys_mode = SYS_MODE_UNKNOWN;
+	ofono_bool_t evdo_roam = FALSE, cdma1x_roam = FALSE;
+	int i;
+
+	/*
+	 * Sierra CDMA parts have two general formats depending on whether they
+	 * support EVDO or not.  EVDO parts report both 1x and EVDO roaming
+	 * status while of course 1x parts only report 1x status.  Some modems
+	 * also do not report the Roaming information (MP 555 GPS).
+	 *
+	 * AT!STATUS responses:
+	 *
+	 * Unregistered MC5725:
+	 * -----------------------
+	 * Current band: PCS CDMA
+	 * Current channel: 350
+	 * SID: 0  NID: 0  1xRoam: 0 HDRRoam: 0
+	 * Temp: 33  State: 100  Sys Mode: NO SRV
+	 * Pilot NOT acquired
+	 * Modem has NOT registered
+	 *
+	 * Registered MC5725:
+	 * -----------------------
+	 * Current band: Cellular Sleep
+	 * Current channel: 775
+	 * SID: 30  NID: 2  1xRoam: 0 HDRRoam: 0
+	 * Temp: 29  State: 200  Sys Mode: HDR
+	 * Pilot acquired
+	 * Modem has registered
+	 * HDR Revision: A
+	 *
+	 * Unregistered AC580:
+	 * -----------------------
+	 * Current band: PCS CDMA
+	 * Current channel: 350
+	 * SID: 0 NID: 0  Roaming: 0
+	 * Temp: 39  State: 100  Scan Mode: 0
+	 * Pilot NOT acquired
+	 * Modem has NOT registered
+	 *
+	 * Registered AC580:
+	 * -----------------------
+	 * Current band: Cellular Sleep
+	 * Current channel: 548
+	 * SID: 26  NID: 1  Roaming: 1
+	 * Temp: 39  State: 200  Scan Mode: 0
+	 * Pilot Acquired
+	 * Modem has registered
+	 */
+
+	/*
+	 * We have to handle the two formats slightly differently; for newer
+	 * formats with "Sys Mode", we consider the modem registered if the Sys
+	 * Mode is not "NO SRV".  The explicit registration status is just
+	 * icing on the cake.  For older formats (no "Sys Mode") we treat the
+	 * modem as registered if the SID is non-zero.
+	 */
+
+	g_at_result_iter_init(&iter, result);
+
+	for (i = 0; i < g_at_result_num_response_lines(result); i++) {
+		ofono_bool_t bool_val = FALSE;
+		char *p;
+
+		g_at_result_iter_next(&iter, NULL);
+
+		line = g_at_result_iter_raw_line(&iter);
+
+		if (!strncmp(line, MODEM_REG_TAG, strlen(MODEM_REG_TAG))) {
+			registered = TRUE;
+			continue;
+		}
+
+		/* Roaming */
+		get_roam_value(line, ROAM_1X_TAG, TRUE, &cdma1x_roam);
+		get_roam_value(line, ROAM_EVDO_TAG, TRUE, &evdo_roam);
+		if (get_roam_value(line, GENERIC_ROAM_TAG, FALSE, &bool_val))
+			cdma1x_roam = evdo_roam = bool_val;
+
+		/* Current system mode */
+		p = strstr(line, SYS_MODE_TAG);
+		if (p) {
+			p += strlen(SYS_MODE_TAG);
+			while (*p && isspace(*p))
+				p++;
+			if (!strncmp(p, SYS_MODE_NO_SERVICE_TAG,
+					strlen(SYS_MODE_NO_SERVICE_TAG)))
+				sys_mode = SYS_MODE_NO_SERVICE;
+			else if (!strncmp(p, SYS_MODE_EVDO_TAG,
+						strlen(SYS_MODE_EVDO_TAG)))
+				sys_mode = SYS_MODE_EVDO_REV0;
+			else if (!strncmp(p, SYS_MODE_1X_TAG,
+						strlen(SYS_MODE_1X_TAG)) ||
+				 !strncmp(p, SYS_MODE_CDMA_TAG,
+						strlen(SYS_MODE_CDMA_TAG)))
+				sys_mode = SYS_MODE_CDMA_1X;
+		}
+
+		/* Current EVDO revision if system mode is EVDO */
+		p = strstr(line, EVDO_REV_TAG);
+		if (p) {
+			p += strlen(EVDO_REV_TAG);
+			while (*p && isspace(*p))
+				p++;
+			if (*p == 'A')
+				evdo_mode = SYS_MODE_EVDO_REVA;
+			else if (*p == '0')
+				evdo_mode = SYS_MODE_EVDO_REV0;
+		}
+
+		/* SID */
+		p = strstr(line, SID_TAG);
+		if (p) {
+			p += strlen(SID_TAG);
+			while (*p && isspace(*p))
+				p++;
+			if (isdigit(*p) && (*p != '0'))
+				have_sid = TRUE;
+		}
+	}
+
+	/* Update current system mode */
+	if (sys_mode_is_evdo(sys_mode)) {
+		/* Prefer the explicit EVDO mode from EVDO_REV_TAG */
+		if (evdo_mode != SYS_MODE_UNKNOWN)
+			sys_mode = evdo_mode;
+	}
+
+	/*
+	 * If the modem didn't report explicit registration with "Modem has
+	 * registered" then get registration status by looking@either system
+	 * mode or (for older devices that don't report that) just the SID.
+	 */
+	if (!registered) {
+		if (sys_mode != SYS_MODE_UNKNOWN)
+			registered = sys_mode_has_service(sys_mode);
+		else
+			registered = have_sid;
+	}
+
+	if (registered) {
+		ofono_bool_t roaming = FALSE;
+
+		if (sys_mode_is_evdo(sys_mode))
+			roaming = evdo_roam;
+		else if (sys_mode_is_cdma(sys_mode))
+			roaming = cdma1x_roam;
+
+		if (roaming)
+			*status = CDMA_NETWORK_REGISTRATION_STATUS_ROAMING;
+		else
+			*status = CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED;
+	} else {
+		*status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
+	}
+
+	return TRUE;
+}
+
+static void status_cb(ofono_bool_t ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_cdma_netreg *netreg = user_data;
+	int status;
+
+	if (!ok)
+		return;
+
+	if (parse_status(result, &status) == FALSE) {
+		ofono_error("Invalid STATUS values");
+		return;
+	}
+
+	ofono_cdma_netreg_status_notify(netreg, status);
+}
+
+static void read_status(struct ofono_cdma_netreg *netreg, GAtChat *chat)
+{
+	struct sierra_netreg_data *data = ofono_cdma_netreg_get_data(netreg);
+
+	/*
+	 * Cancel our last request, which shouldn't have taken this long to
+	 * complete anyway.  If it did, PPP is probably running and AT chat
+	 * is suspended.  In any case, we only care about the latest info.
+	 */
+	if (data->status_id > 0)
+		g_at_chat_cancel(chat, data->status_id);
+
+	data->status_id = g_at_chat_send(chat, "AT!STATUS", NULL, status_cb,
+								netreg, NULL);
+}
+
+static ofono_bool_t read_status_cb(gpointer user_data)
+{
+	struct ofono_cdma_netreg *netreg = user_data;
+	struct sierra_netreg_data *data = ofono_cdma_netreg_get_data(netreg);
+
+	read_status(netreg, data->chat);
+
+	return TRUE;
+}
+
 static int sierra_cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
 				unsigned int vendor, void *chat)
 {
@@ -52,6 +346,9 @@ static int sierra_cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
 	ofono_cdma_netreg_set_data(netreg, data);
 
 	data->chat = g_at_chat_clone(chat);
+	data->status_source = g_timeout_add_seconds(5, read_status_cb, netreg);
+
+	read_status(netreg, data->chat);
 
 	ofono_cdma_netreg_register(netreg);
 
@@ -66,6 +363,9 @@ static void sierra_cdma_netreg_remove(struct ofono_cdma_netreg *netreg)
 
 	g_at_chat_unref(data->chat);
 	data->chat = NULL;
+
+	g_source_remove(data->status_source);
+	data->status_source = 0;
 }
 
 static struct ofono_cdma_netreg_driver driver = {
-- 
1.7.0.4

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

* [PATCH 5/8] sierra: Create GPRS context in post_sim function
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
                   ` (3 preceding siblings ...)
  2012-12-28 19:35 ` [PATCH 4/8] sierramodem: Report network registration status Forest Bond
@ 2012-12-28 19:35 ` Forest Bond
  2012-12-31  2:39   ` Denis Kenzior
  2012-12-28 19:36 ` [PATCH 6/8] sierra: Initialize GSM error reporting separately Forest Bond
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:35 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

This matches the huawei plugin.
---
 plugins/sierra.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/plugins/sierra.c b/plugins/sierra.c
index 3143f09..4e125d7 100644
--- a/plugins/sierra.c
+++ b/plugins/sierra.c
@@ -228,27 +228,27 @@ static void sierra_pre_sim(struct ofono_modem *modem)
 static void sierra_post_sim(struct ofono_modem *modem)
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
+	struct ofono_gprs *gprs;
+	struct ofono_gprs_context *gc;
 
 	DBG("%p", modem);
 
 	ofono_phonebook_create(modem, 0, "atmodem", data->modem);
+
+	gprs = ofono_gprs_create(modem, 0, "atmodem", data->modem);
+	gc = ofono_gprs_context_create(modem, 0, "swmodem", data->modem);
+
+	if (gprs && gc)
+		ofono_gprs_add_context(gprs, gc);
 }
 
 static void sierra_post_online(struct ofono_modem *modem)
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
-	struct ofono_gprs *gprs;
-	struct ofono_gprs_context *gc;
 
 	DBG("%p", modem);
 
 	ofono_netreg_create(modem, 0, "atmodem", data->modem);
-
-	gprs = ofono_gprs_create(modem, 0, "atmodem", data->modem);
-	gc = ofono_gprs_context_create(modem, 0, "swmodem", data->modem);
-
-	if (gprs && gc)
-		ofono_gprs_add_context(gprs, gc);
 }
 
 static struct ofono_modem_driver sierra_driver = {
-- 
1.7.0.4

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

* [PATCH 6/8] sierra: Initialize GSM error reporting separately
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
                   ` (4 preceding siblings ...)
  2012-12-28 19:35 ` [PATCH 5/8] sierra: Create GPRS context in post_sim function Forest Bond
@ 2012-12-28 19:36 ` Forest Bond
  2012-12-31  2:40   ` Denis Kenzior
  2012-12-28 19:36 ` [PATCH 7/8] sierra: Support CDMA modems Forest Bond
  2012-12-28 19:36 ` [PATCH 8/8] udevng: Support single-interface sierra devices Forest Bond
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:36 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

---
 plugins/sierra.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/sierra.c b/plugins/sierra.c
index 4e125d7..a458e38 100644
--- a/plugins/sierra.c
+++ b/plugins/sierra.c
@@ -144,8 +144,9 @@ static int sierra_enable(struct ofono_modem *modem)
 	if (data->modem == NULL)
 		return -EINVAL;
 
-	g_at_chat_send(data->modem, "ATE0 &C0 +CMEE=1", NULL,
-						NULL, NULL, NULL);
+	g_at_chat_send(data->modem, "ATE0 &C0", NULL, NULL, NULL, NULL);
+	/* This is separate because it is not supported by all modems. */
+	g_at_chat_send(data->modem, "AT+CMEE=1", NULL, NULL, NULL, NULL);
 
 	g_at_chat_send(data->modem, "AT+CFUN=4", none_prefix,
 					cfun_enable, modem, NULL);
-- 
1.7.0.4

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

* [PATCH 7/8] sierra: Support CDMA modems
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
                   ` (5 preceding siblings ...)
  2012-12-28 19:36 ` [PATCH 6/8] sierra: Initialize GSM error reporting separately Forest Bond
@ 2012-12-28 19:36 ` Forest Bond
  2012-12-31  2:34   ` Denis Kenzior
  2012-12-28 19:36 ` [PATCH 8/8] udevng: Support single-interface sierra devices Forest Bond
  7 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:36 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

---
 plugins/sierra.c |  104 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 86 insertions(+), 18 deletions(-)

diff --git a/plugins/sierra.c b/plugins/sierra.c
index a458e38..1beb59a 100644
--- a/plugins/sierra.c
+++ b/plugins/sierra.c
@@ -25,6 +25,7 @@
 
 #include <errno.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <glib.h>
 #include <gatchat.h>
@@ -39,15 +40,20 @@
 #include <ofono/gprs.h>
 #include <ofono/gprs-context.h>
 #include <ofono/phonebook.h>
+#include <ofono/cdma-netreg.h>
+#include <ofono/cdma-connman.h>
 #include <ofono/log.h>
 
 #include <drivers/atmodem/atutil.h>
 #include <drivers/atmodem/vendor.h>
 
 static const char *none_prefix[] = { NULL };
+static const char *gcap_prefix[] = { "+GCAP:", NULL };
 
 struct sierra_data {
 	GAtChat *modem;
+	ofono_bool_t have_gsm;
+	ofono_bool_t have_cdma;
 };
 
 static void sierra_debug(const char *str, void *user_data)
@@ -119,7 +125,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
 	return chat;
 }
 
-static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+static void enable_result(ofono_bool_t ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
 	struct sierra_data *data = ofono_modem_get_data(modem);
@@ -134,6 +140,40 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 	ofono_modem_set_powered(modem, ok);
 }
 
+static void gcap_support(ofono_bool_t ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct sierra_data *data = ofono_modem_get_data(modem);
+	GAtResultIter iter;
+	const char *gcap;
+
+	if (!ok)
+		goto done;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+GCAP:"))
+		goto done;
+
+	while (g_at_result_iter_next_unquoted_string(&iter, &gcap)) {
+		if (*gcap == '\0')
+			break;
+
+		if (!strcmp(gcap, "+CGSM"))
+			data->have_gsm = TRUE;
+		else if (!strcmp(gcap, "+CIS707-A"))
+			data->have_cdma = TRUE;
+	}
+
+done:
+	if (data->have_gsm == FALSE && data->have_cdma == TRUE)
+		g_at_chat_send(data->modem, "AT!PCSTATE=1", none_prefix,
+						enable_result, modem, NULL);
+	else
+		g_at_chat_send(data->modem, "AT+CFUN=4", none_prefix,
+						enable_result, modem, NULL);
+}
+
 static int sierra_enable(struct ofono_modem *modem)
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
@@ -148,13 +188,14 @@ static int sierra_enable(struct ofono_modem *modem)
 	/* This is separate because it is not supported by all modems. */
 	g_at_chat_send(data->modem, "AT+CMEE=1", NULL, NULL, NULL, NULL);
 
-	g_at_chat_send(data->modem, "AT+CFUN=4", none_prefix,
-					cfun_enable, modem, NULL);
+	/* Check for GSM capabilities */
+	g_at_chat_send(data->modem, "ATI", gcap_prefix,
+					gcap_support, modem, NULL);
 
 	return -EINPROGRESS;
 }
 
-static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
+static void disable_result(ofono_bool_t ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
 	struct sierra_data *data = ofono_modem_get_data(modem);
@@ -171,19 +212,25 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
 static int sierra_disable(struct ofono_modem *modem)
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
+	const char *command;
 
 	DBG("%p", modem);
 
 	g_at_chat_cancel_all(data->modem);
 	g_at_chat_unregister_all(data->modem);
 
-	g_at_chat_send(data->modem, "AT+CFUN=0", none_prefix,
-					cfun_disable, modem, NULL);
+	if (data->have_gsm == FALSE && data->have_cdma == TRUE)
+		command = "AT!PCSTATE=0";
+	else
+		command = "AT+CFUN=0";
+
+	g_at_chat_send(data->modem, command, none_prefix,
+				disable_result, modem, NULL);
 
 	return -EINPROGRESS;
 }
 
-static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+static void set_online_cb(ofono_bool_t ok, GAtResult *result, gpointer user_data)
 {
 	struct cb_data *cbd = user_data;
 	ofono_modem_online_cb_t cb = cbd->cb;
@@ -198,10 +245,15 @@ static void sierra_set_online(struct ofono_modem *modem, ofono_bool_t online,
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
 	struct cb_data *cbd = cb_data_new(cb, user_data);
-	char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+	char const *command;
 
 	DBG("modem %p %s", modem, online ? "online" : "offline");
 
+	if (data->have_gsm == FALSE && data->have_cdma == TRUE)
+		command = online ? "AT!PCSTATE=1" : "AT!PCSTATE=0";
+	else
+		command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
 	if (g_at_chat_send(data->modem, command, none_prefix,
 					set_online_cb, cbd, g_free) > 0)
 		return;
@@ -214,13 +266,17 @@ static void sierra_set_online(struct ofono_modem *modem, ofono_bool_t online,
 static void sierra_pre_sim(struct ofono_modem *modem)
 {
 	struct sierra_data *data = ofono_modem_get_data(modem);
-	struct ofono_sim *sim;
+	struct ofono_sim *sim = NULL;
 
 	DBG("%p", modem);
 
-	ofono_devinfo_create(modem, 0, "atmodem", data->modem);
-	sim = ofono_sim_create(modem, OFONO_VENDOR_SIERRA,
-					"atmodem", data->modem);
+	if (data->have_gsm == TRUE) {
+		ofono_devinfo_create(modem, 0, "atmodem", data->modem);
+		sim = ofono_sim_create(modem, OFONO_VENDOR_SIERRA,
+						"atmodem", data->modem);
+	} else if (data->have_cdma == TRUE) {
+		ofono_devinfo_create(modem, 0, "cdmamodem", data->modem);
+	}
 
 	if (sim)
 		ofono_sim_inserted_notify(sim, TRUE);
@@ -234,13 +290,15 @@ static void sierra_post_sim(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
-	ofono_phonebook_create(modem, 0, "atmodem", data->modem);
+	if (data->have_gsm == TRUE) {
+		ofono_phonebook_create(modem, 0, "atmodem", data->modem);
 
-	gprs = ofono_gprs_create(modem, 0, "atmodem", data->modem);
-	gc = ofono_gprs_context_create(modem, 0, "swmodem", data->modem);
+		gprs = ofono_gprs_create(modem, 0, "atmodem", data->modem);
+		gc = ofono_gprs_context_create(modem, 0, "swmodem", data->modem);
 
-	if (gprs && gc)
-		ofono_gprs_add_context(gprs, gc);
+		if (gprs && gc)
+			ofono_gprs_add_context(gprs, gc);
+	}
 }
 
 static void sierra_post_online(struct ofono_modem *modem)
@@ -249,7 +307,17 @@ static void sierra_post_online(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
-	ofono_netreg_create(modem, 0, "atmodem", data->modem);
+	if (data->have_gsm == TRUE) {
+		ofono_netreg_create(modem, 0, "atmodem", data->modem);
+	} else if (data->have_cdma == TRUE) {
+		/*
+		 * Once we have CnS protocol support, we should be able to do
+		 * netreg that way instead of using the same port for both.
+		 */
+		ofono_cdma_netreg_create(modem, 0, "sierramodem", data->modem);
+		ofono_cdma_connman_create(modem, OFONO_VENDOR_SIERRA,
+						"cdmamodem", data->modem);
+	}
 }
 
 static struct ofono_modem_driver sierra_driver = {
-- 
1.7.0.4

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

* [PATCH 8/8] udevng: Support single-interface sierra devices
  2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
                   ` (6 preceding siblings ...)
  2012-12-28 19:36 ` [PATCH 7/8] sierra: Support CDMA modems Forest Bond
@ 2012-12-28 19:36 ` Forest Bond
  7 siblings, 0 replies; 23+ messages in thread
From: Forest Bond @ 2012-12-28 19:36 UTC (permalink / raw)
  To: ofono

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

From: Forest Bond <forest.bond@rapidrollout.com>

Sierra Wireless CDMA devices have a single interface with multiple
ports.
---
 plugins/udevng.c |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index afb02ca..feef4cc 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -218,10 +218,28 @@ static gboolean setup_gobi(struct modem_info *modem)
 static gboolean setup_sierra(struct modem_info *modem)
 {
 	const char *mdm = NULL, *app = NULL, *net = NULL, *diag = NULL;
+	gboolean multi_iface = FALSE;
+	char *last_iface = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
 
+	/*
+	 * DirectIP devices use multiple interfaces, but non-DirectIP
+	 * (e.g. CDMA) devices have a single interface with multiple
+	 * ports distinguished by the "port_number" sysfs attribute.
+	 */
+
+	for (list = modem->devices; list; list = list->next) {
+		struct device_info *info = list->data;
+
+		if (last_iface != NULL && g_strcmp0(info->number, last_iface) != 0) {
+			multi_iface = TRUE;
+			break;
+		}
+		last_iface = info->number;
+	}
+
 	for (list = modem->devices; list; list = list->next) {
 		struct device_info *info = list->data;
 
@@ -229,18 +247,23 @@ static gboolean setup_sierra(struct modem_info *modem)
 						info->number, info->label);
 
 		if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "01") == 0)
-				diag = info->devnode;
-			if (g_strcmp0(info->number, "03") == 0)
-				mdm = info->devnode;
-			else if (g_strcmp0(info->number, "04") == 0)
-				app = info->devnode;
-			else if (g_strcmp0(info->number, "07") == 0)
-				net = info->devnode;
+			if (multi_iface) {
+				if (g_strcmp0(info->number, "01") == 0)
+					diag = info->devnode;
+				else if (g_strcmp0(info->number, "03") == 0)
+					mdm = info->devnode;
+				else if (g_strcmp0(info->number, "04") == 0)
+					app = info->devnode;
+				else if (g_strcmp0(info->number, "07") == 0)
+					net = info->devnode;
+			} else {
+				if (g_strcmp0(info->sysattr, "0") == 0)
+					mdm = info->devnode;
+			}
 		}
 	}
 
-	if (mdm == NULL || net == NULL)
+	if (mdm == NULL || (multi_iface && net == NULL))
 		return FALSE;
 
 	DBG("modem=%s app=%s net=%s diag=%s", mdm, app, net, diag);
@@ -768,7 +791,7 @@ static struct {
 	{ "mbm",	setup_mbm,	"device/interface"	},
 	{ "hso",	setup_hso,	"hsotype"		},
 	{ "gobi",	setup_gobi	},
-	{ "sierra",	setup_sierra	},
+	{ "sierra",	setup_sierra,	"device/port_number"	},
 	{ "option",	setup_option	},
 	{ "huawei",	setup_huawei	},
 	{ "speedupcdma",setup_speedup	},
-- 
1.7.0.4

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

* Re: [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver
  2012-12-28 19:34 ` [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver Forest Bond
@ 2012-12-31  2:11   ` Denis Kenzior
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:11 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

> +static int sierra_cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
> +				unsigned int vendor, void *chat)
> +{
> +	struct sierra_netreg_data *data;
> +
> +	data = g_try_new0(struct sierra_netreg_data, 1);
> +	if (data == NULL)
> +		return -ENOMEM;
> +
> +	ofono_cdma_netreg_set_data(netreg, data);
> +
> +	data->chat = g_at_chat_clone(chat);
> +
> +	ofono_cdma_netreg_register(netreg);

In general one cannot call register from the probe function.  You should 
be using an idle callback here

> +
> +	return 0;
> +}

Regards,
-Denis

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

* Re: [PATCH 3/8] sierramodem: Add ERI parsing functions
  2012-12-28 19:35 ` [PATCH 3/8] sierramodem: Add ERI parsing functions Forest Bond
@ 2012-12-31  2:19   ` Denis Kenzior
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:19 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

On 12/28/2012 01:35 PM, Forest Bond wrote:
> From: Forest Bond<forest.bond@rapidrollout.com>
>
> These were borrowed from ModemManager.
> ---
>   Makefile.am               |    2 +
>   drivers/sierramodem/eri.c |  282 +++++++++++++++++++++++++++++++++++++++++++++
>   drivers/sierramodem/eri.h |   23 ++++
>   3 files changed, 307 insertions(+), 0 deletions(-)
>   create mode 100644 drivers/sierramodem/eri.c
>   create mode 100644 drivers/sierramodem/eri.h
>
> diff --git a/Makefile.am b/Makefile.am
> index 074326c..f799874 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -321,6 +321,8 @@ builtin_modules += sierramodem
>   builtin_sources += drivers/atmodem/atutil.h \
>   			drivers/sierramodem/sierramodem.h \
>   			drivers/sierramodem/sierramodem.c \
> +			drivers/sierramodem/eri.h \
> +			drivers/sierramodem/eri.c \
>   			drivers/sierramodem/cdma-netreg.c
>
>   if PHONESIM
> diff --git a/drivers/sierramodem/eri.c b/drivers/sierramodem/eri.c
> new file mode 100644
> index 0000000..0a7929f
> --- /dev/null
> +++ b/drivers/sierramodem/eri.c
> @@ -0,0 +1,282 @@
> +/*
> + *
> + *  oFono - Open Source Telephony
> + *
> + *  Copyright (C) 2008-2009  Novell, Inc.
> + *  Copyright (C) 2009-2012  Red Hat, Inc.
> + *  Copyright (C) 2011-2012  Google, Inc.
> + *  Copyright (C) 2012  Outpost Embedded, LLC. 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 _GNU_SOURCE
> +#include<glib.h>
> +#include<errno.h>
> +#include<stdlib.h>
> +
> +/* NOTE: The following functions originated in ModemManager. */
> +

Will be a bit pedantic here...

> +static gboolean get_uint_from_str(const gchar *str, guint *out)
> +{
> +	gulong num;
> +
> +	if (!str || !str[0])
> +		return FALSE;
> +
> +	for (num = 0; str[num]; num++) {
> +		if (!g_ascii_isdigit(str[num]))
> +			return FALSE;
> +	}

This is unneeded if you use the 2nd parameter of strtoul properly.

> +
> +	errno = 0;
> +	num = strtoul(str, NULL, 10);

Need an empty line here

> +	if (!errno&&  num<= G_MAXUINT) {
> +		*out = (guint)num;
> +		return TRUE;
> +	}

and here

> +	return FALSE;
> +}
> +
> +typedef struct {
> +	gint num;
> +	gboolean roam_ind;
> +	const gchar *banner;
> +} EriItem;
> +

Our preference is not to use typedefs and no CamelCase in struct / enum 
definitions.  The only exception is in G-lib style libraries, which this 
one isn't.

> +/* NOTE: these may be Sprint-specific for now... */
> +static const EriItem eris[] = {
> +	{ 0, TRUE, "Digital or Analog Roaming" },
> +	{ 1, FALSE, "Home" },
> +	{ 2, TRUE, "Digital or Analog Roaming" },
> +	{ 3, TRUE, "Out of neighborhood" },
> +	{ 4, TRUE, "Out of building" },
> +	{ 5, TRUE, "Preferred system" },
> +	{ 6, TRUE, "Available System" },
> +	{ 7, TRUE, "Alliance Partner" },
> +	{ 8, TRUE, "Premium Partner" },
> +	{ 9, TRUE, "Full Service Functionality" },
> +	{ 10, TRUE, "Partial Service Functionality" },
> +	{ 64, TRUE, "Preferred system" },
> +	{ 65, TRUE, "Available System" },
> +	{ 66, TRUE, "Alliance Partner" },
> +	{ 67, TRUE, "Premium Partner" },
> +	{ 68, TRUE, "Full Service Functionality" },
> +	{ 69, TRUE, "Partial Service Functionality" },
> +	{ 70, TRUE, "Analog A" },
> +	{ 71, TRUE, "Analog B" },
> +	{ 72, TRUE, "CDMA 800 A" },
> +	{ 73, TRUE, "CDMA 800 B" },
> +	{ 74, TRUE, "International Roaming" },
> +	{ 75, TRUE, "Extended Network" },
> +	{ 76, FALSE, "Campus" },
> +	{ 77, FALSE, "In Building" },
> +	{ 78, TRUE, "Regional" },
> +	{ 79, TRUE, "Community" },
> +	{ 80, TRUE, "Business" },
> +	{ 81, TRUE, "Zone 1" },
> +	{ 82, TRUE, "Zone 2" },
> +	{ 83, TRUE, "National" },
> +	{ 84, TRUE, "Local" },
> +	{ 85, TRUE, "City" },
> +	{ 86, TRUE, "Government" },
> +	{ 87, TRUE, "USA" },
> +	{ 88, TRUE, "State" },
> +	{ 89, TRUE, "Resort" },
> +	{ 90, TRUE, "Headquarters" },
> +	{ 91, TRUE, "Personal" },
> +	{ 92, FALSE, "Home" },
> +	{ 93, TRUE, "Residential" },
> +	{ 94, TRUE, "University" },
> +	{ 95, TRUE, "College" },
> +	{ 96, TRUE, "Hotel Guest" },
> +	{ 97, TRUE, "Rental" },
> +	{ 98, FALSE, "Corporate" },
> +	{ 99, FALSE, "Home Provider" },
> +	{ 100, FALSE, "Campus" },
> +	{ 101, FALSE, "In Building" },
> +	{ 102, TRUE, "Regional" },
> +	{ 103, TRUE, "Community" },
> +	{ 104, TRUE, "Business" },
> +	{ 105, TRUE, "Zone 1" },
> +	{ 106, TRUE, "Zone 2" },
> +	{ 107, TRUE, "National" },
> +	{ 108, TRUE, "Local" },
> +	{ 109, TRUE, "City" },
> +	{ 110, TRUE, "Government" },
> +	{ 111, TRUE, "USA" },
> +	{ 112, TRUE, "State" },
> +	{ 113, TRUE, "Resort" },
> +	{ 114, TRUE, "Headquarters" },
> +	{ 115, TRUE, "Personal" },
> +	{ 116, FALSE, "Home" },
> +	{ 117, TRUE, "Residential" },
> +	{ 118, TRUE, "University" },
> +	{ 119, TRUE, "College" },
> +	{ 120, TRUE, "Hotel Guest" },
> +	{ 121, TRUE, "Rental" },
> +	{ 122, FALSE, "Corporate" },
> +	{ 123, FALSE, "Home Provider" },
> +	{ 124, TRUE, "International" },
> +	{ 125, TRUE, "International" },
> +	{ 126, TRUE, "International" },
> +	{ 127, FALSE, "Premium Service" },
> +	{ 128, FALSE, "Enhanced Service" },
> +	{ 129, FALSE, "Enhanced Digital" },
> +	{ 130, FALSE, "Enhanced Roaming" },
> +	{ 131, FALSE, "Alliance Service" },
> +	{ 132, FALSE, "Alliance Network" },
> +	{ 133, FALSE, "Data Roaming" },	/* Sprint: Vision Roaming */
> +	{ 134, FALSE, "Extended Service" },
> +	{ 135, FALSE, "Expanded Services" },
> +	{ 136, FALSE, "Expanded Network" },
> +	{ 137, TRUE, "Premium Service" },
> +	{ 138, TRUE, "Enhanced Service" },
> +	{ 139, TRUE, "Enhanced Digital" },
> +	{ 140, TRUE, "Enhanced Roaming" },
> +	{ 141, TRUE, "Alliance Service" },
> +	{ 142, TRUE, "Alliance Network" },
> +	{ 143, TRUE, "Data Roaming" },	/* Sprint: Vision Roaming */
> +	{ 144, TRUE, "Extended Service" },
> +	{ 145, TRUE, "Expanded Services" },
> +	{ 146, TRUE, "Expanded Network" },
> +	{ 147, TRUE, "Premium Service" },
> +	{ 148, TRUE, "Enhanced Service" },
> +	{ 149, TRUE, "Enhanced Digital" },
> +	{ 150, TRUE, "Enhanced Roaming" },
> +	{ 151, TRUE, "Alliance Service" },
> +	{ 152, TRUE, "Alliance Network" },
> +	{ 153, TRUE, "Data Roaming" },	/* Sprint: Vision Roaming */
> +	{ 154, TRUE, "Extended Service" },
> +	{ 155, TRUE, "Expanded Services" },
> +	{ 156, TRUE, "Expanded Network" },
> +	{ 157, TRUE, "Premium International" },
> +	{ 158, TRUE, "Premium International" },
> +	{ 159, TRUE, "Premium International" },
> +	{ 160, TRUE, NULL },
> +	{ 161, TRUE, NULL },
> +	{ 162, FALSE, NULL },
> +	{ 163, FALSE, NULL },
> +	{ 164, FALSE, "Extended Voice/Data Network" },
> +	{ 165, FALSE, "Extended Voice/Data Network" },
> +	{ 166, TRUE, "Extended Voice/Data Network" },
> +	{ 167, FALSE, "Extended Broadband" },
> +	{ 168, FALSE, "Extended Broadband" },
> +	{ 169, TRUE, "Extended Broadband" },
> +	{ 170, FALSE, "Extended Data" },
> +	{ 171, FALSE, "Extended Data" },
> +	{ 172, TRUE, "Extended Data" },
> +	{ 173, FALSE, "Extended Data Network" },
> +	{ 174, FALSE, "Extended Data Network" },
> +	{ 175, TRUE, "Extended Data Network" },
> +	{ 176, FALSE, "Extended Network" },
> +	{ 177, FALSE, "Extended Network" },
> +	{ 178, TRUE, "Extended Network" },
> +	{ 179, FALSE, "Extended Service" },
> +	{ 180, TRUE, "Extended Service" },
> +	{ 181, FALSE, "Extended Voice" },
> +	{ 182, FALSE, "Extended Voice" },
> +	{ 183, TRUE, "Extended Voice" },
> +	{ 184, FALSE, "Extended Voice/Data" },
> +	{ 185, FALSE, "Extended Voice/Data" },
> +	{ 186, TRUE, "Extended Voice/Data" },
> +	{ 187, FALSE, "Extended Voice Network" },
> +	{ 188, FALSE, "Extended Voice Network" },
> +	{ 189, TRUE, "Extended Voice Network" },
> +	{ 190, FALSE, "Extended Voice/Data" },
> +	{ 191, FALSE, "Extended Voice/Data" },
> +	{ 192, TRUE, "Extended Voice/Data" },
> +	{ 193, TRUE, "International" },
> +	{ 194, FALSE, "International Services" },
> +	{ 195, FALSE, "International Voice" },
> +	{ 196, FALSE, "International Voice/Data" },
> +	{ 197, FALSE, "International Voice/Data" },
> +	{ 198, TRUE, "International Voice/Data" },
> +	{ 199, FALSE, "Extended Voice/Data Network" },
> +	{ 200, TRUE, "Extended Voice/Data Network" },
> +	{ 201, TRUE, "Extended Voice/Data Network" },
> +	{ 202, FALSE, "Extended Broadband" },
> +	{ 203, TRUE, "Extended Broadband" },
> +	{ 204, TRUE, "Extended Broadband" },
> +	{ 205, FALSE, "Extended Data" },
> +	{ 206, TRUE, "Extended Data" },
> +	{ 207, TRUE, "Extended Data" },
> +	{ 208, FALSE, "Extended Data Network" },
> +	{ 209, TRUE, "Extended Data Network" },
> +	{ 210, TRUE, "Extended Data Network" },
> +	{ 211, FALSE, "Extended Network" },
> +	{ 212, TRUE, "Extended Network" },
> +	{ 213, FALSE, "Extended Service" },
> +	{ 214, TRUE, "Extended Service" },
> +	{ 215, TRUE, "Extended Service" },
> +	{ 216, FALSE, "Extended Voice" },
> +	{ 217, TRUE, "Extended Voice" },
> +	{ 218, TRUE, "Extended Voice" },
> +	{ 219, FALSE, "Extended Voice/Data" },
> +	{ 220, TRUE, "Extended Voice/Data" },
> +	{ 221, TRUE, "Extended Voice/Data" },
> +	{ 222, FALSE, "Extended Voice Network" },
> +	{ 223, FALSE, "Extended Voice Network" },
> +	{ 224, TRUE, "Extended Voice Network" },
> +	{ 225, FALSE, "Extended Voice/Data" },
> +	{ 226, TRUE, "Extended Voice/Data" },
> +	{ 227, TRUE, "Extended Voice/Data" },
> +	{ 228, TRUE, "International" },
> +	{ 229, TRUE, "International" },
> +	{ 230, TRUE, "International Services" },
> +	{ 231, TRUE, "International Voice" },
> +	{ 232, FALSE, "International Voice/Data" },
> +	{ 233, TRUE, "International Voice/Data" },
> +	{ 234, TRUE, "International Voice/Data" },
> +	{ 235, TRUE, "Premium International" },
> +	{ 236, TRUE, NULL },
> +	{ 237, TRUE, NULL },
> +	{ 238, FALSE, NULL },
> +	{ 239, FALSE, NULL },
> +	{ -1, FALSE, NULL },
> +};
> +
> +gboolean sierramodem_parse_eri(const gchar *reply, gboolean *out_roaming,
> +					guint *out_ind, const gchar **out_desc)
> +{
> +	guint ind;
> +	const EriItem *iter =&eris[0];
> +	gboolean found = FALSE;
> +
> +	g_return_val_if_fail(reply != NULL, FALSE);
> +	g_return_val_if_fail(out_roaming != NULL, FALSE);
> +
> +	if (get_uint_from_str(reply,&ind)) {
> +		if (out_ind)
> +			*out_ind = ind;
> +
> +		while (iter->num != -1) {
> +			if (iter->num == ind) {
> +				*out_roaming = iter->roam_ind;
> +				if (out_desc)
> +					*out_desc = iter->banner;
> +				found = TRUE;
> +				break;
> +			}
> +			iter++;
> +		}
> +	}
> +
> +	return found;

In general this is not how we structure code like this.  Preferred way 
would be something like:

while () {
	if (iter->num != ind)
		continue;

	blah;
	return TRUE;
}

return FALSE;

> +}

Regards,
-Denis

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

* Re: [PATCH 4/8] sierramodem: Report network registration status
  2012-12-28 19:35 ` [PATCH 4/8] sierramodem: Report network registration status Forest Bond
@ 2012-12-31  2:26   ` Denis Kenzior
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:26 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

On 12/28/2012 01:35 PM, Forest Bond wrote:
> From: Forest Bond<forest.bond@rapidrollout.com>
>
> The modem is polled every 5 seconds (unless inhibited by PPP)
> using AT!STATUS.

How is PPP entering the equation?  In Patch 5 you're using "swmodem" 
gprs-context driver, which is not PPP based AFAIK.

> ---
>   drivers/sierramodem/cdma-netreg.c |  300 +++++++++++++++++++++++++++++++++++++
>   1 files changed, 300 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/sierramodem/cdma-netreg.c b/drivers/sierramodem/cdma-netreg.c
> index 109b245..4cca769 100644
> --- a/drivers/sierramodem/cdma-netreg.c
> +++ b/drivers/sierramodem/cdma-netreg.c
> @@ -3,6 +3,9 @@
>    *  oFono - Open Source Telephony
>    *
>    *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
> + *  Copyright (C) 2008-2009  Novell, Inc.
> + *  Copyright (C) 2009-2012  Red Hat, Inc.
> + *  Copyright (C) 2012  Lanedo GmbH.
>    *  Copyright (C) 2012  Outpost Embedded, LLC. All rights reserved.
>    *
>    *  This program is free software; you can redistribute it and/or modify
> @@ -27,6 +30,8 @@
>   #define _GNU_SOURCE
>   #include<glib.h>
>   #include<errno.h>
> +#include<ctype.h>
> +#include<string.h>
>
>   #include<ofono/log.h>
>   #include<ofono/modem.h>
> @@ -35,11 +40,300 @@
>   #include "gatchat.h"
>
>   #include "sierramodem.h"
> +#include "eri.h"
>
>   struct sierra_netreg_data {
>   	GAtChat *chat;
> +	guint status_id;
> +	guint status_source;
>   };
>
> +/* NOTE: STATUS parsing functions originated in ModemManager. */
> +
> +typedef enum {
> +	SYS_MODE_UNKNOWN,
> +	SYS_MODE_NO_SERVICE,
> +	SYS_MODE_CDMA_1X,
> +	SYS_MODE_EVDO_REV0,
> +	SYS_MODE_EVDO_REVA
> +} SysMode;
> +

Again, no CamelCase or typedefs please.

Regards,
-Denis

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2012-12-28 19:36 ` [PATCH 7/8] sierra: Support CDMA modems Forest Bond
@ 2012-12-31  2:34   ` Denis Kenzior
  2013-03-04 16:48     ` Forest Bond
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:34 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

> -	ofono_netreg_create(modem, 0, "atmodem", data->modem);
> +	if (data->have_gsm == TRUE) {
> +		ofono_netreg_create(modem, 0, "atmodem", data->modem);
> +	} else if (data->have_cdma == TRUE) {
> +		/*
> +		 * Once we have CnS protocol support, we should be able to do
> +		 * netreg that way instead of using the same port for both.
> +		 */
> +		ofono_cdma_netreg_create(modem, 0, "sierramodem", data->modem);
> +		ofono_cdma_connman_create(modem, OFONO_VENDOR_SIERRA,
> +						"cdmamodem", data->modem);
> +	}

Ah I see what you're doing now.  This is really not going to work too 
well if you have just one AT port available...

Regards,
-Denis

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

* Re: [PATCH 5/8] sierra: Create GPRS context in post_sim function
  2012-12-28 19:35 ` [PATCH 5/8] sierra: Create GPRS context in post_sim function Forest Bond
@ 2012-12-31  2:39   ` Denis Kenzior
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:39 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

On 12/28/2012 01:35 PM, Forest Bond wrote:
> From: Forest Bond<forest.bond@rapidrollout.com>
>
> This matches the huawei plugin.
> ---
>   plugins/sierra.c |   16 ++++++++--------
>   1 files changed, 8 insertions(+), 8 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 6/8] sierra: Initialize GSM error reporting separately
  2012-12-28 19:36 ` [PATCH 6/8] sierra: Initialize GSM error reporting separately Forest Bond
@ 2012-12-31  2:40   ` Denis Kenzior
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2012-12-31  2:40 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

On 12/28/2012 01:36 PM, Forest Bond wrote:
> From: Forest Bond<forest.bond@rapidrollout.com>
>
> ---
>   plugins/sierra.c |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2012-12-31  2:34   ` Denis Kenzior
@ 2013-03-04 16:48     ` Forest Bond
  2013-03-04 23:03       ` Denis Kenzior
  0 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2013-03-04 16:48 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

On Sun, Dec 30, 2012 at 08:34:29PM -0600, Denis Kenzior wrote:
> >-	ofono_netreg_create(modem, 0, "atmodem", data->modem);
> >+	if (data->have_gsm == TRUE) {
> >+		ofono_netreg_create(modem, 0, "atmodem", data->modem);
> >+	} else if (data->have_cdma == TRUE) {
> >+		/*
> >+		 * Once we have CnS protocol support, we should be able to do
> >+		 * netreg that way instead of using the same port for both.
> >+		 */
> >+		ofono_cdma_netreg_create(modem, 0, "sierramodem", data->modem);
> >+		ofono_cdma_connman_create(modem, OFONO_VENDOR_SIERRA,
> >+						"cdmamodem", data->modem);
> >+	}
> 
> Ah I see what you're doing now.  This is really not going to work
> too well if you have just one AT port available...

I'm looking to pick this series back up now.  I understand the implementation is
not ideal, but it at least provides for basic connectivity until we have support
for the CnS protocol.  Will you accept the full series if I address the other
issues with the code that you mentioned?

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-04 16:48     ` Forest Bond
@ 2013-03-04 23:03       ` Denis Kenzior
  2013-03-05 19:36         ` Forest Bond
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Kenzior @ 2013-03-04 23:03 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

On 03/04/2013 10:48 AM, Forest Bond wrote:
> Hi Denis,
>
> On Sun, Dec 30, 2012 at 08:34:29PM -0600, Denis Kenzior wrote:
>>> -	ofono_netreg_create(modem, 0, "atmodem", data->modem);
>>> +	if (data->have_gsm == TRUE) {
>>> +		ofono_netreg_create(modem, 0, "atmodem", data->modem);
>>> +	} else if (data->have_cdma == TRUE) {
>>> +		/*
>>> +		 * Once we have CnS protocol support, we should be able to do
>>> +		 * netreg that way instead of using the same port for both.
>>> +		 */
>>> +		ofono_cdma_netreg_create(modem, 0, "sierramodem", data->modem);
>>> +		ofono_cdma_connman_create(modem, OFONO_VENDOR_SIERRA,
>>> +						"cdmamodem", data->modem);
>>> +	}
>>
>> Ah I see what you're doing now.  This is really not going to work
>> too well if you have just one AT port available...
>
> I'm looking to pick this series back up now.  I understand the implementation is
> not ideal, but it at least provides for basic connectivity until we have support
> for the CnS protocol.  Will you accept the full series if I address the other
> issues with the code that you mentioned?

If we accept something upstream we assume full responsibility for the 
code, and everything that entails, including future maintenance.  Thus 
we do not have a habit of accepting functionality that is inherently 
broken.  So unless you can convince me otherwise, my answer is: "I'd 
rather not" ;)

Regards,
-Denis

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-04 23:03       ` Denis Kenzior
@ 2013-03-05 19:36         ` Forest Bond
  2013-03-05 20:52           ` Denis Kenzior
  2013-03-05 21:45           ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
  0 siblings, 2 replies; 23+ messages in thread
From: Forest Bond @ 2013-03-05 19:36 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

On Mon, Mar 04, 2013 at 05:03:37PM -0600, Denis Kenzior wrote:
> On 03/04/2013 10:48 AM, Forest Bond wrote:
> >On Sun, Dec 30, 2012 at 08:34:29PM -0600, Denis Kenzior wrote:
> >>>-	ofono_netreg_create(modem, 0, "atmodem", data->modem);
> >>>+	if (data->have_gsm == TRUE) {
> >>>+		ofono_netreg_create(modem, 0, "atmodem", data->modem);
> >>>+	} else if (data->have_cdma == TRUE) {
> >>>+		/*
> >>>+		 * Once we have CnS protocol support, we should be able to do
> >>>+		 * netreg that way instead of using the same port for both.
> >>>+		 */
> >>>+		ofono_cdma_netreg_create(modem, 0, "sierramodem", data->modem);
> >>>+		ofono_cdma_connman_create(modem, OFONO_VENDOR_SIERRA,
> >>>+						"cdmamodem", data->modem);
> >>>+	}
> >>
> >>Ah I see what you're doing now.  This is really not going to work
> >>too well if you have just one AT port available...
> >
> >I'm looking to pick this series back up now.  I understand the implementation is
> >not ideal, but it at least provides for basic connectivity until we have support
> >for the CnS protocol.  Will you accept the full series if I address the other
> >issues with the code that you mentioned?
> 
> If we accept something upstream we assume full responsibility for
> the code, and everything that entails, including future maintenance.
> Thus we do not have a habit of accepting functionality that is
> inherently broken.  So unless you can convince me otherwise, my
> answer is: "I'd rather not" ;)

Well I think the argument to make is that we ought to be able to gracefully
degrade to handle a device that we have limited support for.  We know how to
bring up a connection on this device.  I think users would prefer to have a
device that works with a limited feature set than one that doesn't work at all.

Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
support is partially implemented in oFono?  But I don't know QCDM at all.  Can
we use it to do netreg?

If not, I could probably implement (partial) CnS support at some point.  I'm
just not sure I will have time to do it right away.

I assume a proper netreg implementation on one of these other ports would
address your primary concern?

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-05 19:36         ` Forest Bond
@ 2013-03-05 20:52           ` Denis Kenzior
  2013-03-05 21:45           ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
  1 sibling, 0 replies; 23+ messages in thread
From: Denis Kenzior @ 2013-03-05 20:52 UTC (permalink / raw)
  To: ofono

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

Hi Forest,

>>> I'm looking to pick this series back up now.  I understand the implementation is
>>> not ideal, but it at least provides for basic connectivity until we have support
>>> for the CnS protocol.  Will you accept the full series if I address the other
>>> issues with the code that you mentioned?
>>
>> If we accept something upstream we assume full responsibility for
>> the code, and everything that entails, including future maintenance.
>> Thus we do not have a habit of accepting functionality that is
>> inherently broken.  So unless you can convince me otherwise, my
>> answer is: "I'd rather not" ;)
>
> Well I think the argument to make is that we ought to be able to gracefully
> degrade to handle a device that we have limited support for.  We know how to
> bring up a connection on this device.  I think users would prefer to have a
> device that works with a limited feature set than one that doesn't work at all.

Don't get me wrong, we do want to enable as many devices as possible... 
The problem is that the oFono clients do not know when the device is in 
'degraded' mode.  Our assumption was that we always have multiple AT 
ports available or we are using high-speed interfaces.  If the AT chat 
is blocked by PPP, then we can't even get basic things like signal 
strength notifications while on a data connection.  To me that is 
unacceptable, especially since we know that any AT command based 
implementation is a long-term dead end.

>
> Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
> support is partially implemented in oFono?  But I don't know QCDM at all.  Can
> we use it to do netreg?

oFono QCDM support is quite bare, not much beyond a test tool. 
Contributions are always welcome!

>
> If not, I could probably implement (partial) CnS support at some point.  I'm
> just not sure I will have time to do it right away.
>

That would be great.

> I assume a proper netreg implementation on one of these other ports would
> address your primary concern?

Yep, correct.

>
> Thanks,
> Forest

Regards,
-Denis

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-05 19:36         ` Forest Bond
  2013-03-05 20:52           ` Denis Kenzior
@ 2013-03-05 21:45           ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
  2013-03-05 22:15             ` Forest Bond
  1 sibling, 1 reply; 23+ messages in thread
From: =?unknown-8bit?q?Bj=C3=B8rn?= Mork @ 2013-03-05 21:45 UTC (permalink / raw)
  To: ofono

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

Forest Bond <forest@alittletooquiet.net> writes:

> Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
> support is partially implemented in oFono?  But I don't know QCDM at all.  Can
> we use it to do netreg?

What kind of Sierra device is this?  And what vid is it using?

I ask because I have only seen QCDM ports active on Sierra devices
in firmware modes with rmnet/qmi_wwan interfaces.  In which case you
should have QMI support.

> If not, I could probably implement (partial) CnS support at some point.  I'm
> just not sure I will have time to do it right away.

And those modes do not have any CnS ports.


Bjørn

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-05 21:45           ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
@ 2013-03-05 22:15             ` Forest Bond
  2013-03-06  9:43               ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
  0 siblings, 1 reply; 23+ messages in thread
From: Forest Bond @ 2013-03-05 22:15 UTC (permalink / raw)
  To: ofono

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

Hi Bjørn,

On Tue, Mar 05, 2013 at 10:45:15PM +0100, Bjørn Mork wrote:
> Forest Bond <forest@alittletooquiet.net> writes:
> 
> > Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
> > support is partially implemented in oFono?  But I don't know QCDM at all.  Can
> > we use it to do netreg?
> 
> What kind of Sierra device is this?  And what vid is it using?

Well, I'm really after a few devices:

* Sierra Wireless USB 598 (Sprint/Telus branded)
* Sierra Wireless MC5728V (Feeney Wireless Skyus 3G)

The 598 has VID 0025.  I think the Skyus 3G does, too (at least in some
configurations), but I don't have one in front of me to check.  In any case it
is a very similar part to the 598.  All I have to test with right now is a Telus
demo device (with no service :/) as my other parts were returned to their
respective owners some time ago.

> I ask because I have only seen QCDM ports active on Sierra devices
> in firmware modes with rmnet/qmi_wwan interfaces.  In which case you
> should have QMI support.

I couldn't get qmicli to do anything with any of the ports, but test-qcdm (from
the ModemManager source tree) seems to like talking to the last port.

> > If not, I could probably implement (partial) CnS support at some point.  I'm
> > just not sure I will have time to do it right away.
> 
> And those modes do not have any CnS ports.

These parts definitely have CnS ports.  We've used CnS for an unrelated project
with all of these devices.

In all, I think the ports are as follows:

1. AT commands
2. CnS
3. NMEA 0183 (GPS)
4. QCDM

WRT #3, I remember seeing what looked like NMEA a while back using a Sprint
part.  WRT #4 I've only ever tested the Telus part.

What do you think?

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-05 22:15             ` Forest Bond
@ 2013-03-06  9:43               ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
  2013-03-06 13:36                 ` Forest Bond
  0 siblings, 1 reply; 23+ messages in thread
From: =?unknown-8bit?q?Bj=C3=B8rn?= Mork @ 2013-03-06  9:43 UTC (permalink / raw)
  To: ofono

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

Forest Bond <forest@alittletooquiet.net> writes:
> On Tue, Mar 05, 2013 at 10:45:15PM +0100, Bjørn Mork wrote:
>> Forest Bond <forest@alittletooquiet.net> writes:
>> 
>> > Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
>> > support is partially implemented in oFono?  But I don't know QCDM at all.  Can
>> > we use it to do netreg?
>> 
>> What kind of Sierra device is this?  And what vid is it using?
>
> Well, I'm really after a few devices:
>
> * Sierra Wireless USB 598 (Sprint/Telus branded)
> * Sierra Wireless MC5728V (Feeney Wireless Skyus 3G)
>
> The 598 has VID 0025.  I think the Skyus 3G does, too (at least in some
> configurations), but I don't have one in front of me to check.  In any case it
> is a very similar part to the 598.  All I have to test with right now is a Telus
> demo device (with no service :/) as my other parts were returned to their
> respective owners some time ago.
>
>> I ask because I have only seen QCDM ports active on Sierra devices
>> in firmware modes with rmnet/qmi_wwan interfaces.  In which case you
>> should have QMI support.
>
> I couldn't get qmicli to do anything with any of the ports, but test-qcdm (from
> the ModemManager source tree) seems to like talking to the last port.
>
>> > If not, I could probably implement (partial) CnS support at some point.  I'm
>> > just not sure I will have time to do it right away.
>> 
>> And those modes do not have any CnS ports.
>
> These parts definitely have CnS ports.  We've used CnS for an unrelated project
> with all of these devices.
>
> In all, I think the ports are as follows:
>
> 1. AT commands
> 2. CnS
> 3. NMEA 0183 (GPS)
> 4. QCDM
>
> WRT #3, I remember seeing what looked like NMEA a while back using a Sprint
> part.  WRT #4 I've only ever tested the Telus part.
>
> What do you think?

Thanks.  I think you are right.  Learning something new every day.
Until know I thought they had a clear split between "Qualcomm" and
"Sierra" protocols, but these devices obviously do a mix.  Is the NMEA
port Sierra style (enabled using the SetNmea control message) or
Qualcomm style (enabled by writing "$GPS_START" to the port)?


Bjørn

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

* Re: [PATCH 7/8] sierra: Support CDMA modems
  2013-03-06  9:43               ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
@ 2013-03-06 13:36                 ` Forest Bond
  0 siblings, 0 replies; 23+ messages in thread
From: Forest Bond @ 2013-03-06 13:36 UTC (permalink / raw)
  To: ofono

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

Hi Bjørn,

On Wed, Mar 06, 2013 at 10:43:27AM +0100, Bjørn Mork wrote:
> Forest Bond <forest@alittletooquiet.net> writes:
> > On Tue, Mar 05, 2013 at 10:45:15PM +0100, Bjørn Mork wrote:
> >> Forest Bond <forest@alittletooquiet.net> writes:
> >> 
> >> > Anyway, I notice that one of the ports appears to be QCDM.  It appears that QCDM
> >> > support is partially implemented in oFono?  But I don't know QCDM at all.  Can
> >> > we use it to do netreg?
> >> 
> >> What kind of Sierra device is this?  And what vid is it using?
> >
> > Well, I'm really after a few devices:
> >
> > * Sierra Wireless USB 598 (Sprint/Telus branded)
> > * Sierra Wireless MC5728V (Feeney Wireless Skyus 3G)
> >
> > The 598 has VID 0025.  I think the Skyus 3G does, too (at least in some
> > configurations), but I don't have one in front of me to check.  In any case it
> > is a very similar part to the 598.  All I have to test with right now is a Telus
> > demo device (with no service :/) as my other parts were returned to their
> > respective owners some time ago.
> >
> >> I ask because I have only seen QCDM ports active on Sierra devices
> >> in firmware modes with rmnet/qmi_wwan interfaces.  In which case you
> >> should have QMI support.
> >
> > I couldn't get qmicli to do anything with any of the ports, but test-qcdm (from
> > the ModemManager source tree) seems to like talking to the last port.
> >
> >> > If not, I could probably implement (partial) CnS support at some point.  I'm
> >> > just not sure I will have time to do it right away.
> >> 
> >> And those modes do not have any CnS ports.
> >
> > These parts definitely have CnS ports.  We've used CnS for an unrelated project
> > with all of these devices.
> >
> > In all, I think the ports are as follows:
> >
> > 1. AT commands
> > 2. CnS
> > 3. NMEA 0183 (GPS)
> > 4. QCDM
> >
> > WRT #3, I remember seeing what looked like NMEA a while back using a Sprint
> > part.  WRT #4 I've only ever tested the Telus part.
> >
> > What do you think?
> 
> Thanks.  I think you are right.  Learning something new every day.
> Until know I thought they had a clear split between "Qualcomm" and
> "Sierra" protocols, but these devices obviously do a mix.  Is the NMEA
> port Sierra style (enabled using the SetNmea control message) or
> Qualcomm style (enabled by writing "$GPS_START" to the port)?

Sierra style.  Passing nmea=1 to the sierra kernel module enables it.

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2013-03-06 13:36 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-28 19:31 [PATCH 0/8] Sierra Wireless CDMA modem support Forest Bond
2012-12-28 19:34 ` [PATCH 1/8] sierramodem: Add skeleton for Sierra Wireless modem driver Forest Bond
2012-12-28 19:34 ` [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver Forest Bond
2012-12-31  2:11   ` Denis Kenzior
2012-12-28 19:35 ` [PATCH 3/8] sierramodem: Add ERI parsing functions Forest Bond
2012-12-31  2:19   ` Denis Kenzior
2012-12-28 19:35 ` [PATCH 4/8] sierramodem: Report network registration status Forest Bond
2012-12-31  2:26   ` Denis Kenzior
2012-12-28 19:35 ` [PATCH 5/8] sierra: Create GPRS context in post_sim function Forest Bond
2012-12-31  2:39   ` Denis Kenzior
2012-12-28 19:36 ` [PATCH 6/8] sierra: Initialize GSM error reporting separately Forest Bond
2012-12-31  2:40   ` Denis Kenzior
2012-12-28 19:36 ` [PATCH 7/8] sierra: Support CDMA modems Forest Bond
2012-12-31  2:34   ` Denis Kenzior
2013-03-04 16:48     ` Forest Bond
2013-03-04 23:03       ` Denis Kenzior
2013-03-05 19:36         ` Forest Bond
2013-03-05 20:52           ` Denis Kenzior
2013-03-05 21:45           ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
2013-03-05 22:15             ` Forest Bond
2013-03-06  9:43               ` =?unknown-8bit?q?Bj=C3=B8rn?= Mork
2013-03-06 13:36                 ` Forest Bond
2012-12-28 19:36 ` [PATCH 8/8] udevng: Support single-interface sierra devices Forest Bond

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.