All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt
@ 2010-08-13 10:53 Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 10:53 ` [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 83aa8f3..2f0b745 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -301,7 +301,7 @@ doc_files = doc/overview.txt doc/ofono-paper.txt \
 			doc/call-forwarding-api.txt doc/call-settings-api.txt \
 			doc/call-meter-api.txt \
 			doc/supplementaryservices-api.txt \
-			doc/dataconnectionmanager-api.txt
+			doc/connman-api.txt
 
 test_scripts = test/activate-context \
 		test/create-context \
-- 
1.7.0.4


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

* [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate.
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 10:53 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 19:02   ` Denis Kenzior
  2010-08-13 10:53 ` [PATCH 3/6] stemodem: Add support for STK Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

---
 drivers/stemodem/if_caif.h |   48 +++++--------------------------------------
 1 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/drivers/stemodem/if_caif.h b/drivers/stemodem/if_caif.h
index ad3686b..5e7eed4 100644
--- a/drivers/stemodem/if_caif.h
+++ b/drivers/stemodem/if_caif.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) ST-Ericsson AB 2009
+ * Copyright (C) ST-Ericsson AB 2010
  * Author:	Sjur Brendeland/ sjur.brandeland(a)stericsson.com
  * License terms: GNU General Public License (GPL) version 2
  */
@@ -9,57 +9,21 @@
 #include <linux/sockios.h>
 #include <linux/types.h>
 #include <linux/socket.h>
-/**
- * enum sioc_caif -	SOCKIO for creating new CAIF Net Devices.
- * @SIOCCAIFNETNEW:	Used to create a new instance of the CAIF IP Interface.
- *			struct ifreq containing struct ifcaif_param are used
- *			as parameters. ifr_name must be filled in.
- * @SIOCCAIFNETCHANGE:	As above, but changes a disconnected CAIF IP Inteface.
- * @SIOCCAIFNETREMOVE:	Removes a CAIF IP Interface.
- *
- * CAIF IP Interface can be created, changed and deleted,
- * by this enum. In addition standard Socket IO Controls (SIGIOC*)
- * can be used to manage standard IP Interface parameters.
- * The struct ifreq are used to carry parameters.
- */
-enum sioc_caif {
-	SIOCCAIFNETNEW = SIOCPROTOPRIVATE,
-	SIOCCAIFNETCHANGE,
-	SIOCCAIFNETREMOVE
-};
-
 
 /**
- * struct ifcaif_param - Parameters for creating CAIF Network Interface.
- *
- * When using SIOCCAIFNETNEW to create a CAIF IP interface, this structure
- * is used for configuration data.
- * The attribute ifr_ifru.ifru_data in struct struct ifreq must be set
- * point at an instance of struct ifcaif_param.
- *
- * @ipv4_connid:  Connection ID for IPv4 PDP Context.
- * @ipv6_connid:  Connection ID for IPv6 PDP Context.
- * @loop:	  If different from zero, device is doing loopback
- */
-struct ifcaif_param {
-	__u32			ipv4_connid;
-	__u32			ipv6_connid;
-	__u8			loop;
-};
-
-/**
- * enum ifla_caif
- * When using RT Netlink to create, destroy or configure a CAIF IP interface,
- * enum ifla_caif is used to specify the configuration attributes.
- *
+ * enum ifla_caif - CAIF NetlinkRT parameters.
  * @IFLA_CAIF_IPV4_CONNID:  Connection ID for IPv4 PDP Context.
  *			    The type of attribute is NLA_U32.
  * @IFLA_CAIF_IPV6_CONNID:  Connection ID for IPv6 PDP Context.
  *			    The type of attribute is NLA_U32.
  * @IFLA_CAIF_LOOPBACK:	    If different from zero, device is doing loopback
  *			    The type of attribute is NLA_U8.
+ *
+ * When using RT Netlink to create, destroy or configure a CAIF IP interface,
+ * enum ifla_caif is used to specify the configuration attributes.
  */
 enum ifla_caif {
+	__IFLA_CAIF_UNSPEC,
 	IFLA_CAIF_IPV4_CONNID,
 	IFLA_CAIF_IPV6_CONNID,
 	IFLA_CAIF_LOOPBACK,
-- 
1.7.0.4


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

* [PATCH 3/6] stemodem: Add support for STK.
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 10:53 ` [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 10:53 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 18:13   ` Denis Kenzior
  2010-08-13 10:53 ` [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

Copy and rename stk.c from mbmmodem.c
Original author: Andrzej Zaborowski <andrew.zaborowski@intel.com>
---
 Makefile.am                 |    3 +-
 drivers/stemodem/stemodem.c |    2 +
 drivers/stemodem/stemodem.h |    2 +
 drivers/stemodem/stk.c      |  245 +++++++++++++++++++++++++++++++++++++++++++
 plugins/ste.c               |    2 +
 5 files changed, 253 insertions(+), 1 deletions(-)
 create mode 100644 drivers/stemodem/stk.c

diff --git a/Makefile.am b/Makefile.am
index 2f0b745..82e0c0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -204,7 +204,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/stemodem/voicecall.c \
 			drivers/stemodem/gprs-context.c \
 			drivers/stemodem/caif_socket.h \
-			drivers/stemodem/if_caif.h
+			drivers/stemodem/if_caif.h \
+			drivers/stemodem/stk.c
 
 builtin_modules += phonesim
 builtin_sources += plugins/phonesim.c
diff --git a/drivers/stemodem/stemodem.c b/drivers/stemodem/stemodem.c
index c18a8b5..34dab80 100644
--- a/drivers/stemodem/stemodem.c
+++ b/drivers/stemodem/stemodem.c
@@ -38,6 +38,7 @@ static int stemodem_init(void)
 {
 	ste_voicecall_init();
 	ste_gprs_context_init();
+	ste_stk_init();
 
 	return 0;
 }
@@ -46,6 +47,7 @@ static void stemodem_exit(void)
 {
 	ste_voicecall_exit();
 	ste_gprs_context_exit();
+	ste_stk_exit();
 }
 
 OFONO_PLUGIN_DEFINE(stemodem, "STE modem driver", VERSION,
diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
index 267e001..27123d4 100644
--- a/drivers/stemodem/stemodem.h
+++ b/drivers/stemodem/stemodem.h
@@ -28,3 +28,5 @@ extern void ste_gprs_context_exit();
 extern void ste_voicecall_init();
 extern void ste_voicecall_exit();
 
+extern void ste_stk_init();
+extern void ste_stk_exit();
diff --git a/drivers/stemodem/stk.c b/drivers/stemodem/stk.c
new file mode 100644
index 0000000..2c39114
--- /dev/null
+++ b/drivers/stemodem/stk.c
@@ -0,0 +1,245 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/stk.h>
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "stemodem.h"
+
+struct stk_data {
+	GAtChat *chat;
+};
+
+static const char *stke_prefix[] = { "%STKE:", NULL };
+static const char *none_prefix[] = { NULL };
+
+static void ste_stke_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_stk_envelope_cb_t cb = cbd->cb;
+	GAtResultIter iter;
+	struct ofono_error error;
+	const guint8 *pdu = NULL;
+	gint len = 0;
+
+	decode_at_error(&error, g_at_result_final_response(result));
+
+	if (!ok) {
+		cb(&error, NULL, 0, cbd->data);
+		return;
+	}
+
+	g_at_result_iter_init(&iter, result);
+
+	if (g_at_result_iter_next(&iter, "*STKE:") == TRUE)
+		if (g_at_result_iter_next_hexstring(&iter, &pdu, &len) == FALSE)
+			goto error;
+
+	cb(&error, pdu, len, cbd->data);
+	return;
+
+error:
+	CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
+}
+
+static void ste_stk_envelope(struct ofono_stk *stk, int length,
+				const unsigned char *command,
+				ofono_stk_envelope_cb_t cb, void *data)
+{
+	struct stk_data *sd = ofono_stk_get_data(stk);
+	struct cb_data *cbd = cb_data_new(cb, data);
+	char *buf = g_try_new(char, 64 + length * 2);
+	int len, ret;
+
+	if (!cbd || !buf)
+		goto error;
+
+	len = sprintf(buf, "AT*STKE=\"");
+	for (; length; length--)
+		len += sprintf(buf + len, "%02hhX", *command++);
+	len += sprintf(buf + len, "\"");
+
+	ret = g_at_chat_send(sd->chat, buf, stke_prefix,
+				ste_stke_cb, cbd, g_free);
+
+	g_free(buf);
+	buf = NULL;
+
+	if (ret > 0)
+		return;
+
+error:
+	g_free(buf);
+	g_free(cbd);
+
+	CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
+}
+
+static void ste_stkr_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_stk_generic_cb_t cb = cbd->cb;
+	struct ofono_error error;
+
+	decode_at_error(&error, g_at_result_final_response(result));
+	cb(&error, cbd->data);
+}
+
+static void ste_stk_terminal_response(struct ofono_stk *stk, int length,
+					const unsigned char *command,
+					ofono_stk_generic_cb_t cb, void *data)
+{
+	struct stk_data *sd = ofono_stk_get_data(stk);
+	struct cb_data *cbd = cb_data_new(cb, data);
+	char *buf = g_try_new(char, 64 + length * 2);
+	int len, ret;
+
+	if (!cbd || !buf)
+		goto error;
+
+	len = sprintf(buf, "AT*STKR=\"");
+	for (; length; length--)
+		len += sprintf(buf + len, "%02hhX", *command++);
+	len += sprintf(buf + len, "\"");
+
+	ret = g_at_chat_send(sd->chat, buf, none_prefix,
+				ste_stkr_cb, cbd, g_free);
+
+	g_free(buf);
+	buf = NULL;
+
+	if (ret > 0)
+		return;
+
+error:
+	g_free(buf);
+	g_free(cbd);
+
+	CALLBACK_WITH_FAILURE(cb, data);
+}
+
+static void stki_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_stk *stk = user_data;
+	GAtResultIter iter;
+	const guint8 *pdu;
+	gint len;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "*STKI:"))
+		return;
+
+	if (!g_at_result_iter_next_hexstring(&iter, &pdu, &len))
+		return;
+
+	ofono_stk_proactive_command_notify(stk, len, pdu);
+}
+
+static void stkn_notify(GAtResult *result, gpointer user_data)
+{
+	/* Proactive command has been handled by the modem.  Should
+	 * the core be notified?  For now we just ignore it because
+	 * we must not respond to the command.
+	 */
+}
+
+static void stkend_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_stk *stk = user_data;
+
+	ofono_stk_proactive_session_end_notify(stk);
+}
+
+static void ste_stkc_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_stk *stk = user_data;
+	struct stk_data *sd = ofono_stk_get_data(stk);
+
+	if (!ok)
+		return;
+
+	g_at_chat_register(sd->chat, "*STKI:", stki_notify, FALSE, stk, NULL);
+	g_at_chat_register(sd->chat, "*STKN:", stkn_notify, FALSE, stk, NULL);
+	g_at_chat_register(sd->chat, "*STKEND",
+					stkend_notify, FALSE, stk, NULL);
+
+	ofono_stk_register(stk);
+}
+
+static int ste_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
+{
+	GAtChat *chat = data;
+	struct stk_data *sd;
+
+	sd = g_new0(struct stk_data, 1);
+	sd->chat = chat;
+
+	ofono_stk_set_data(stk, sd);
+
+	/* Perform PROFILE DOWNLOAD and enable *STKI / *STKN */
+	g_at_chat_send(sd->chat, "AT*STKC=1,\"19E1FFFF0000FF7FFF03FEFF\"",
+			none_prefix, ste_stkc_cb, stk, NULL);
+
+	return 0;
+}
+
+static void ste_stk_remove(struct ofono_stk *stk)
+{
+	struct stk_data *sd = ofono_stk_get_data(stk);
+
+	ofono_stk_set_data(stk, NULL);
+
+	g_free(sd);
+}
+
+static struct ofono_stk_driver driver = {
+	.name			= "stemodem",
+	.probe			= ste_stk_probe,
+	.remove			= ste_stk_remove,
+	.envelope		= ste_stk_envelope,
+	.terminal_response	= ste_stk_terminal_response,
+};
+
+void ste_stk_init()
+{
+	ofono_stk_driver_register(&driver);
+}
+
+void ste_stk_exit()
+{
+	ofono_stk_driver_unregister(&driver);
+}
diff --git a/plugins/ste.c b/plugins/ste.c
index f3ae0b2..ab48e18 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -54,6 +54,7 @@
 #include <ofono/voicecall.h>
 #include <ofono/gprs.h>
 #include <ofono/gprs-context.h>
+#include <ofono/stk.h>
 #include <drivers/atmodem/vendor.h>
 
 #include <drivers/stemodem/caif_socket.h>
@@ -241,6 +242,7 @@ static void ste_post_sim(struct ofono_modem *modem)
 
 	gprs = ofono_gprs_create(modem,
 			OFONO_VENDOR_STE, "atmodem", data->chat);
+	ofono_stk_create(modem, 0, "stemodem", data->chat);
 	gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
 
 	if (gprs && gc)
-- 
1.7.0.4


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

* [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events.
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 10:53 ` [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 10:53 ` [PATCH 3/6] stemodem: Add support for STK Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 10:53 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 18:40   ` Denis Kenzior
  2010-08-13 10:53 ` [PATCH 5/6] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

Copied SIM/PIN handling from MBM.
o Poll SIM status when initializing
o STE modem uses PIN entry quirk for mbm as well
---
 drivers/atmodem/sim.c |    9 +++++--
 plugins/ste.c         |   56 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index eb40ad7..8e7c403 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -567,10 +567,12 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
 	decode_at_error(&error, g_at_result_final_response(result));
 
 	/*
-	 * On the MBM modem, AT+CPIN? keeps returning SIM PIN for a moment
-	 * after successful AT+CPIN="..", but sends *EPEV when that changes.
+	 * On the MBM and STE modem, AT+CPIN? keeps returning SIM PIN for a
+	 * moment after successful AT+CPIN="..", but sends *EPEV when that
+	 * changes.
 	 */
-	if (ok && sd->vendor == OFONO_VENDOR_MBM) {
+	if (ok && (sd->vendor == OFONO_VENDOR_MBM ||
+			sd->vendor == OFONO_VENDOR_STE)) {
 		sd->epev_id = g_at_chat_register(sd->chat, "*EPEV",
 							at_epev_notify,
 							FALSE, cbd, g_free);
@@ -817,6 +819,7 @@ static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
 	case OFONO_VENDOR_WAVECOM:
 		g_at_chat_add_terminator(sd->chat, "+CPIN:", 6, TRUE);
 		break;
+	case OFONO_VENDOR_STE:
 	case OFONO_VENDOR_MBM:
 		g_at_chat_send(sd->chat, "AT*EPEE=1", NULL, NULL, NULL, NULL);
 		break;
diff --git a/plugins/ste.c b/plugins/ste.c
index ab48e18..d82f48e 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -60,8 +60,13 @@
 #include <drivers/stemodem/caif_socket.h>
 #include <drivers/stemodem/if_caif.h>
 
+static const char *cpin_prefix[] = { "+CPIN:", NULL };
+
 struct ste_data {
 	GAtChat *chat;
+	guint cpin_poll_source;
+	guint cpin_poll_count;
+	gboolean have_sim;
 };
 
 static int ste_probe(struct ofono_modem *modem)
@@ -88,6 +93,10 @@ static void ste_remove(struct ofono_modem *modem)
 	ofono_modem_set_data(modem, NULL);
 
 	g_at_chat_unref(data->chat);
+
+	if (data->cpin_poll_source > 0)
+		g_source_remove(data->cpin_poll_source);
+
 	g_free(data);
 }
 
@@ -96,18 +105,58 @@ static void ste_debug(const char *str, void *user_data)
 	ofono_info("%s", str);
 }
 
+static gboolean init_simpin_check(gpointer user_data);
+
+static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct ste_data *data = ofono_modem_get_data(modem);
+
+	/* Modem returns +CME ERROR: 10 if SIM is not ready. */
+	if (!ok && result->final_or_pdu &&
+			!strcmp(result->final_or_pdu, "+CME ERROR: 10") &&
+			data->cpin_poll_count++ < 5) {
+		data->cpin_poll_source =
+			g_timeout_add_seconds(1, init_simpin_check, modem);
+		return;
+	}
+
+	data->cpin_poll_count = 0;
+
+	/* Modem returns ERROR if there is no SIM in slot. */
+	data->have_sim = ok;
+
+	ofono_modem_set_powered(modem, TRUE);
+}
+
+static gboolean init_simpin_check(gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct ste_data *data = ofono_modem_get_data(modem);
+
+	data->cpin_poll_source = 0;
+
+	g_at_chat_send(data->chat, "AT+CPIN?", cpin_prefix,
+			simpin_check, modem, NULL);
+
+	return FALSE;
+}
+
 static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
 
 	DBG("");
 
