From: Forest Bond <forest@alittletooquiet.net>
To: ofono@ofono.org
Subject: [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver
Date: Fri, 28 Dec 2012 14:34:58 -0500 [thread overview]
Message-ID: <20121228193458.GH18339@alittletooquiet.net> (raw)
In-Reply-To: <20121228193141.GF18339@alittletooquiet.net>
[-- 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
next prev parent reply other threads:[~2012-12-28 19:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2012-12-31 2:11 ` [PATCH 2/8] sierramodem: Add skeleton cdma netreg driver 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121228193458.GH18339@alittletooquiet.net \
--to=forest@alittletooquiet.net \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox