RE: [PATCH] sim: check if lock is locked after code changing attempt
by Jussi.Kangas@tieto.com
Hi Lucas,
On Tue, 2011-01-11 at 16:08 +0200, Lucas De Marchi wrote:
> Hi Jussi
>
> On Tue, Jan 11, 2011 at 10:17 AM, <Jussi.Kangas(a)tieto.com> wrote:
> > Hi,
> >
> > This is fix to Marit Henriksen's TODO item "Check SIM pin status if sim_change_pin fails". I've discussed with Marit and it's ok for her if I fix the issue. Problem here is that issue could perhaps also be fixed with retry counter solution introduced by Lucas De Marchi couple of tasks ago. That would seem however require some extra implementation in ste modem ( at least I was not able get the ofono show correct values without extra modifications ) and I think that isimodems don't have that sort of retry counter at all. Because of that and since I had this solution already implemented I propose it to be added as well.
> >
>
> I failed to understand why you are hard-coding this and why you'd like
> to use retry counters. Can't you just check the pin state by calling
> sim_pin_check()?
>
> Moreover, this is not really implementing what the TODO item says.
>
>
> regards,
> Lucas De Marchi
Marit already proposed sim_pin_check approach 2010/11/2. Denis Kenzior
thought that initializing sim interface would not be a good idea. See
mail "Re: [Patch] sim: Check SIM pin status after changing pin" from
Friday 5th in November 2010.
True, fix proposal does not do exactly what TODO item says. It trusts to
returned error value instead of going to check the sim state once more.
In my testings this value has been trustable so far and there has not
been reason to go check the state. Of course I've tested only with one
modem so this might not be a universal truth.
I don't particularly wish to use the retry counters. I was just thinking that same
information ( PUK required ) could be deduced by counting the retries.
Br,
-Jussi
11 years, 8 months
[PATCH 1/2] Expose voice call direction synchronously
by Rémi Denis-Courmont
Currently, the call direction can only be inferred from the signals.
This adds a property to keep it visible also from GetCalls().
---
src/voicecall.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 97fc36b..2baf2d6 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -352,7 +352,7 @@ static void append_voicecall_properties(struct voicecall *v,
const char *callerid;
const char *timestr;
const char *name;
- ofono_bool_t mpty;
+ ofono_bool_t mpty, originated;
dbus_bool_t emergency_call;
status = call_status_to_string(call->status);
@@ -382,6 +382,10 @@ static void append_voicecall_properties(struct voicecall *v,
×tr);
}
+ originated = call->direction == CALL_DIRECTION_MOBILE_ORIGINATED;
+ ofono_dbus_dict_append(dict, "Originated", DBUS_TYPE_BOOLEAN,
+ &originated);
+
if (g_slist_find_custom(v->vc->multiparty_list,
GINT_TO_POINTER(call->id),
call_compare_by_id))
--
1.7.1
11 years, 8 months
[PATCH v3] ifx: Adding modem selftest for Infineon modem
by Robertino Benis
Hi all,
This is another attempt to submit a patch that triggers Infineon
modem selftest during ofono boot. Patch addresses issues raised
by Marcel from the previous submissions.
Thank you,
-- r.
---
plugins/ifx.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/plugins/ifx.c b/plugins/ifx.c
index c0a69c2..e0eb982 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -71,6 +71,8 @@
#define GPRS3_DLC 4
#define AUX_DLC 5
+#define IFX_SELF_TESTS_TIMEOUT 10
+
static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "GPRS1: ",
"GPRS2: ", "GPRS3: ", "Aux: " };
@@ -81,6 +83,16 @@ static const char *dlc_nodes[NUM_DLC] = { "/dev/ttyGSM1", "/dev/ttyGSM2",
static const char *none_prefix[] = { NULL };
static const char *xdrv_prefix[] = { "+XDRV:", NULL };
+static struct {
+ char *test_desc;
+ char *at_cmd;
+} const mst[] = {
+ { "AT Command Test", "ATE0 +CMEE=1" }, /* set echo & error reporting */
+ { "RTC GTI Test", "at@rtc:rtc_gti_test_verify_32khz()" },
+ { "Device Version Test", "at@vers:device_version_id()" },
+ { NULL, NULL }
+};
+
struct ifx_data {
GIOChannel *device;
GAtMux *mux;
@@ -99,6 +111,7 @@ struct ifx_data {
int audio_loopback;
struct ofono_sim *sim;
gboolean have_sim;
+ int self_test_idx;
};
static void ifx_debug(const char *str, void *user_data)
@@ -545,6 +558,52 @@ static gboolean mux_timeout_cb(gpointer user_data)
return FALSE;
}
+static void ifx_self_test_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ifx_data *data = ofono_modem_get_data(modem);
+
+ if (data->mux_init_timeout > 0) {
+ g_source_remove(data->mux_init_timeout);
+ data->mux_init_timeout = 0;
+ }
+
+ if (!ok) {
+ ofono_error("Modem %s: FAIL",
+ mst[data->self_test_idx].test_desc);
+ g_at_chat_unref(data->dlcs[AUX_DLC]);
+ data->dlcs[AUX_DLC] = NULL;
+
+ g_io_channel_unref(data->device);
+ data->device = NULL;
+
+ ofono_modem_set_powered(modem, FALSE);
+
+ return;
+ }
+
+ data->self_test_idx++;
+
+ if (mst[data->self_test_idx].at_cmd != NULL) {
+ g_at_chat_send(data->dlcs[AUX_DLC],
+ mst[data->self_test_idx].at_cmd,
+ NULL, ifx_self_test_cb, modem, NULL);
+
+ data->mux_init_timeout = g_timeout_add_seconds(
+ IFX_SELF_TESTS_TIMEOUT, mux_timeout_cb, modem);
+
+ } else { /* Enable MUX Channels */
+ data->frame_size = 1509;
+ g_at_chat_send(data->dlcs[AUX_DLC],
+ "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
+ mux_setup_cb, modem, NULL);
+
+ data->mux_init_timeout = g_timeout_add_seconds(5,
+ mux_timeout_cb, modem);
+ }
+}
+
static int ifx_enable(struct ofono_modem *modem)
{
struct ifx_data *data = ofono_modem_get_data(modem);
@@ -595,18 +654,15 @@ static int ifx_enable(struct ofono_modem *modem)
if (getenv("OFONO_AT_DEBUG"))
g_at_chat_set_debug(chat, ifx_debug, "Master: ");
- g_at_chat_send(chat, "ATE0 +CMEE=1", NULL,
- NULL, NULL, NULL);
-
- data->frame_size = 1509;
-
- g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
- mux_setup_cb, modem, NULL);
+ /* Execute Modem Self tests */
+ data->dlcs[AUX_DLC] = chat;
+ data->self_test_idx = 0;
- data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb,
- modem);
+ g_at_chat_send(data->dlcs[AUX_DLC], mst[data->self_test_idx].at_cmd,
+ NULL, ifx_self_test_cb, modem, NULL);
- data->dlcs[AUX_DLC] = chat;
+ data->mux_init_timeout = g_timeout_add_seconds(
+ IFX_SELF_TESTS_TIMEOUT, mux_timeout_cb, modem);
return -EINPROGRESS;
}
--
1.7.0.4
11 years, 8 months
[PATCH 2/2] Inform Huawei modem using ACCM 0xffffffff to trasmit package. Using my Huawei modem (EM770W) if set ACCM as 0x00000000, the RXJ- event will happend, and PPP link down, when IP package transmit for a while. After I set ACCM as 0xffffffff, the RXJ- event never happen, and the modem can work quite stable. I tested the modem at China Unicom networks.
by martin.xu@intel.com
From: Martin Xu <martin.xu(a)intel.com>
---
gatchat/ppp_lcp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c
index bc97257..181bc14 100644
--- a/gatchat/ppp_lcp.c
+++ b/gatchat/ppp_lcp.c
@@ -106,7 +106,7 @@ static void lcp_generate_config_options(struct lcp_data *lcp)
static void lcp_reset_config_options(struct lcp_data *lcp)
{
lcp->req_options = REQ_OPTION_ACCM;
- lcp->accm = 0;
+ lcp->accm = ~0U;
lcp_generate_config_options(lcp);
}
@@ -153,7 +153,7 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
* The Configuration Option is used to inform the peer which control
* characters MUST remain mapped when the peer sends them.
*/
- ppp_set_recv_accm(pppcp_get_ppp(pppcp), 0);
+ ppp_set_recv_accm(pppcp_get_ppp(pppcp), ~0U);
break;
default:
break;
--
1.7.2.2
11 years, 8 months
[PATCHv2] plugin: Add ste modem initd integration
by Sjur Brændeland
From: Sjur Brændeland <sjur.brandeland(a)stericsson.com>
This patch introduces auto discovery of ST-Ericsson modems.
ST-Ericsson modems (M5XX, M57XX, M7XX, M74XX) are managed by a
Modem Init Daemon responsible for start, power cycles,
flashing etc. This STE plugin monitors the modem state exposed
from the Modem Init Damon's Dbus API. When the modem is in state
"on" the STE modem is created and registered. Multiple modem
instances, and reset handling is supported.
---
Changes:
- Support for multiple STE modems.
- Better naming of STE modem instances, using received dbus path.
- CAIF Link layer to use for AT channels specified pr modem instance.
- Added support for reset.
Makefile.am | 5 +
configure.ac | 6 +
plugins/stemid.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 321 insertions(+), 0 deletions(-)
create mode 100644 plugins/stemid.c
diff --git a/Makefile.am b/Makefile.am
index 12b3c33..98096ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,11 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
udev_files = plugins/ofono.rules
+if STE_MODEM_INITD
+builtin_modules += stemid
+builtin_sources += plugins/stemid.c
+endif
+
if UDEV
builtin_modules += udev
builtin_sources += plugins/udev.c
diff --git a/configure.ac b/configure.ac
index 5c18f68..f733fc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,12 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
+AC_ARG_ENABLE(ste_modem_initd, AC_HELP_STRING([--disable-ste-modem-initd],
+ [disable auto discovery of STE modem using modem init daemon]),
+ [enable_ste_modem_initd=${enableval}])
+
+AM_CONDITIONAL(STE_MODEM_INITD, test "${enable_ste_modem_initd}" != "no")
+
if (test "${prefix}" = "NONE"); then
dnl no prefix and no localstatedir, so default to /var
if (test "$localstatedir" = '${prefix}/var'); then
diff --git a/plugins/stemid.c b/plugins/stemid.c
new file mode 100644
index 0000000..9f5da22
--- /dev/null
+++ b/plugins/stemid.c
@@ -0,0 +1,310 @@
+/*
+ *
+ * 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 <errno.h>
+#include <string.h>
+#include <net/if.h>
+
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/dbus.h>
+
+/*
+ * ST-Ericsson's Modem Init Daemon is used for controling the modem power
+ * cycles and provides a dbus API for modem state and properties.
+ */
+#define MID_SERVICE "com.stericsson.modeminit"
+#define MID_INTERFACE MID_SERVICE ".Modem"
+
+/* The signal StateChange sends the modem state.*/
+#define STATUS_CHANGED "StateChange"
+
+#define MID_ACTION_ON "on" /* Modem is on */
+#define MID_ACTION_RESET "dumping" /* Modem is resetting */
+#define MID_ACTION_UNKNOWN "unknown" /* Don't care */
+
+/* ResetState requests resending of StateChange. */
+#define MID_RESEND_STATE "ResendState"
+
+/* GetCaifIfName requests the CAIF Interface Name. */
+#define MID_GET_CAIFIF "GetCaifIfName"
+
+#define TIMEOUT 5000
+#define STE_DRIVER_NAME "ste"
+#define STE_INTERFACE_PROPERTY "Interface"
+
+enum ste_state {
+ STE_PENDING, /* Waiting for caifif and "on" notification */
+ STE_PENDING_IF, /* Waiting for caifif, already got "on" */
+ STE_REGISTERED, /* Modem is registered */
+ STE_RESETTING /* Modem is resetting */
+};
+
+struct ste_modem {
+ char *path;
+ struct ofono_modem *modem;
+ enum ste_state state;
+ gboolean got_caifif;
+ gboolean pending_call;
+};
+
+static GHashTable *modem_list;
+static guint mid_api_watch;
+static guint mid_state_watch;
+static DBusConnection *connection;
+
+static void get_caifif_reply(DBusPendingCall *call, void *user_data)
+{
+ DBusMessage *reply;
+ char *ifname;
+ struct ste_modem *stemodem = user_data;
+
+ stemodem->pending_call = FALSE;
+ stemodem->got_caifif = TRUE;
+ reply = dbus_pending_call_steal_reply(call);
+
+ if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
+ ofono_error("STE Modem Init Daemon: unavailable");
+ goto error;
+ }
+
+ if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &ifname,
+ DBUS_TYPE_INVALID) == FALSE) {
+ ofono_error("STE Modem Init Daemon: bad signature for %s",
+ MID_GET_CAIFIF);
+ goto error;
+ }
+
+ if (strlen(ifname) > IF_NAMESIZE) {
+ ofono_error("STE Modem Init Daemon: %s bad response %s\n",
+ MID_GET_CAIFIF, ifname);
+ goto error;
+ }
+
+ if (ifname != NULL) {
+ DBG("STE Modem '%s' uses CAIF interface '%s'\n", stemodem->path,
+ ifname);
+ ofono_modem_set_string(stemodem->modem, STE_INTERFACE_PROPERTY,
+ ifname);
+ }
+
+error:
+ if (stemodem->state == STE_PENDING_IF) {
+ DBG("Register STE modem %s", stemodem->path);
+ ofono_modem_register(stemodem->modem);
+ stemodem->state = STE_REGISTERED;
+ }
+
+ dbus_message_unref(reply);
+}
+
+static void get_caif_interface(const char *path, struct ste_modem *stemodem)
+{
+ DBusMessage *message;
+ DBusPendingCall *call;
+
+ stemodem->pending_call = TRUE;
+ message = dbus_message_new_method_call(MID_SERVICE, path,
+ MID_INTERFACE, MID_GET_CAIFIF);
+
+ if (!message) {
+ ofono_error("Unable to allocate new D-Bus message");
+ goto error;
+ }
+
+ dbus_message_set_auto_start(message, FALSE);
+
+ if (dbus_connection_send_with_reply(connection, message,
+ &call, TIMEOUT) == FALSE) {
+ ofono_error("Sending D-Bus message failed");
+ stemodem->got_caifif = TRUE;
+ goto error;
+ }
+
+ if (call == NULL) {
+ DBG("D-Bus connection not available");
+ stemodem->got_caifif = TRUE;
+ goto error;
+ }
+
+ dbus_pending_call_set_notify(call, get_caifif_reply, stemodem, NULL);
+ dbus_pending_call_unref(call);
+
+error:
+ dbus_message_unref(message);
+}
+
+static void handle_stemodem(const char *action, const char *path)
+{
+ struct ste_modem *stemodem = g_hash_table_lookup(modem_list, path);
+
+ if (stemodem == NULL) {
+ DBG("created STE modem %s", path);
+ stemodem = g_try_new0(struct ste_modem, 1);
+ if (stemodem == NULL)
+ return;
+
+ /* remove '/' from path to create a leagal modem name */
+ stemodem->modem = ofono_modem_create(path+1, STE_DRIVER_NAME);
+ if (stemodem->modem == NULL) {
+ ofono_error("STE Modem Init: Bad path: '%s'\n", path);
+ g_free(stemodem);
+ return;
+ }
+
+ stemodem->path = g_strdup(path);
+ stemodem->state = STE_PENDING;
+ g_hash_table_insert(modem_list, stemodem->path, stemodem);
+ }
+
+ if (!stemodem->got_caifif) {
+ DBG("request caif interface %s", path);
+ get_caif_interface(path, stemodem);
+ stemodem->state = STE_PENDING;
+ }
+
+ switch (stemodem->state) {
+ case STE_PENDING:
+ if (g_strcmp0(action, MID_ACTION_ON) != 0)
+ break;
+ if (stemodem->got_caifif) {
+ DBG("register STE modem %s", path);
+ ofono_modem_register(stemodem->modem);
+ stemodem->state = STE_REGISTERED;
+ } else
+ stemodem->state = STE_PENDING_IF;
+ break;
+ case STE_PENDING_IF:
+ break;
+ case STE_REGISTERED:
+ if (g_strcmp0(action, MID_ACTION_RESET) == 0) {
+ DBG("reset ongoing %s", path);
+ /* NOTE: Should we set powered = FALSE here? */
+ stemodem->state = STE_RESETTING;
+ } else if (g_strcmp0(action, MID_ACTION_ON) != 0) {
+ DBG("STE modem unregistering %s %s", path, action);
+ g_hash_table_remove(modem_list, path);
+ }
+
+ break;
+ case STE_RESETTING:
+ if (g_strcmp0(action, MID_ACTION_ON) == 0) {
+ DBG("STE modem reset complete %s", path);
+ if (ofono_modem_get_powered(stemodem->modem))
+ ofono_modem_reset(stemodem->modem);
+ } else if (g_strcmp0(action, MID_ACTION_RESET) != 0) {
+ DBG("STE modem unregistering %s %s", path, action);
+ g_hash_table_remove(modem_list, path);
+ }
+
+ break;
+ }
+}
+
+static gboolean mid_signal_status_change(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ const char *state;
+ const char *path = dbus_message_get_path(message);
+
+ if (dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &state,
+ DBUS_TYPE_INVALID) == FALSE) {
+ ofono_error("STE Modem Init Daemon: invalid signal signature");
+ return FALSE;
+ }
+
+ if (g_strcmp0(path, "/") == 0)
+ return TRUE;
+
+ handle_stemodem(state, path);
+ return TRUE;
+}
+
+static void mid_connect(DBusConnection *connection, void *user_data)
+{
+ DBusMessage *message;
+
+ mid_state_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
+ MID_INTERFACE,
+ STATUS_CHANGED,
+ mid_signal_status_change,
+ NULL, NULL);
+
+ message = dbus_message_new_method_call(MID_SERVICE, "/",
+ MID_INTERFACE, MID_RESEND_STATE);
+ if (!message) {
+ ofono_error("Unable to allocate new D-Bus message");
+ goto error;
+ }
+
+ if (dbus_connection_send(connection, message, NULL) == FALSE)
+ ofono_error("Sending D-Bus message failed");
+
+error:
+ dbus_message_unref(message);
+}
+
+static void mid_disconnect(DBusConnection *connection, void *user_data)
+{
+ g_hash_table_remove_all(modem_list);
+ g_dbus_remove_watch(connection, mid_state_watch);
+}
+
+static void destroy_stemodem(gpointer data)
+{
+ struct ste_modem *stemodem = data;
+
+ ofono_modem_remove(stemodem->modem);
+ g_free(stemodem->path);
+ g_free(stemodem);
+}
+
+static int stemid_init()
+{
+ connection = ofono_dbus_get_connection();
+ if (connection == NULL)
+ return -EIO;
+
+ modem_list = g_hash_table_new_full(g_str_hash, g_str_equal,
+ NULL, destroy_stemodem);
+ mid_api_watch = g_dbus_add_service_watch(connection, MID_SERVICE,
+ mid_connect, mid_disconnect, NULL, NULL);
+ return 0;
+}
+
+static void stemid_exit()
+{
+ DBusConnection *connection = ofono_dbus_get_connection();
+
+ g_hash_table_destroy(modem_list);
+ g_dbus_remove_watch(connection, mid_api_watch);
+}
+
+OFONO_PLUGIN_DEFINE(stemid, "STE Modem Init Daemon dbus api", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT, stemid_init, stemid_exit)
--
1.7.0.4
11 years, 8 months
Discussion on CTM enhancement
by Predon, Frederic
Hi,
As we are currently implementing the CTM modem driver for ifxmodem, I would like to bring a couple of things in the discussion.
Today, patches for our modem driver are ready by before submitting them on the mailing list, I have 2 items to discuss:
1) First, it might a good proposal to merge the TextTelephony and the AudioSettings atoms. Enabling and disabling CTM on a platform require to configure the audio settings on the modem side (audio routing parameters changes). Today, in my patches, I have nearly the same code as the AudioSetting modem driver for configuring the audio. Another proposal would be that the TextTelephony atom indicates to the AudioSetting atom that CTM is enable or disable but that would be good also to merge the 2.
Any idea?
2) Secondly, I think that 2 properties can be added in the TextTelephony atom and/or the AudioSetting atom (or the "merged" atom described in 1). The first property is when the device receives an incoming CTM call. Even if the type is still a voice call, upper layers should be notified that the incoming is a TTY call to display some UI stuff or to turn on the TTY mode in case the device is not already TTY enabled (this is totally UI dependant but at least we leave the flexibility to the UI to decide).
The second property is for MO calls. Remote user can accept the call as a TTY enable device or not. This is supported by the standard. In our case, we are receiving unsolicited AT commands "CTM CALL" when the remote party has accepted the call as a TTY enabled device and "NO CTM CALL" when the remote has accepted the call but his device is not TTY enabled.
Let me know your thinking
Regards
Fred
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 8 months
[PATCH 3/3] nokiacdma: Add CDMA devinfo support
by Dara Spieker-Doyle
---
plugins/nokiacdma.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
index 4b11f9d..514382f 100644
--- a/plugins/nokiacdma.c
+++ b/plugins/nokiacdma.c
@@ -43,6 +43,7 @@
#include <drivers/atmodem/atutil.h>
#include <ofono/cdma-voicecall.h>
+#include <ofono/devinfo.h>
#include "common.h"
@@ -134,6 +135,7 @@ static void nokiacdma_pre_sim(struct ofono_modem *modem)
struct nokiacdma_data *data = ofono_modem_get_data(modem);
ofono_cdma_voicecall_create(modem, 0, "cdmamodem", data->chat);
+ ofono_devinfo_create(modem, 0, "cdmamodem", data->chat);
}
static void nokiacdma_post_sim(struct ofono_modem *modem)
--
1.7.0.4
11 years, 8 months
[PATCH 0/3] Add CDMA devinfo support
by Dara Spieker-Doyle
This series of patches provide CDMA AT support device info. It re-uses the GSM
atom interface and provides cdmamodem driver support, moving common utilities
to atutil.[ch] for sharing with the atmodem driver.
HW support for testing is implemented in the nokiacdma plugin.
These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.
Limitations
-----------
Patches 2/3 and 3/3 are dependent on acceptance of the CDMA MO Voicecall v5
patch series.
Dara Spieker-Doyle (3):
atmodem: Share common devinfo utilities
cdmamodem: Add CDMA devinfo support
nokiacdma: Add CDMA devinfo support
Makefile.am | 3 +-
drivers/atmodem/atutil.c | 56 ++++++++++++++
drivers/atmodem/atutil.h | 2 +
drivers/atmodem/devinfo.c | 59 +-------------
drivers/cdmamodem/cdmamodem.c | 2 +
drivers/cdmamodem/cdmamodem.h | 2 +
drivers/cdmamodem/devinfo.c | 169 +++++++++++++++++++++++++++++++++++++++++
plugins/nokiacdma.c | 2 +
8 files changed, 239 insertions(+), 56 deletions(-)
create mode 100644 drivers/cdmamodem/devinfo.c
11 years, 8 months
[PATCH] test: add change-pin test case
by Jussi.Kangas@tieto.com
---
Makefile.am | 3 ++-
test/change-pin | 29 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletions(-)
create mode 100755 test/change-pin
diff --git a/Makefile.am b/Makefile.am
index cc30624..4c9add4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -446,7 +446,8 @@ test_scripts = test/backtrace \
test/set-tty \
test/set-gsm-band \
test/set-umts-band \
- test/lockdown-modem
+ test/lockdown-modem \
+ test/change-pin
if TEST
testdir = $(pkglibdir)/test
diff --git a/test/change-pin b/test/change-pin new file mode 100755 index 0000000..a2444d6
--- /dev/null
+++ b/test/change-pin
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 5:
+ path = sys.argv[1]
+ pin_type = sys.argv[2]
+ orig_pin = sys.argv[3]
+ new_pin = sys.argv[4]
+elif len(sys.argv) == 4:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+ pin_type = sys.argv[1]
+ orig_pin = sys.argv[2]
+ new_pin = sys.argv[3]
+else:
+ print "%s [PATH] pin_type pin" % (sys.argv[0])
+ sys.exit(0)
+
+print "Change Pin for modem %s..." % path simmanager =
+dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.SimManager')
+
+simmanager.ChangePin(pin_type, orig_pin, new_pin)
--
1.7.1
11 years, 8 months
[BUG] [MBM] mbm_disconnect(..) and reopen_callback(..) gives oFono seg fault
by Tomasz GREGOREK
Hi Marcel
I am using MBM modem in oFono and I have run into a problem with
reopen_callback(..) function.
I think you might be interested in looking into this as an author
of the code.
The situation is as follow:
1. connect modem to USB port
2. Power the modem up: Modem.SetProperty( Powered = True )
2a. oFono is in the middle of enabling process
3. disconnect modem from USB port
2b. oFono is still in the middle of enabling process, and modem is not marked
as enabled
4. mbm_disconnect(..) is called, gprs atom removed, reopen_callback(..) is set
to be called in 1 second delay with data->reopen_source timer
5. mbm_remove(..) is called, notice that at this point the mbm_disable(..)
function call is not called as modem is not enabled yet, and the
reopen_callback 1 second timer is still running.
6. timer expiries and as a result reopen_callback(..) is called. At this
point modem is already removed and function accesses an already
freed memory
7. oFono crashes with segmentation fault
Normally reopen_callback timer would be removed in mbm_disable(..) called
if enabling process has finished.
The easy solution is to add removal of reopen_callback timer in mbm_remove(..)
but I can imagine a race condition then. It might happen that during heavy load
time between mbm_disconnect(..) and mbm_disable(..) or mbm_remove(..) can
be longer than 1 second resulting in call to reopen_callback(..) during hardware
disconnection process. Though I am not sure what can happen here, if this will
result in segmentation fault or it would just execute without any side effects.
I have also noticed that other vendors don't go with delayed
reopen_collback(..) at all. They usually try to reopen directly
in mbm_disconnect(..).
Best regards
Tomasz Gregorek
ST-Ericsson
Below an example of log from oFono and some gdb data with source code of
reopen_callback(..) and mbm_disconnect(..) as reference.
[1]
ofonod[1735]: plugins/mbm.c:mbm_probe() 0x812ce58
ofonod[1735]: plugins/smart-messaging.c:modem_watch() modem: 0x812ce58, added: 1
ofonod[1735]: plugins/push-notification.c:modem_watch() modem: 0x812ce58, added: 1
ofonod[1735]: plugins/mbm.c:mbm_enable() 0x812ce58
ofonod[1735]: src/modem.c:get_modem_property() modem 0x812ce58 property ModemDevice
ofonod[1735]: src/modem.c:get_modem_property() modem 0x812ce58 property DataDevice
[2] ofonod[1735]: plugins/mbm.c:mbm_enable() /dev/ttyACM1, /dev/ttyACM0
ofonod[1735]: Modem: > AT\r
ofonod[1735]: Data: > AT\r
ofonod[1735]: Data: < \r\nOK\r\n
ofonod[1735]: Data: > AT&F E0 V1 X4 &C1 +CMEE=1\r
ofonod[1735]: Data: < AT&F E0 V1 X4 &C1 +CMEE=1\r
ofonod[1735]: Data: < \r\nOK\r\n
[3]
[4] ofonod[1735]: plugins/mbm.c:mbm_disconnect() mbm_disconnect ******************************************
ofonod[1735]: plugins/udev.c:remove_modem() /devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.1/tty/ttyACM0
ofonod[1735]: src/modem.c:get_modem_property() modem 0x812ce58 property Path
ofonod[1735]: src/modem.c:ofono_modem_remove() 0x812ce58
[5] ofonod[1735]: plugins/mbm.c:mbm_remove() 0x812ce58
ofonod[1735]: src/modem.c:unregister_property() property 0x812ded8
ofonod[1735]: src/modem.c:unregister_property() property 0x812d2d0
ofonod[1735]: src/modem.c:unregister_property() property 0x812c988
ofonod[1735]: src/modem.c:unregister_property() property 0x812d080
ofonod[1735]: src/modem.c:unregister_property() property 0x812cee0
ofonod[1735]: plugins/smart-messaging.c:modem_watch() modem: 0x812ce58, added: 0
ofonod[1735]: plugins/push-notification.c:modem_watch() modem: 0x812ce58, added: 0
ofonod[1735]: plugins/udev.c:remove_modem() /devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.3/tty/ttyACM1
ofonod[1735]: plugins/udev.c:remove_modem() /devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.6/net/usb0
[6] ofonod[1735]: plugins/mbm.c:reopen_callback() reopen_callback ******************************************
[7]
Program received signal SIGSEGV, Segmentation fault.
0x080a7927 in reopen_callback (user_data=0x812ce58) at plugins/mbm.c:318
318 data->reopen_source = 0;
(gdb) p data
$1 = (struct mbm_data *) 0x2d303336
(gdb) p *data
Cannot access memory at address 0x2d303336
(gdb) p *modem
$2 = {path = 0x812e468 "", modem_state = 135453480, atoms = 0x2f6c6169, atom_watches = 0x692d7962, interface_list = 0x73752f64,
feature_list = 0x54532d62, call_ids = 1769096493, pending = 0x6f737363, interface_update = 1414750062, powered = 1769096493,
powered_pending = 1869837155, timeout = 1867341678, online = 1701603682, online_watches = 0x6f72425f, properties = 0x61626461,
sim = 0x465f646e, sim_watch = 1160788025, sim_ready_watch = 876754743, driver = 0x36454432, driver_data = 0x2d303336,
driver_type = 0x33306669 <Address 0x33306669 out of bounds>, name = 0x0}
(gdb) l 305,361
305 static void mbm_disconnect(gpointer user_data);
306
307 static gboolean reopen_callback(gpointer user_data)
308 {
309 struct ofono_modem *modem = user_data;
310 struct mbm_data *data = ofono_modem_get_data(modem);
311 const char *data_dev;
312
313 DBG("reopen_callback ******************************************");
314
315 //if(!data)
316 // return FALSE;
317
318 data->reopen_source = 0;
319
320 data_dev = ofono_modem_get_string(modem, "DataDevice");
321
322 data->data_port = create_port(data_dev);
323 if (data->data_port == NULL)
324 return FALSE;
325
326 if (getenv("OFONO_AT_DEBUG"))
327 g_at_chat_set_debug(data->data_port, mbm_debug, "Data: ");
328
329 g_at_chat_set_disconnect_function(data->data_port,
330 mbm_disconnect, modem);
331
332 ofono_info("Reopened GPRS context channel");
333
334 data->gc = ofono_gprs_context_create(modem, 0,
335 "atmodem", data->data_port);
336 if (data->gprs && data->gc) {
337 ofono_gprs_context_set_type(data->gc,
338 OFONO_GPRS_CONTEXT_TYPE_MMS);
339 ofono_gprs_add_context(data->gprs, data->gc);
340 }
341
342 return FALSE;
343 }
344
345 static void mbm_disconnect(gpointer user_data)
346 {
347 struct ofono_modem *modem = user_data;
348 struct mbm_data *data = ofono_modem_get_data(modem);
349
350 DBG("mbm_disconnect ******************************************");
351
352 if (data->gc)
353 ofono_gprs_context_remove(data->gc);
354 //data->gc = NULL;
355
356 g_at_chat_unref(data->data_port);
357 data->data_port = NULL;
358
359 /* Waiting for the +CGEV: ME DEACT might also work */
360 data->reopen_source = g_timeout_add_seconds(5, reopen_callback, modem);
361 }
(gdb)
11 years, 8 months