-	if (!ok)
+	if (!ok) {
 		ofono_modem_set_powered(modem, FALSE);
+		return;
+	}
 
-	ofono_modem_set_powered(modem, TRUE);
+	init_simpin_check(modem);
 }
 
+
 static int ste_enable(struct ofono_modem *modem)
 {
 	struct ste_data *data = ofono_modem_get_data(modem);
@@ -168,7 +217,8 @@ static int ste_enable(struct ofono_modem *modem)
 	if (getenv("OFONO_AT_DEBUG"))
 		g_at_chat_set_debug(data->chat, ste_debug, NULL);
 
-	g_at_chat_send(data->chat, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
+	g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
+		NULL, NULL, NULL, NULL);
 	g_at_chat_send(data->chat, "AT+CFUN=1", NULL, cfun_enable, modem, NULL);
 
 	return -EINPROGRESS;
-- 
1.7.0.4


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

* [PATCH 5/6] stemodem: Add Radio Settings to STE Modem
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (2 preceding siblings ...)
  2010-08-13 10:53 ` [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 10:53 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 18:59   ` Denis Kenzior
  2010-08-13 10:53 ` [PATCH 6/6] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 19:01 ` [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Denis Kenzior
  5 siblings, 1 reply; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am                       |    3 +-
 drivers/stemodem/radio-settings.c |  217 +++++++++++++++++++++++++++++++++++++
 drivers/stemodem/stemodem.c       |    2 +
 drivers/stemodem/stemodem.h       |    3 +
 plugins/ste.c                     |    2 +
 5 files changed, 226 insertions(+), 1 deletions(-)
 create mode 100644 drivers/stemodem/radio-settings.c

diff --git a/Makefile.am b/Makefile.am
index 82e0c0d..ad88bfa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -205,7 +205,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/stemodem/gprs-context.c \
 			drivers/stemodem/caif_socket.h \
 			drivers/stemodem/if_caif.h \
-			drivers/stemodem/stk.c
+			drivers/stemodem/stk.c \
+			drivers/stemodem/radio-settings.c
 
 builtin_modules += phonesim
 builtin_sources += plugins/phonesim.c
diff --git a/drivers/stemodem/radio-settings.c b/drivers/stemodem/radio-settings.c
new file mode 100644
index 0000000..2a5697d
--- /dev/null
+++ b/drivers/stemodem/radio-settings.c
@@ -0,0 +1,217 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2010 ST-Ericsson AB.
+ *  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 <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/radio-settings.h>
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "stemodem.h"
+
+
+static const char *none_prefix[] = { NULL };
+static const char *cfun_prefix[] = { "+CFUN:", NULL };
+struct radio_settings_data {
+	GAtChat *chat;
+};
+
+enum ste_ofono_radio_access_mode {
+	STE_RADIO_OFF = 0,
+	STE_RADIO_ON = 1,
+	STE_RADIO_FLIGHT_MODE = 4,
+	STE_RADIO_GSM_ONLY = 5,
+	STE_RADIO_WCDMA_ONLY = 6
+};
+
+static gboolean ste_mode_to_ofono_mode(enum ste_ofono_radio_access_mode stemode,
+				enum ofono_radio_access_mode *mode)
+{
+	switch (stemode) {
+	case STE_RADIO_ON:
+		*mode = OFONO_RADIO_ACCESS_MODE_ANY;
+		return TRUE;
+	case STE_RADIO_GSM_ONLY:
+		*mode = OFONO_RADIO_ACCESS_MODE_GSM;
+		return TRUE;
+	case STE_RADIO_WCDMA_ONLY:
+		*mode = OFONO_RADIO_ACCESS_MODE_UMTS;
+		return TRUE;
+	default:
+		return FALSE;
+	}
+}
+
+static gboolean ofono_mode_to_ste_mode(enum ofono_radio_access_mode mode,
+				enum ste_ofono_radio_access_mode *stemode)
+{
+	switch (mode) {
+	case OFONO_RADIO_ACCESS_MODE_ANY:
+		*stemode = STE_RADIO_ON;
+		return TRUE;
+	case OFONO_RADIO_ACCESS_MODE_GSM:
+		*stemode = STE_RADIO_GSM_ONLY;
+		return TRUE;
+
+	case OFONO_RADIO_ACCESS_MODE_UMTS:
+		*stemode = STE_RADIO_WCDMA_ONLY;
+		return TRUE;
+	default:
+		return FALSE;
+	}
+}
+
+static void sterat_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
+	enum ofono_radio_access_mode mode;
+	GAtResultIter iter;
+	int value;
+
+	if (!ok) {
+		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+		return;
+	}
+
+	g_at_result_iter_init(&iter, result);
+	if (!g_at_result_iter_next(&iter, "+CFUN:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &value)) {
+		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+		return;
+	}
+
+	if (!ste_mode_to_ofono_mode(value, &mode)) {
+		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+		return;
+	}
+
+	CALLBACK_WITH_SUCCESS(cb, mode, cbd->data);
+}
+
+static void ste_query_rat_mode(struct ofono_radio_settings *rs,
+				ofono_radio_settings_rat_mode_query_cb_t cb,
+				void *data)
+{
+	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+	struct cb_data *cbd = cb_data_new(cb, data);
+
+	if (g_at_chat_send(rsd->chat, "AT+CFUN?", cfun_prefix,
+					sterat_query_cb, cbd, g_free) == 0) {
+		CALLBACK_WITH_FAILURE(cb, -1, data);
+		g_free(cbd);
+	}
+}
+
+static void sterat_modify_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_radio_settings_rat_mode_set_cb_t cb = cbd->cb;
+
+	if (!ok) {
+		CALLBACK_WITH_FAILURE(cb, cbd->data);
+		return;
+	}
+
+	CALLBACK_WITH_SUCCESS(cb, cbd->data);
+}
+
+static void ste_set_rat_mode(struct ofono_radio_settings *rs,
+				enum ofono_radio_access_mode mode,
+				ofono_radio_settings_rat_mode_set_cb_t cb,
+				void *data)
+{
+	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+	struct cb_data *cbd = cb_data_new(cb, data);
+	char buf[20];
+	enum ste_ofono_radio_access_mode value;
+
+	if (!ofono_mode_to_ste_mode(mode, &value)) {
+		CALLBACK_WITH_FAILURE(cb, data);
+		g_free(cbd);
+		return;
+	}
+
+	snprintf(buf, sizeof(buf), "AT+CFUN=%u", value);
+
+	if (g_at_chat_send(rsd->chat, buf, none_prefix,
+					sterat_modify_cb, cbd, g_free) == 0) {
+		CALLBACK_WITH_FAILURE(cb, data);
+		g_free(cbd);
+	}
+}
+
+static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
+					unsigned int vendor, void *data)
+{
+	GAtChat *chat = data;
+	struct radio_settings_data *rsd;
+	rsd = g_try_new0(struct radio_settings_data, 1);
+	if (!rsd)
+		return -ENOMEM;
+
+	rsd->chat = chat;
+
+	ofono_radio_settings_set_data(rs, rsd);
+	ofono_radio_settings_register(rs);
+
+	return 0;
+}
+
+static void ste_radio_settings_remove(struct ofono_radio_settings *rs)
+{
+	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+	ofono_radio_settings_set_data(rs, NULL);
+	g_free(rsd);
+}
+
+static struct ofono_radio_settings_driver driver = {
+	.name			= "stemodem",
+	.probe			= ste_radio_settings_probe,
+	.remove		= ste_radio_settings_remove,
+	.query_rat_mode	= ste_query_rat_mode,
+	.set_rat_mode		= ste_set_rat_mode
+};
+
+void ste_radio_settings_init()
+{
+	ofono_radio_settings_driver_register(&driver);
+}
+
+void ste_radio_settings_exit()
+{
+	ofono_radio_settings_driver_unregister(&driver);
+}
diff --git a/drivers/stemodem/stemodem.c b/drivers/stemodem/stemodem.c
index 34dab80..a5e744e 100644
--- a/drivers/stemodem/stemodem.c
+++ b/drivers/stemodem/stemodem.c
@@ -39,6 +39,7 @@ static int stemodem_init(void)
 	ste_voicecall_init();
 	ste_gprs_context_init();
 	ste_stk_init();
