* [PATCH 0/6] STE-plugin
@ 2010-01-25 19:25 sjur.brandeland
2010-01-25 19:25 ` [PATCH 1/6] STE-plugin: Add at_util_call_compare_by_id sjur.brandeland
2010-01-25 20:07 ` [PATCH 0/6] STE-plugin Marcel Holtmann
0 siblings, 2 replies; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1483 bytes --]
Hello.
This is a new version of the STE-plugin patch set. Since last RFCv2 we have
stubbed out Voice Call and GPRS Context handling, changed patch order,
cleanup some unnecessary includes, moved CAIF header files, and fixed
most other review comments (hopefully).
Sjur Brandeland (6):
STE-plugin: Add at_util_call_compare_by_id
STE-plugin: Add vendor STE and quirks in atmodem.
STE-plugin: STE modem driver definition
STE-plugin: Add CAIF header files in drivers/stemodem.
STE-plugin: Add STE plugin
STE-plugin: Add STE to Makefile
Makefile.am | 10 ++
drivers/atmodem/atutil.c | 14 ++
drivers/atmodem/atutil.h | 1 +
drivers/atmodem/gprs.c | 10 +-
drivers/atmodem/network-registration.c | 78 ++++++++++-
drivers/atmodem/vendor.h | 1 +
drivers/stemodem/caif_socket.h | 171 +++++++++++++++++++++
drivers/stemodem/if_caif.h | 70 +++++++++
drivers/stemodem/stemodem.c | 50 +++++++
drivers/stemodem/stemodem.h | 29 ++++
plugins/ste.c | 253 ++++++++++++++++++++++++++++++++
11 files changed, 684 insertions(+), 3 deletions(-)
create mode 100644 drivers/stemodem/caif_socket.h
create mode 100644 drivers/stemodem/if_caif.h
create mode 100644 drivers/stemodem/stemodem.c
create mode 100644 drivers/stemodem/stemodem.h
create mode 100644 plugins/ste.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] STE-plugin: Add at_util_call_compare_by_id
2010-01-25 19:25 [PATCH 0/6] STE-plugin sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
2010-01-25 19:25 ` [PATCH 2/6] STE-plugin: Add vendor STE and quirks in atmodem sjur.brandeland
2010-01-25 20:07 ` [PATCH 0/6] STE-plugin Marcel Holtmann
1 sibling, 1 reply; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]
Add function at_util_call_compare_by_phone_number() to atutil.c
---
drivers/atmodem/atutil.c | 14 ++++++++++++++
drivers/atmodem/atutil.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index ab52999..28a192a 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -77,6 +77,20 @@ gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b)
sizeof(struct ofono_phone_number));
}
+gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b)
+{
+ const struct ofono_call *call = a;
+ unsigned int id = GPOINTER_TO_UINT(b);
+
+ if (id < call->id)
+ return -1;
+
+ if (id > call->id)
+ return 1;
+
+ return 0;
+}
+
gint at_util_call_compare(gconstpointer a, gconstpointer b)
{
const struct ofono_call *ca = a;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 0ab207d..fc5b041 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -23,6 +23,7 @@ void decode_at_error(struct ofono_error *error, const char *final);
void dump_response(const char *func, gboolean ok, GAtResult *result);
gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
+gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b);
gint at_util_call_compare(gconstpointer a, gconstpointer b);
GSList *at_util_parse_clcc(GAtResult *result);
gboolean at_util_parse_reg(GAtResult *result, const char *prefix,
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] STE-plugin: Add vendor STE and quirks in atmodem.
2010-01-25 19:25 ` [PATCH 1/6] STE-plugin: Add at_util_call_compare_by_id sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
2010-01-25 19:25 ` [PATCH 3/6] STE-plugin: STE modem driver definition sjur.brandeland
0 siblings, 1 reply; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5402 bytes --]
Add STE modem support in gprs.c and network-registration.c
---
drivers/atmodem/gprs.c | 10 ++++-
drivers/atmodem/network-registration.c | 78 +++++++++++++++++++++++++++++++-
drivers/atmodem/vendor.h | 1 +
3 files changed, 86 insertions(+), 3 deletions(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 6034c42..9a8826a 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -3,6 +3,7 @@
* 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
@@ -38,6 +39,7 @@
#include "gatresult.h"
#include "atmodem.h"
+#include "vendor.h"
static const char *cgreg_prefix[] = { "+CGREG:", NULL };
static const char *cgdcont_prefix[] = { "+CGDCONT:", NULL };
@@ -221,7 +223,13 @@ static void at_cgreg_test_cb(gboolean ok, GAtResult *result,
g_at_chat_send(gd->chat, cmd, none_prefix, NULL, NULL, NULL);
g_at_chat_send(gd->chat, "AT+CGAUTO=0", none_prefix, NULL, NULL, NULL);
- g_at_chat_send(gd->chat, "AT+CGEREP=2,1", none_prefix,
+
+ /* ST-E modem does not support AT+CGEREP = 2,1 */
+ if (gd->vendor == OFONO_VENDOR_STE)
+ g_at_chat_send(gd->chat, "AT+CGEREP=1,0", none_prefix,
+ gprs_initialized, gprs, NULL);
+ else
+ g_at_chat_send(gd->chat, "AT+CGEREP=2,1", none_prefix,
gprs_initialized, gprs, NULL);
return;
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index c80acc5..c6489b5 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -3,6 +3,7 @@
* 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
@@ -44,6 +45,9 @@ static const char *none_prefix[] = { NULL };
static const char *creg_prefix[] = { "+CREG:", NULL };
static const char *cops_prefix[] = { "+COPS:", NULL };
static const char *csq_prefix[] = { "+CSQ:", NULL };
+static const char *cind_prefix[] = { "+CIND:", NULL };
+
+#define SIGNAL_STRENGTH_IND 2
struct netreg_data {
GAtChat *chat;
@@ -554,6 +558,64 @@ static void option_octi_notify(GAtResult *result, gpointer user_data)
ofono_info("OCTI mode: %d", mode);
}
+static void ste_ciev_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ int strength, ind;
+ GAtResultIter iter;
+
+ dump_response("ciev_notify", TRUE, result);
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CIEV:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &ind))
+ return;
+
+ if (ind == SIGNAL_STRENGTH_IND) {
+ if (!g_at_result_iter_next_number(&iter, &strength))
+ return;
+
+ strength = (strength * 100) / 5;
+ ofono_netreg_strength_notify(netreg, strength);
+ }
+}
+
+static void ste_cind_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_netreg_strength_cb_t cb = cbd->cb;
+ int strength;
+ GAtResultIter iter;
+ struct ofono_error error;
+
+ dump_response("cind_cb", ok, result);
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (!ok) {
+ cb(&error, -1, cbd->data);
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CIND:")) {
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+ return;
+ }
+
+ /* Skip battery charge level, which is the first reported */
+ g_at_result_iter_skip_next(&iter);
+
+ g_at_result_iter_next_number(&iter, &strength);
+
+ strength = (strength * 100) / 5;
+
+ cb(&error, strength, cbd->data);
+}
+
static void option_ossysi_notify(GAtResult *result, gpointer user_data)
{
int mode;
@@ -614,9 +676,15 @@ static void at_signal_strength(struct ofono_netreg *netreg,
if (!cbd)
goto error;
- if (g_at_chat_send(nd->chat, "AT+CSQ", csq_prefix,
+ if (nd->vendor == OFONO_VENDOR_STE) {
+ if (g_at_chat_send(nd->chat, "AT+CIND?", cind_prefix,
+ ste_cind_cb, cbd, g_free) > 0)
+ return;
+ } else {
+ if (g_at_chat_send(nd->chat, "AT+CSQ", csq_prefix,
csq_cb, cbd, g_free) > 0)
- return;
+ return;
+ }
error:
if (cbd)
@@ -704,6 +772,12 @@ static void at_network_registration_initialized(gboolean ok, GAtResult *result,
g_at_chat_send(nd->chat, "AT_ODO=0", none_prefix,
NULL, NULL, NULL);
break;
+ case OFONO_VENDOR_STE:
+ g_at_chat_send(nd->chat, "AT+CMER=3,0,0,1", NULL,
+ NULL, NULL, NULL);
+ g_at_chat_register(nd->chat, "+CIEV:",
+ ste_ciev_notify, FALSE, netreg, NULL);
+ break;
default:
break;
}
diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index d0df3ab..e28ec92 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -22,6 +22,7 @@
enum ofono_vendor {
OFONO_VENDOR_GENERIC = 0,
OFONO_VENDOR_CALYPSO,
+ OFONO_VENDOR_STE,
OFONO_VENDOR_QUALCOMM_MSM,
OFONO_VENDOR_OPTION_HSO,
OFONO_VENDOR_HUAWEI,
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] STE-plugin: STE modem driver definition
2010-01-25 19:25 ` [PATCH 2/6] STE-plugin: Add vendor STE and quirks in atmodem sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
2010-01-25 19:25 ` [PATCH 4/6] STE-plugin: Add CAIF header files in drivers/stemodem sjur.brandeland
0 siblings, 1 reply; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3084 bytes --]
---
drivers/stemodem/stemodem.c | 50 +++++++++++++++++++++++++++++++++++++++++++
drivers/stemodem/stemodem.h | 29 +++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
create mode 100644 drivers/stemodem/stemodem.c
create mode 100644 drivers/stemodem/stemodem.h
diff --git a/drivers/stemodem/stemodem.c b/drivers/stemodem/stemodem.c
new file mode 100644
index 0000000..530956c
--- /dev/null
+++ b/drivers/stemodem/stemodem.c
@@ -0,0 +1,50 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2009 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
+
+#include <glib.h>
+#include <gatchat.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/types.h>
+
+#include "stemodem.h"
+
+static int stemodem_init(void)
+{
+
+ return 0;
+}
+
+static void stemodem_exit(void)
+{
+
+}
+
+OFONO_PLUGIN_DEFINE(stemodem, "STE modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ stemodem_init, stemodem_exit)
diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
new file mode 100644
index 0000000..c34067d
--- /dev/null
+++ b/drivers/stemodem/stemodem.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2009 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
+ *
+ */
+
+#include <drivers/atmodem/atutil.h>
+
+extern void ste_voicecall_init();
+extern void ste_voicecall_exit();
+
+extern void ste_gprs_context_init();
+extern void ste_gprs_context_exit();
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] STE-plugin: Add CAIF header files in drivers/stemodem.
2010-01-25 19:25 ` [PATCH 3/6] STE-plugin: STE modem driver definition sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
2010-01-25 19:25 ` [PATCH 5/6] STE-plugin: Add STE plugin sjur.brandeland
0 siblings, 1 reply; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 8318 bytes --]
Add CAIF header files. These should go away when CAIF is part of Linux kernel.
---
drivers/stemodem/caif_socket.h | 171 ++++++++++++++++++++++++++++++++++++++++
drivers/stemodem/if_caif.h | 70 ++++++++++++++++
2 files changed, 241 insertions(+), 0 deletions(-)
create mode 100644 drivers/stemodem/caif_socket.h
create mode 100644 drivers/stemodem/if_caif.h
diff --git a/drivers/stemodem/caif_socket.h b/drivers/stemodem/caif_socket.h
new file mode 100644
index 0000000..7122b41
--- /dev/null
+++ b/drivers/stemodem/caif_socket.h
@@ -0,0 +1,171 @@
+/* linux/caif_socket.h
+ * CAIF Definitions for CAIF socket and network layer
+ * Copyright (C) ST-Ericsson AB 2009
+ * Author: Sjur Brendeland/ sjur.brandeland(a)stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef _LINUX_CAIF_SOCKET_H
+#define _LINUX_CAIF_SOCKET_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#include <linux/socket.h>
+#else
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifndef AF_CAIF
+#define AF_CAIF 28 /* CAIF Socket Address Family */
+#endif
+#ifndef PF_CAIF
+#define PF_CAIF AF_CAIF /* CAIF Socket Protocol Family */
+#endif
+#ifndef SOL_CAIF
+#define SOL_CAIF 278 /* CAIF Socket Option Level */
+#endif
+
+/**
+ * enum caif_link_selector - Physical Link Selection.
+ * @CAIF_LINK_HIGH_BANDW: Default physical interface for high-bandwidth
+ * traffic.
+ * @CAIF_LINK_LOW_LATENCY: Default physical interface for low-latency
+ * traffic.
+ */
+enum caif_link_selector {
+ CAIF_LINK_HIGH_BANDW,
+ CAIF_LINK_LOW_LATENCY
+};
+
+/**
+ * enum caif_protocol_type - Types of CAIF protocols in the CAIF Stack.
+ * @CAIFPROTO_AT: Classic AT channel.
+ * @CAIFPROTO_DATAGRAM: Datagram channel.
+ * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
+ * @CAIFPROTO_UTIL: Utility (Psock) channel.
+ * @CAIFPROTO_RFM: Remote File Manager
+ */
+enum caif_protocol_type {
+ CAIFPROTO_AT,
+ CAIFPROTO_DATAGRAM,
+ CAIFPROTO_DATAGRAM_LOOP,
+ CAIFPROTO_UTIL,
+ CAIFPROTO_RFM,
+ _CAIFPROTO_MAX
+};
+#define CAIFPROTO_MAX _CAIFPROTO_MAX
+
+/**
+ * enum caif_at_type - AT Service Endpoint
+ * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
+ */
+enum caif_at_type {
+ CAIF_ATTYPE_PLAIN
+};
+
+/**
+ * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
+ * @family: Address family number, must be AF_CAIF.
+ * @u: Union of address data 'switched' by familty.
+ * @at: Applies when family = CAIFPROTO_AT.
+ * @at.type: Type of AT link to set up (enum caif_at_type).
+ * @util: Applies when family = CAIFPROTO_UTIL
+ * @util.service: Service name.
+ * @dgm: Applies when family = CAIFPROTO_DATAGRAM
+ * @dgm.connection_id: Datagram connection id.
+ * @dgm.nsapi: NSAPI of the PDP-Context.
+ * @rfm: Applies when family = CAIFPROTO_RFM
+ * @rfm.connection_id: Connection ID for RFM.
+ * @rfm.volume: Volume to mount.
+ */
+struct sockaddr_caif {
+ sa_family_t family;
+ union {
+ struct {
+ u_int8_t type; /* type: enum caif_at_type */
+ } at; /* CAIFPROTO_AT */
+ struct {
+ char service[16];
+ } util; /* CAIFPROTO_UTIL */
+ union {
+ u_int32_t connection_id;
+ u_int8_t nsapi;
+ } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
+ struct {
+ u_int32_t connection_id;
+ char volume[16];
+ } rfm; /* CAIFPROTO_RFM */
+ } u;
+};
+
+/**
+ * struct caif_channel_opt - CAIF channel connect options.
+ * @priority: Priority of the channel (between 0 and 0x1f)
+ * @link_selector: Selector for the physical link.
+ * (see enum caif_phy_preference in caif_config.h)
+ * @link_name: Physical link to use. This is the instance name of the
+ * CAIF Physical Driver.
+ */
+struct caif_channel_opt {
+ u_int16_t priority;
+ u_int16_t link_selector;
+ char link_name[16];
+};
+
+/**
+ * struct caif_param - CAIF parameters.
+ * @size: Length of data
+ * @data: Binary Data Blob
+ */
+struct caif_param {
+ u_int16_t size;
+ u_int8_t data[256];
+};
+
+
+/** enum caif_socket_opts - CAIF option values for getsockopt and setsockopt
+ * @CAIFSO_CHANNEL: Used to set the connect options on a CAIF
+ * socket. (struct caif_config_opt). This can only
+ * be set before connecting.
+ * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
+ * utility channel. (struct caif_param). This
+ * can only be set before connecting.
+ *
+ * @CAIFSO_RSP_PARAM: Gets the request parameters for a utility
+ * channel. (struct caif_param). This can only be
+ * fetched after connecting the socket.
+ *
+ * @CAIFSO_UTIL_FLOW: Sets the utility channels flow options.
+ * This can only be set before connecting.
+ * (struct caif_util_modem_flow_opt)
+ *
+ * @CAIFSO_CONN_ID: Gets the channel id on a CAIF Channel.
+ * This can only be done after connect.
+ * ( u_int32_t)
+ *
+ * @CAIFSO_NEXT_PAKCET_LEN: Gets the size of next received packet.
+ * Value is 0 if no packet is available.
+ * This can only be done after connect.
+ * ( u_int32_t)
+ *
+ * @CAIFSO_MAX_PAKCET_LEN: Gets the maximum packet size for this
+ * connection. ( u_int32_t)
+ */
+enum caif_socket_opts {
+ CAIFSO_CHANNEL_CONFIG = 127,
+ CAIFSO_REQ_PARAM = 128,
+ CAIFSO_RSP_PARAM = 129,
+ CAIFSO_UTIL_FLOW = 130,
+ CAIFSO_CONN_ID = 131,
+ CAIFSO_NEXT_PACKET_LEN = 132,
+ CAIFSO_MAX_PACKET_LEN = 133,
+};
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/drivers/stemodem/if_caif.h b/drivers/stemodem/if_caif.h
new file mode 100644
index 0000000..ad3686b
--- /dev/null
+++ b/drivers/stemodem/if_caif.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) ST-Ericsson AB 2009
+ * Author: Sjur Brendeland/ sjur.brandeland(a)stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef IF_CAIF_H_
+#define IF_CAIF_H_
+#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.
+ *
+ * @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.
+ */
+enum ifla_caif {
+ IFLA_CAIF_IPV4_CONNID,
+ IFLA_CAIF_IPV6_CONNID,
+ IFLA_CAIF_LOOPBACK,
+ __IFLA_CAIF_MAX
+};
+#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
+
+#endif /*IF_CAIF_H_*/
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] STE-plugin: Add STE plugin
2010-01-25 19:25 ` [PATCH 4/6] STE-plugin: Add CAIF header files in drivers/stemodem sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
2010-01-25 19:25 ` [PATCH 6/6] STE-plugin: Add STE to Makefile sjur.brandeland
0 siblings, 1 reply; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7314 bytes --]
Add ste plugin.
Changes from RFCv2:
- Added check on return value of socket() and connect() calls.
- Use gsm_permissive syntax all the time.
- Added ATE0 in initialization.
- Minor rework of connection to caif socket, checking return codes etc.
---
plugins/ste.c | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 253 insertions(+), 0 deletions(-)
create mode 100644 plugins/ste.c
diff --git a/plugins/ste.c b/plugins/ste.c
new file mode 100644
index 0000000..f2666eb
--- /dev/null
+++ b/plugins/ste.c
@@ -0,0 +1,253 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2009 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
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <gatchat.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/call-barring.h>
+#include <ofono/call-forwarding.h>
+#include <ofono/call-meter.h>
+#include <ofono/call-settings.h>
+#include <ofono/devinfo.h>
+#include <ofono/message-waiting.h>
+#include <ofono/netreg.h>
+#include <ofono/phonebook.h>
+#include <ofono/sim.h>
+#include <ofono/sms.h>
+#include <ofono/ssn.h>
+#include <ofono/ussd.h>
+#include <ofono/call-volume.h>
+#include <ofono/voicecall.h>
+#include <ofono/gprs.h>
+#include <ofono/gprs-context.h>
+#include <drivers/atmodem/vendor.h>
+#include <drivers/stemodem/caif_socket.h>
+#include <drivers/stemodem/if_caif.h>
+
+struct ste_data {
+ GAtChat *chat;
+};
+
+static int ste_probe(struct ofono_modem *modem)
+{
+ struct ste_data *data;
+
+ DBG("%p", modem);
+
+ data = g_try_new0(struct ste_data, 1);
+
+ if (!data)
+ return -ENOMEM;
+
+ ofono_modem_set_data(modem, data);
+ return 0;
+}
+
+static void ste_remove(struct ofono_modem *modem)
+{
+ struct ste_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ ofono_modem_set_data(modem, NULL);
+
+ g_at_chat_unref(data->chat);
+ g_free(data);
+}
+
+static void ste_debug(const char *str, void *user_data)
+{
+ ofono_info("%s", str);
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+
+ DBG("");
+
+ if (!ok)
+ ofono_modem_set_powered(modem, FALSE);
+
+ ofono_modem_set_powered(modem, TRUE);
+}
+
+static int ste_enable(struct ofono_modem *modem)
+{
+ struct ste_data *data = ofono_modem_get_data(modem);
+ GIOChannel *channel;
+ GAtSyntax *syntax;
+ int fd, err;
+ struct sockaddr_caif addr;
+
+ DBG("%p", modem);
+
+ /* Create a CAIF socket for AT Service */
+ fd = socket(AF_CAIF, SOCK_SEQPACKET, CAIFPROTO_AT);
+ if (fd < 0) {
+ ofono_debug("Failed to create CAIF socket for AT");
+ return -EIO;
+ }
+ memset(&addr, 0, sizeof(addr));
+ addr.family = AF_CAIF;
+ addr.u.at.type = CAIF_ATTYPE_PLAIN;
+
+ /* Connect to the AT Service@the modem */
+ err = connect(fd, (struct sockaddr *) &addr, sizeof(addr));
+ if (err < 0) {
+ close(fd);
+ return err;
+ }
+ channel = g_io_channel_unix_new(fd);
+ if (!channel) {
+ close(fd);
+ return -EIO;
+ }
+ g_io_channel_set_close_on_unref(channel, TRUE);
+
+ syntax = g_at_syntax_new_gsm_permissive();
+
+ data->chat = g_at_chat_new(channel, syntax);
+ g_at_syntax_unref(syntax);
+ g_io_channel_unref(channel);
+
+ if (!data->chat)
+ return -ENOMEM;
+
+ 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+CFUN=1", NULL, cfun_enable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ste_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ g_at_chat_shutdown(data->chat);
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+
+ if (ok)
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static int ste_disable(struct ofono_modem *modem)
+{
+ struct ste_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ if (!data->chat)
+ return 0;
+
+ g_at_chat_cancel_all(data->chat);
+ g_at_chat_unregister_all(data->chat);
+ g_at_chat_send(data->chat, "AT+CFUN=4", NULL,
+ cfun_disable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void ste_pre_sim(struct ofono_modem *modem)
+{
+ struct ste_data *data = ofono_modem_get_data(modem);
+ DBG("%p", modem);
+
+ ofono_devinfo_create(modem, 0, "atmodem", data->chat);
+ ofono_sim_create(modem, 0, "atmodem", data->chat);
+ ofono_voicecall_create(modem, 0, "atmodem", data->chat);
+}
+
+static void ste_post_sim(struct ofono_modem *modem)
+{
+ struct ste_data *data = ofono_modem_get_data(modem);
+ struct ofono_message_waiting *mw;
+ struct ofono_gprs *gprs;
+ struct ofono_gprs_context *gc;
+
+ DBG("%p", modem);
+ ofono_ussd_create(modem, 0, "atmodem", data->chat);
+ ofono_call_forwarding_create(modem, 0, "atmodem", data->chat);
+ ofono_call_settings_create(modem, 0, "atmodem", data->chat);
+ ofono_netreg_create(modem, OFONO_VENDOR_STE, "atmodem", data->chat);
+ ofono_call_meter_create(modem, 0, "atmodem", data->chat);
+ ofono_call_barring_create(modem, 0, "atmodem", data->chat);
+ ofono_ssn_create(modem, 0, "atmodem", data->chat);
+ ofono_sms_create(modem, 0, "atmodem", data->chat);
+ ofono_phonebook_create(modem, 0, "atmodem", data->chat);
+ ofono_call_volume_create(modem, 0, "atmodem", data->chat);
+
+ gprs = ofono_gprs_create(modem,
+ OFONO_VENDOR_STE, "atmodem", data->chat);
+ gc = ofono_gprs_context_create(modem, 0, "atmodem", data->chat);
+
+ if (gprs && gc)
+ ofono_gprs_add_context(gprs, gc);
+
+ mw = ofono_message_waiting_create(modem);
+
+ if (mw)
+ ofono_message_waiting_register(mw);
+}
+
+static struct ofono_modem_driver ste_driver = {
+ .name = "ste",
+ .probe = ste_probe,
+ .remove = ste_remove,
+ .enable = ste_enable,
+ .disable = ste_disable,
+ .pre_sim = ste_pre_sim,
+ .post_sim = ste_post_sim,
+};
+
+static int ste_init(void)
+{
+ return ofono_modem_driver_register(&ste_driver);
+}
+
+static void ste_exit(void)
+{
+ ofono_modem_driver_unregister(&ste_driver);
+}
+
+OFONO_PLUGIN_DEFINE(ste, "ST-Ericsson modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT, ste_init, ste_exit)
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] STE-plugin: Add STE to Makefile
2010-01-25 19:25 ` [PATCH 5/6] STE-plugin: Add STE plugin sjur.brandeland
@ 2010-01-25 19:25 ` sjur.brandeland
0 siblings, 0 replies; 8+ messages in thread
From: sjur.brandeland @ 2010-01-25 19:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
---
Makefile.am | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b6776bd..5e5ccfc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,6 +55,7 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
gatchat/gatutil.h gatchat/gatutil.c \
gatchat/gat.h
+
udev_files = plugins/ofono.rules
if UDEV
@@ -154,6 +155,11 @@ builtin_sources += drivers/atmodem/atutil.h \
builtin_modules += modemconf
builtin_sources += plugins/modemconf.c
+builtin_modules += stemodem
+builtin_sources += drivers/atmodem/atutil.h \
+ drivers/stemodem/stemodem.h \
+ drivers/stemodem/stemodem.c
+
if DATAFILES
conf_DATA += plugins/modem.conf
endif
@@ -187,6 +193,10 @@ builtin_sources += plugins/hfp.c
builtin_modules += palmpre
builtin_sources += plugins/palmpre.c
+
+builtin_modules += ste
+builtin_sources += plugins/ste.c
+
endif
if MAINTAINER_MODE
--
1.6.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] STE-plugin
2010-01-25 19:25 [PATCH 0/6] STE-plugin sjur.brandeland
2010-01-25 19:25 ` [PATCH 1/6] STE-plugin: Add at_util_call_compare_by_id sjur.brandeland
@ 2010-01-25 20:07 ` Marcel Holtmann
1 sibling, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2010-01-25 20:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
Hi Sjur,
> This is a new version of the STE-plugin patch set. Since last RFCv2 we have
> stubbed out Voice Call and GPRS Context handling, changed patch order,
> cleanup some unnecessary includes, moved CAIF header files, and fixed
> most other review comments (hopefully).
I applied all of your 6 patches. However there were some issues with
your submission.
First, please make sure you have a proper .gitconfig with your email
address and author set correct. That way we keep the GIT history clean
and readable. I had to fix this up on all your patches.
Second, please do proper commit messages. Either one line describes what
your are doing (will end up as Subject) or one line and then a body
describing the details. Check the GIT history for examples.
Third, please ensure that "make distcheck" builds properly. I had to fix
it up for the CAIF header files.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-01-25 20:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 19:25 [PATCH 0/6] STE-plugin sjur.brandeland
2010-01-25 19:25 ` [PATCH 1/6] STE-plugin: Add at_util_call_compare_by_id sjur.brandeland
2010-01-25 19:25 ` [PATCH 2/6] STE-plugin: Add vendor STE and quirks in atmodem sjur.brandeland
2010-01-25 19:25 ` [PATCH 3/6] STE-plugin: STE modem driver definition sjur.brandeland
2010-01-25 19:25 ` [PATCH 4/6] STE-plugin: Add CAIF header files in drivers/stemodem sjur.brandeland
2010-01-25 19:25 ` [PATCH 5/6] STE-plugin: Add STE plugin sjur.brandeland
2010-01-25 19:25 ` [PATCH 6/6] STE-plugin: Add STE to Makefile sjur.brandeland
2010-01-25 20:07 ` [PATCH 0/6] STE-plugin Marcel Holtmann
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.