+	ste_radio_settings_init();
 
 	return 0;
 }
@@ -48,6 +49,7 @@ static void stemodem_exit(void)
 	ste_voicecall_exit();
 	ste_gprs_context_exit();
 	ste_stk_exit();
+	ste_radio_settings_exit();
 }
 
 OFONO_PLUGIN_DEFINE(stemodem, "STE modem driver", VERSION,
diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
index 27123d4..b33bde8 100644
--- a/drivers/stemodem/stemodem.h
+++ b/drivers/stemodem/stemodem.h
@@ -30,3 +30,6 @@ extern void ste_voicecall_exit();
 
 extern void ste_stk_init();
 extern void ste_stk_exit();
+
+extern void ste_radio_settings_init();
+extern void ste_radio_settings_exit();
diff --git a/plugins/ste.c b/plugins/ste.c
index d82f48e..fd38a2f 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -55,6 +55,7 @@
 #include <ofono/gprs.h>
 #include <ofono/gprs-context.h>
 #include <ofono/stk.h>
+#include <ofono/radio-settings.h>
 #include <drivers/atmodem/vendor.h>
 
 #include <drivers/stemodem/caif_socket.h>
@@ -294,6 +295,7 @@ static void ste_post_sim(struct ofono_modem *modem)
 			OFONO_VENDOR_STE, "atmodem", data->chat);
 	ofono_stk_create(modem, 0, "stemodem", data->chat);
 	gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
+	ofono_radio_settings_create(modem, 0, "stemodem", data->chat);
 
 	if (gprs && gc)
 		ofono_gprs_add_context(gprs, gc);
-- 
1.7.0.4


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

* [PATCH 6/6] stemodem: Use RTNL for creating CAIF interface
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (3 preceding siblings ...)
  2010-08-13 10:53 ` [PATCH 5/6] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 10:53 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-13 19:01 ` [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Denis Kenzior
  5 siblings, 0 replies; 11+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-13 10:53 UTC (permalink / raw)
  To: ofono

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

CAIF in Linux kernel 2.6.35 must use RTNL for configuring
CAIF interfaces.
---
 Makefile.am                     |    4 +-
 drivers/stemodem/gprs-context.c |   51 +++++--
 drivers/stemodem/rtnl.c         |  313 +++++++++++++++++++++++++++++++++++++++
 drivers/stemodem/rtnl.h         |   24 +++
 4 files changed, 378 insertions(+), 14 deletions(-)
 create mode 100644 drivers/stemodem/rtnl.c
 create mode 100644 drivers/stemodem/rtnl.h

diff --git a/Makefile.am b/Makefile.am
index ad88bfa..57fe2fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -206,7 +206,9 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/stemodem/caif_socket.h \
 			drivers/stemodem/if_caif.h \
 			drivers/stemodem/stk.c \
-			drivers/stemodem/radio-settings.c
+			drivers/stemodem/radio-settings.c \
+			drivers/stemodem/rtnl.c \
+			drivers/stemodem/rtnl.h
 
 builtin_modules += phonesim
 builtin_sources += plugins/phonesim.c
diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index ace9d6e..591df33 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -43,8 +43,9 @@
 
 #include "gatchat.h"
 #include "gatresult.h"
+
+#include "rtnl.h"
 #include "stemodem.h"
-#include "caif_socket.h"
 #include "if_caif.h"
 
 #define MAX_CAIF_DEVICES 7
@@ -68,7 +69,8 @@ struct conn_info {
 	unsigned int cid;
 	unsigned int device;
 	unsigned int channel_id;
-	char interface[10];
+	char ifname[16];
+	int ifindex;
 };
 
 struct eppsd_response {
@@ -171,17 +173,40 @@ static struct conn_info *conn_info_create(unsigned int device,
 /*
  * Creates a new IP interface for CAIF.
  */
-static gboolean caif_if_create(const char *interface, unsigned int connid)
+static gboolean caif_if_create(struct conn_info *conn)
 {
-	return FALSE;
+
+	strcpy(conn->ifname, "caif%d");
+	if (rtnl_create_caif_interface(IFLA_CAIF_IPV4_CONNID,
+					conn->channel_id,
+					conn->ifname,
+					&conn->ifindex) < 0) {
+		DBG("Failed to create IP interface for CAIF");
+		return FALSE;
+	}
+
+	DBG("created CAIF interface ch:%d ifname:%s ifindex:%d\n",
+		conn->channel_id, conn->ifname, conn->ifindex);
+
+	return TRUE;
 }
 
 /*
  * Removes IP interface for CAIF.
  */
-static gboolean caif_if_remove(const char *interface, unsigned int connid)
+static gboolean caif_if_remove(struct conn_info *conn)
 {
-	return FALSE;
+
+	if (rtnl_delete_caif_interface(conn->ifindex) < 0) {
+		ofono_error("Failed to delete caif interface %s",
+			conn->ifname);
+		return FALSE;
+	}
+
+	DBG("removed CAIF interface ch:%d ifname:%s ifindex:%d\n",
+		conn->channel_id, conn->ifname, conn->ifindex);
+
+	return TRUE;
 }
 
 static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
@@ -211,9 +236,9 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
 
 	conn = l->data;
 
-	if (!caif_if_remove(conn->interface, conn->channel_id)) {
+	if (!caif_if_remove(conn)) {
 		DBG("Failed to remove caif interface %s.",
-				conn->interface);
+				conn->ifname);
 	}
 
 	conn->cid = 0;
@@ -283,16 +308,16 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	dns[1] = rsp.dns_server2;
 	dns[2] = NULL;
 
-	sprintf(conn->interface, "caif%u", conn->device);
+	sprintf(conn->ifname, "caif%u", conn->device);
 
-	if (!caif_if_create(conn->interface, conn->channel_id)) {
+	if (!caif_if_create(conn)) {
 		ofono_error("Failed to create caif interface %s.",
-				conn->interface);
+				conn->ifname);
 		CALLBACK_WITH_SUCCESS(cb, NULL, FALSE, rsp.ip_address,
 				rsp.subnet_mask, rsp.default_gateway,
 				dns, cbd->data);
 	} else {
-		CALLBACK_WITH_SUCCESS(cb, conn->interface,
+		CALLBACK_WITH_SUCCESS(cb, conn->ifname,
 				FALSE, rsp.ip_address, rsp.subnet_mask,
 				rsp.default_gateway, dns, cbd->data);
 	}
@@ -544,7 +569,7 @@ static void ste_gprs_context_remove(struct ofono_gprs_context *gc)
 static struct ofono_gprs_context_driver driver = {
 	.name			= "stemodem",
 	.probe			= ste_gprs_context_probe,
-	.remove			= ste_gprs_context_remove,
+	.remove		= ste_gprs_context_remove,
 	.activate_primary	= ste_gprs_activate_primary,
 	.deactivate_primary	= ste_gprs_deactivate_primary,
 };
diff --git a/drivers/stemodem/rtnl.c b/drivers/stemodem/rtnl.c
new file mode 100644
index 0000000..61d7502
--- /dev/null
+++ b/drivers/stemodem/rtnl.c
@@ -0,0 +1,313 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 ST-Ericsson AB.
+ *
+ *  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 <string.h>
+#include <unistd.h>
+#include <net/if_arp.h>
+#include <linux/rtnetlink.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+
+#include "if_caif.h"
+#include "rtnl.h"
+
+#define NLMSG_TAIL(nmsg) \
+	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
+
+struct iplink_req {
+	struct nlmsghdr n;
+	struct ifinfomsg i;
+	char pad[1024];
+	int ifindex;
+	char ifname[16];
+	int result;
+};
+
+static guint32 ipconfig_seqnr = 1;
+
+static gboolean get_ifname(struct ifinfomsg *msg, int bytes,
+			const char **ifname)
+{
+	struct rtattr *attr;
+
+	for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes);
+			attr = RTA_NEXT(attr, bytes))
+		if (attr->rta_type == IFLA_IFNAME &&
+				ifname != NULL) {
+			*ifname = RTA_DATA(attr);
+			return TRUE;
+		}
+	return FALSE;
+}
+
+static void handle_rtnl_response(struct iplink_req *req, unsigned short type,
+				int index, unsigned flags, unsigned change,
+				struct ifinfomsg *msg, int bytes)
+{
+	const char *ifname = NULL;
+
+	get_ifname(msg, bytes, &ifname);
+	req->ifindex = index;
+	strncpy(req->ifname, ifname,
+		sizeof(req->ifname));
+	req->ifname[sizeof(req->ifname)-1] = '\0';
+}
+
+static int send_iplink_req(int sk, struct iplink_req *req)
+{
+	struct sockaddr_nl addr;
+
+	memset(&addr, 0, sizeof(addr));
+	addr.nl_family = AF_NETLINK;
+	return sendto(sk, req, req->n.nlmsg_len, 0,
+				(struct sockaddr *) &addr, sizeof(addr));
+}
+
+static int parse_rtnl_message(void *buf, size_t len, struct iplink_req *req)
+{
+	struct ifinfomsg *msg;
+
+	while (len > 0) {
+		struct nlmsghdr *hdr = buf;
+		struct nlmsgerr *err;
+
+		if (!NLMSG_OK(hdr, len))
+			break;
+
+		if (hdr->nlmsg_type == NLMSG_ERROR) {
+			err = NLMSG_DATA(hdr);
+			DBG("RTNL failed: seq:%d error %d (%s)",
+				hdr->nlmsg_seq, err->error,
+				strerror(-err->error));
+			req->result = err->error;
+			return err->error;
+		}
+
+		else if (hdr->nlmsg_type == RTM_NEWLINK ||
+			hdr->nlmsg_type == RTM_DELLINK) {
+			msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
+			handle_rtnl_response(req, msg->ifi_type,
+					msg->ifi_index, msg->ifi_flags,
+					msg->ifi_change, msg,
+					IFA_PAYLOAD(hdr));
+			break;
+		} else
+			return -1;
+
+		len -= hdr->nlmsg_len;
+		buf += hdr->nlmsg_len;
+	}
+	return 1;
+}
+
+static int netlink_get_response(int sk, struct iplink_req *req)
+{
+	unsigned char buf[4096];
+	int ret;
+
+	memset(buf, 0, sizeof(buf));
+
+	do {
+		ret = read(sk, buf, sizeof(buf));
+		if (ret < 0)
+			break;
+		ret = parse_rtnl_message(buf, sizeof(buf), req);
+	} while (ret > 0);
+
+	return ret;
+}
+
+static int add_attribute(struct nlmsghdr *n, int maxlen, int type,
+			const void *data, int datalen)
+{
+	int len = RTA_LENGTH(datalen);
+	struct rtattr *rta;
+
+	if ((int)(NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len)) > maxlen) {
+		DBG("attribute to large for message %d %d %d\n",
+			n->nlmsg_len, len, maxlen);
+		return -1;
+	}
+
+	rta = NLMSG_TAIL(n);
+	rta->rta_type = type;
+	rta->rta_len = len;
+	memcpy(RTA_DATA(rta), data, datalen);
+
+	n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
+	return 0;
+}
+
+static int create_caif_interface(int sk, struct iplink_req *req,
+				int connection_type, char *ifname,
+				int nsapi, int loop_enabled)
+{
+	char type[] = "caif";
+	struct rtattr *linkinfo;
+	struct rtattr *data;
+
+	req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+	req->n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK;
+	req->n.nlmsg_type = RTM_NEWLINK;
+	req->n.nlmsg_seq = ipconfig_seqnr++;
+	req->i.ifi_family = AF_UNSPEC;
+
+	linkinfo = NLMSG_TAIL(&req->n);
+	add_attribute(&req->n, sizeof(*req), IFLA_LINKINFO,
+		NULL, 0);
+
+	add_attribute(&req->n, sizeof(*req), IFLA_INFO_KIND,
+		type, strlen(type));
+
+	add_attribute(&req->n, sizeof(*req), IFLA_IFNAME,
+		ifname, strlen(ifname));
+
+	data = NLMSG_TAIL(&req->n);
+	add_attribute(&req->n, sizeof(*req), IFLA_INFO_DATA,
+		NULL, 0);
+
+	if (connection_type == IFLA_CAIF_IPV4_CONNID)
+		add_attribute(&req->n, sizeof(*req),
+			IFLA_CAIF_IPV4_CONNID, &nsapi, sizeof(nsapi));
+	else if (connection_type == IFLA_CAIF_IPV6_CONNID)
+		add_attribute(&req->n, sizeof(*req),
+			IFLA_CAIF_IPV6_CONNID, &nsapi, sizeof(nsapi));
+	else {
+		DBG("unsupported linktype\n");
+		g_free(req);
+		return -1;
+	}
+
+	if (loop_enabled) {
+		int loop;
+		add_attribute(&req->n, sizeof(*req),
+			IFLA_CAIF_LOOPBACK, &loop, sizeof(loop));
+	}
+
+	data->rta_len = (void *)NLMSG_TAIL(&req->n) - (void *)data;
+
+	linkinfo->rta_len = (void *)NLMSG_TAIL(&req->n) - (void *)linkinfo;
+
+	return send_iplink_req(sk, req);
+}
+
+static int destroy_caif_interface(int sk, struct iplink_req *req, int ifindex)
+{
+
+	req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+	req->n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK;
+	req->n.nlmsg_type = RTM_DELLINK;
+	req->n.nlmsg_seq = ipconfig_seqnr++;
+	req->i.ifi_family = AF_UNSPEC;
+	req->i.ifi_index = ifindex;
+
+	return send_iplink_req(sk, req);
+}
+
+static int rtnl_init(void)
+{
+	struct sockaddr_nl addr;
+	int sk, ret;
+
+	sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+	if (sk < 0)
+		return sk;
+
+	memset(&addr, 0, sizeof(addr));
+	addr.nl_family = AF_NETLINK;
+	addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE;
+
+	ret = bind(sk, (struct sockaddr *) &addr, sizeof(addr));
+
+	if (ret < 0) {
+		close(sk);
+		return ret;
+	}
+
+	return sk;
+}
+
+/* Note ifname is in/out and must be minimum size 16 */
+int rtnl_create_caif_interface(int type, int conn_id, char ifname[16],
+			int *ifindex)
+{
+	int sk, ret;
+	int loop = 0;
+	struct iplink_req req;
+
+	memset(&req, 0, sizeof(req));
+	*ifindex = -1;
+
+	sk = rtnl_init();
+	ret = sk;
+	if (sk < 0)
+		goto out;
+
+	ret = create_caif_interface(sk, &req, type, ifname, conn_id, loop);
+	if (ret < 0)
+		goto out;
+
+	ret = netlink_get_response(sk, &req);
+	if (ret < 0)
+		goto out;
+
+	strncpy(ifname, req.ifname, sizeof(req.ifname));
+	ifname[sizeof(req.ifname)-1] = '\0';
+	*ifindex = req.ifindex;
+	ret = req.result;
+
+out:
+	close(sk);
+	return ret;
+}
+
+int rtnl_delete_caif_interface(int ifid)
+{
+	struct iplink_req req;
+	int sk, ret;
+
+	memset(&req, 0, sizeof(req));
+
+	sk = rtnl_init();
+	ret = sk;
+	if (sk < 0)
+		goto out;
+
+	ret = destroy_caif_interface(sk, &req, ifid);
+	if (ret < 0)
+		goto out;
+
+	ret = netlink_get_response(sk, &req);
+	if (ret < 0)
+		goto out;
+
+	ret = req.result;
+
+out:
+	close(sk);
+	return ret;
+}
diff --git a/drivers/stemodem/rtnl.h b/drivers/stemodem/rtnl.h
new file mode 100644
index 0000000..8f6a84f
--- /dev/null
+++ b/drivers/stemodem/rtnl.h
@@ -0,0 +1,24 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 ST-Ericsson AB.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+extern int rtnl_create_caif_interface(int type, int conn_id, char ifname[16],
+					int *ifindex);
+extern int rtnl_delete_caif_interface(int ifid);
-- 
1.7.0.4


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

* Re: [PATCH 3/6] stemodem: Add support for STK.
  2010-08-13 10:53 ` [PATCH 3/6] stemodem: Add support for STK Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 18:13   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-08-13 18:13 UTC (permalink / raw)
  To: ofono

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

Hi Sjur,

> diff --git a/plugins/ste.c b/plugins/ste.c
> index f3ae0b2..ab48e18 100644
> --- a/plugins/ste.c
> +++ b/plugins/ste.c
> @@ -54,6 +54,7 @@
>  #include <ofono/voicecall.h>
>  #include <ofono/gprs.h>
>  #include <ofono/gprs-context.h>
> +#include <ofono/stk.h>
>  #include <drivers/atmodem/vendor.h>
>  
>  #include <drivers/stemodem/caif_socket.h>
> @@ -241,6 +242,7 @@ static void ste_post_sim(struct ofono_modem *modem)
>  
>  	gprs = ofono_gprs_create(modem,
>  			OFONO_VENDOR_STE, "atmodem", data->chat);
> +	ofono_stk_create(modem, 0, "stemodem", data->chat);
>  	gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
>  
>  	if (gprs && gc)

If this is indeed just a copy of the mbm driver, can't you simply do
this part and use ofono_stk_create(modem, 0, "mbmmodem", data->chat) ?

It seems wasteful to copy parts around.

Regards,
-Denis

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

* Re: [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events.
  2010-08-13 10:53 ` [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 18:40   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-08-13 18:40 UTC (permalink / raw)
  To: ofono

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

On 08/13/2010 05:53 AM, Sjur Brændeland wrote:
> Copied SIM/PIN handling from MBM.
> o Poll SIM status when initializing
> o STE modem uses PIN entry quirk for mbm as well
> ---
>  drivers/atmodem/sim.c |    9 +++++--
>  plugins/ste.c         |   56 ++++++++++++++++++++++++++++++++++++++++++++++--

Please break this up into two patches.

>  2 files changed, 59 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
> index eb40ad7..8e7c403 100644
> --- a/drivers/atmodem/sim.c
> +++ b/drivers/atmodem/sim.c
> @@ -567,10 +567,12 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
>  	decode_at_error(&error, g_at_result_final_response(result));
>  
>  	/*
> -	 * On the MBM modem, AT+CPIN? keeps returning SIM PIN for a moment
> -	 * after successful AT+CPIN="..", but sends *EPEV when that changes.
> +	 * On the MBM and STE modem, AT+CPIN? keeps returning SIM PIN for a
> +	 * moment after successful AT+CPIN="..", but sends *EPEV when that
> +	 * changes.
>  	 */
> -	if (ok && sd->vendor == OFONO_VENDOR_MBM) {
> +	if (ok && (sd->vendor == OFONO_VENDOR_MBM ||
> +			sd->vendor == OFONO_VENDOR_STE)) {
>  		sd->epev_id = g_at_chat_register(sd->chat, "*EPEV",
>  							at_epev_notify,
>  							FALSE, cbd, g_free);
> @@ -817,6 +819,7 @@ static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
>  	case OFONO_VENDOR_WAVECOM:
>  		g_at_chat_add_terminator(sd->chat, "+CPIN:", 6, TRUE);
>  		break;
> +	case OFONO_VENDOR_STE:
>  	case OFONO_VENDOR_MBM:
>  		g_at_chat_send(sd->chat, "AT*EPEE=1", NULL, NULL, NULL, NULL);
>  		break;

I'm fine accepting this patch in the interim, but ideally we want to
solve it more generically since every vendor has their own notification
for this.  Please see the "Add support for SIM 'ready' notifications..."
task in the TODO list.

> diff --git a/plugins/ste.c b/plugins/ste.c
> index ab48e18..d82f48e 100644
> --- a/plugins/ste.c
> +++ b/plugins/ste.c
> @@ -60,8 +60,13 @@
>  #include <drivers/stemodem/caif_socket.h>
>  #include <drivers/stemodem/if_caif.h>
>  
> +static const char *cpin_prefix[] = { "+CPIN:", NULL };
> +
>  struct ste_data {
>  	GAtChat *chat;
> +	guint cpin_poll_source;
> +	guint cpin_poll_count;
> +	gboolean have_sim;
>  };
>  
>  static int ste_probe(struct ofono_modem *modem)
> @@ -88,6 +93,10 @@ static void ste_remove(struct ofono_modem *modem)
>  	ofono_modem_set_data(modem, NULL);
>  
>  	g_at_chat_unref(data->chat);
> +
> +	if (data->cpin_poll_source > 0)
> +		g_source_remove(data->cpin_poll_source);
> +
>  	g_free(data);
>  }
>  
> @@ -96,18 +105,58 @@ static void ste_debug(const char *str, void *user_data)
>  	ofono_info("%s", str);
>  }
>  
> +static gboolean init_simpin_check(gpointer user_data);
> +
> +static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct ofono_modem *modem = user_data;
> +	struct ste_data *data = ofono_modem_get_data(modem);
> +
> +	/* Modem returns +CME ERROR: 10 if SIM is not ready. */
> +	if (!ok && result->final_or_pdu &&
> +			!strcmp(result->final_or_pdu, "+CME ERROR: 10") &&
> +			data->cpin_poll_count++ < 5) {
> +		data->cpin_poll_source =
> +			g_timeout_add_seconds(1, init_simpin_check, modem);
> +		return;
> +	}
> +
> +	data->cpin_poll_count = 0;
> +
> +	/* Modem returns ERROR if there is no SIM in slot. */
> +	data->have_sim = ok;
> +
> +	ofono_modem_set_powered(modem, TRUE);
> +}
> +
> +static gboolean init_simpin_check(gpointer user_data)
> +{
> +	struct ofono_modem *modem = user_data;
> +	struct ste_data *data = ofono_modem_get_data(modem);
> +
> +	data->cpin_poll_source = 0;
> +
> +	g_at_chat_send(data->chat, "AT+CPIN?", cpin_prefix,
> +			simpin_check, modem, NULL);
> +
> +	return FALSE;
> +}
> +
>  static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
>  {
>  	struct ofono_modem *modem = user_data;
>  
>  	DBG("");
>  
> -	if (!ok)
> +	if (!ok) {
>  		ofono_modem_set_powered(modem, FALSE);
> +		return;
> +	}
>  
> -	ofono_modem_set_powered(modem, TRUE);
> +	init_simpin_check(modem);
>  }
>  
> +

Why the extra line?

>  static int ste_enable(struct ofono_modem *modem)
>  {
>  	struct ste_data *data = ofono_modem_get_data(modem);
> @@ -168,7 +217,8 @@ static int ste_enable(struct ofono_modem *modem)
>  	if (getenv("OFONO_AT_DEBUG"))
>  		g_at_chat_set_debug(data->chat, ste_debug, NULL);
>  
> -	g_at_chat_send(data->chat, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
> +	g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
> +		NULL, NULL, NULL, NULL);

Please indent this one more.

>  	g_at_chat_send(data->chat, "AT+CFUN=1", NULL, cfun_enable, modem, NULL);
>  
>  	return -EINPROGRESS;

Regards,
-Denis

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

* Re: [PATCH 5/6] stemodem: Add Radio Settings to STE Modem
  2010-08-13 10:53 ` [PATCH 5/6] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 18:59   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-08-13 18:59 UTC (permalink / raw)
  To: ofono

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

Hi Sjur,

On 08/13/2010 05:53 AM, Sjur Brændeland wrote:
> ---
>  Makefile.am                       |    3 +-
>  drivers/stemodem/radio-settings.c |  217 +++++++++++++++++++++++++++++++++++++
>  drivers/stemodem/stemodem.c       |    2 +
>  drivers/stemodem/stemodem.h       |    3 +
>  plugins/ste.c                     |    2 +
>  5 files changed, 226 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/stemodem/radio-settings.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index 82e0c0d..ad88bfa 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -205,7 +205,8 @@ builtin_sources += drivers/atmodem/atutil.h \
>  			drivers/stemodem/gprs-context.c \
>  			drivers/stemodem/caif_socket.h \
>  			drivers/stemodem/if_caif.h \
> -			drivers/stemodem/stk.c
> +			drivers/stemodem/stk.c \
> +			drivers/stemodem/radio-settings.c
>  
>  builtin_modules += phonesim
>  builtin_sources += plugins/phonesim.c
> diff --git a/drivers/stemodem/radio-settings.c b/drivers/stemodem/radio-settings.c
> new file mode 100644
> index 0000000..2a5697d
> --- /dev/null
> +++ b/drivers/stemodem/radio-settings.c
> @@ -0,0 +1,217 @@
> +/*
> + *
> + *  oFono - Open Source Telephony
> + *
> + *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
> + *  Copyright (C) 2010 ST-Ericsson AB.
> + *  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 <string.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <errno.h>
> +
> +#include <glib.h>
> +
> +#include <ofono/log.h>
> +#include <ofono/modem.h>
> +#include <ofono/radio-settings.h>
> +
> +#include "gatchat.h"
> +#include "gatresult.h"
> +
> +#include "stemodem.h"
> +
> +

Why the extra line?

> +static const char *none_prefix[] = { NULL };
> +static const char *cfun_prefix[] = { "+CFUN:", NULL };

Please add an empty line here.

> +struct radio_settings_data {
> +	GAtChat *chat;
> +};
> +
> +enum ste_ofono_radio_access_mode {

ste_radio_mode might be enough here

> +	STE_RADIO_OFF = 0,
> +	STE_RADIO_ON = 1,
> +	STE_RADIO_FLIGHT_MODE = 4,
> +	STE_RADIO_GSM_ONLY = 5,
> +	STE_RADIO_WCDMA_ONLY = 6
> +};
> +
> +static gboolean ste_mode_to_ofono_mode(enum ste_ofono_radio_access_mode stemode,
> +				enum ofono_radio_access_mode *mode)
> +{
> +	switch (stemode) {
> +	case STE_RADIO_ON:
> +		*mode = OFONO_RADIO_ACCESS_MODE_ANY;
> +		return TRUE;
> +	case STE_RADIO_GSM_ONLY:
> +		*mode = OFONO_RADIO_ACCESS_MODE_GSM;
> +		return TRUE;
> +	case STE_RADIO_WCDMA_ONLY:
> +		*mode = OFONO_RADIO_ACCESS_MODE_UMTS;
> +		return TRUE;
> +	default:
> +		return FALSE;
> +	}
> +}
> +
> +static gboolean ofono_mode_to_ste_mode(enum ofono_radio_access_mode mode,
> +				enum ste_ofono_radio_access_mode *stemode)
> +{
> +	switch (mode) {
> +	case OFONO_RADIO_ACCESS_MODE_ANY:
> +		*stemode = STE_RADIO_ON;
> +		return TRUE;
> +	case OFONO_RADIO_ACCESS_MODE_GSM:
> +		*stemode = STE_RADIO_GSM_ONLY;
> +		return TRUE;
> +
> +	case OFONO_RADIO_ACCESS_MODE_UMTS:
> +		*stemode = STE_RADIO_WCDMA_ONLY;
> +		return TRUE;
> +	default:
> +		return FALSE;
> +	}
> +}
> +
> +static void sterat_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct cb_data *cbd = user_data;
> +	ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
> +	enum ofono_radio_access_mode mode;
> +	GAtResultIter iter;
> +	int value;
> +
> +	if (!ok) {
> +		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> +		return;
> +	}

Ideally, if the command execution fails, you should return the decoded
error.  In some cases oFono can make use of them intelligently.  E.g.
something like:

decode_error();

if (!ok) {
	callback(&error, ...);
	return;
}

> +
> +	g_at_result_iter_init(&iter, result);

Please add an extra line here.

> +	if (!g_at_result_iter_next(&iter, "+CFUN:"))
> +		return;
> +

Yikes, we should callback with failure here.

> +	if (!g_at_result_iter_next_number(&iter, &value)) {
> +		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> +		return;
> +	}
> +
> +	if (!ste_mode_to_ofono_mode(value, &mode)) {
> +		CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> +		return;
> +	}
> +
> +	CALLBACK_WITH_SUCCESS(cb, mode, cbd->data);
> +}
> +

The other two drivers that had these problems were fixed.

> +static void ste_query_rat_mode(struct ofono_radio_settings *rs,
> +				ofono_radio_settings_rat_mode_query_cb_t cb,
> +				void *data)
> +{
> +	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
> +	struct cb_data *cbd = cb_data_new(cb, data);
> +
> +	if (g_at_chat_send(rsd->chat, "AT+CFUN?", cfun_prefix,
> +					sterat_query_cb, cbd, g_free) == 0) {
> +		CALLBACK_WITH_FAILURE(cb, -1, data);
> +		g_free(cbd);
> +	}
> +}
> +
> +static void sterat_modify_cb(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct cb_data *cbd = user_data;
> +	ofono_radio_settings_rat_mode_set_cb_t cb = cbd->cb;
> +
> +	if (!ok) {
> +		CALLBACK_WITH_FAILURE(cb, cbd->data);
> +		return;
> +	}
> +
> +	CALLBACK_WITH_SUCCESS(cb, cbd->data);

Same here, decoding the error is preferred.

> +}
> +
> +static void ste_set_rat_mode(struct ofono_radio_settings *rs,
> +				enum ofono_radio_access_mode mode,
> +				ofono_radio_settings_rat_mode_set_cb_t cb,
> +				void *data)
> +{
> +	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
> +	struct cb_data *cbd = cb_data_new(cb, data);
> +	char buf[20];
> +	enum ste_ofono_radio_access_mode value;
> +
> +	if (!ofono_mode_to_ste_mode(mode, &value)) {
> +		CALLBACK_WITH_FAILURE(cb, data);
> +		g_free(cbd);
> +		return;
> +	}
> +
> +	snprintf(buf, sizeof(buf), "AT+CFUN=%u", value);
> +
> +	if (g_at_chat_send(rsd->chat, buf, none_prefix,
> +					sterat_modify_cb, cbd, g_free) == 0) {
> +		CALLBACK_WITH_FAILURE(cb, data);
> +		g_free(cbd);
> +	}
> +}
> +
> +static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
> +					unsigned int vendor, void *data)
> +{
> +	GAtChat *chat = data;
> +	struct radio_settings_data *rsd;
> +	rsd = g_try_new0(struct radio_settings_data, 1);
> +	if (!rsd)
> +		return -ENOMEM;
> +
> +	rsd->chat = chat;
> +
> +	ofono_radio_settings_set_data(rs, rsd);
> +	ofono_radio_settings_register(rs);
> +
> +	return 0;
> +}
> +
> +static void ste_radio_settings_remove(struct ofono_radio_settings *rs)
> +{
> +	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
> +	ofono_radio_settings_set_data(rs, NULL);
> +	g_free(rsd);
> +}
> +
> +static struct ofono_radio_settings_driver driver = {
> +	.name			= "stemodem",
> +	.probe			= ste_radio_settings_probe,
> +	.remove		= ste_radio_settings_remove,
> +	.query_rat_mode	= ste_query_rat_mode,
> +	.set_rat_mode		= ste_set_rat_mode
> +};
> +
> +void ste_radio_settings_init()
> +{
> +	ofono_radio_settings_driver_register(&driver);
> +}
> +
> +void ste_radio_settings_exit()
> +{
> +	ofono_radio_settings_driver_unregister(&driver);
> +}
> diff --git a/drivers/stemodem/stemodem.c b/drivers/stemodem/stemodem.c
> index 34dab80..a5e744e 100644
> --- a/drivers/stemodem/stemodem.c
> +++ b/drivers/stemodem/stemodem.c
> @@ -39,6 +39,7 @@ static int stemodem_init(void)
>  	ste_voicecall_init();
>  	ste_gprs_context_init();
>  	ste_stk_init();
> +	ste_radio_settings_init();
>  
>  	return 0;
>  }
> @@ -48,6 +49,7 @@ static void stemodem_exit(void)
>  	ste_voicecall_exit();
>  	ste_gprs_context_exit();
>  	ste_stk_exit();
> +	ste_radio_settings_exit();
>  }
>  
>  OFONO_PLUGIN_DEFINE(stemodem, "STE modem driver", VERSION,
> diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
> index 27123d4..b33bde8 100644
> --- a/drivers/stemodem/stemodem.h
> +++ b/drivers/stemodem/stemodem.h
> @@ -30,3 +30,6 @@ extern void ste_voicecall_exit();
>  
>  extern void ste_stk_init();
>  extern void ste_stk_exit();
> +
> +extern void ste_radio_settings_init();
> +extern void ste_radio_settings_exit();
> diff --git a/plugins/ste.c b/plugins/ste.c
> index d82f48e..fd38a2f 100644
> --- a/plugins/ste.c
> +++ b/plugins/ste.c
> @@ -55,6 +55,7 @@
>  #include <ofono/gprs.h>
>  #include <ofono/gprs-context.h>
>  #include <ofono/stk.h>
> +#include <ofono/radio-settings.h>
>  #include <drivers/atmodem/vendor.h>
>  
>  #include <drivers/stemodem/caif_socket.h>
> @@ -294,6 +295,7 @@ static void ste_post_sim(struct ofono_modem *modem)
>  			OFONO_VENDOR_STE, "atmodem", data->chat);
>  	ofono_stk_create(modem, 0, "stemodem", data->chat);
>  	gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
> +	ofono_radio_settings_create(modem, 0, "stemodem", data->chat);
>  
>  	if (gprs && gc)
>  		ofono_gprs_add_context(gprs, gc);

Ideally I'd like changes to plugins/ in a separate patch.

Thanks,
-Denis

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

* Re: [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt
  2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
                   ` (4 preceding siblings ...)
  2010-08-13 10:53 ` [PATCH 6/6] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 19:01 ` Denis Kenzior
  5 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-08-13 19:01 UTC (permalink / raw)
  To: ofono

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

Hi Sjur,

On 08/13/2010 05:53 AM, Sjur Brændeland wrote:
> ---
>  Makefile.am |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate.
  2010-08-13 10:53 ` [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-13 19:02   ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-08-13 19:02 UTC (permalink / raw)
  To: ofono

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

Hi Sjur,

On 08/13/2010 05:53 AM, Sjur Brændeland wrote:
> ---
>  drivers/stemodem/if_caif.h |   48 +++++--------------------------------------
>  1 files changed, 6 insertions(+), 42 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-08-13 19:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 10:53 [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 10:53 ` [PATCH 2/6] stemodem: Copy if_caif.h from 2.6.36 release candidate Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 19:02   ` Denis Kenzior
2010-08-13 10:53 ` [PATCH 3/6] stemodem: Add support for STK Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 18:13   ` Denis Kenzior
2010-08-13 10:53 ` [PATCH 4/6] stemodem: Add SIM/PIN polling and SIM events Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 18:40   ` Denis Kenzior
2010-08-13 10:53 ` [PATCH 5/6] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 18:59   ` Denis Kenzior
2010-08-13 10:53 ` [PATCH 6/6] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-13 19:01 ` [PATCH 1/6] bugfix: distcheck fail due to rename of dataconnectionmanager-api.txt Denis Kenzior

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.