RE: [PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-02 Thread Rajesh.Nagaiah
Hi Dara, 
  
> +enum cdma_call_status {
> + CDMA_CALL_STATUS_ACTIVE = 0,
> + CDMA_CALL_STATUS_DIALING = 1,
> + CDMA_CALL_STATUS_ALERTING = 2,
> + CDMA_CALL_STATUS_INCOMING = 4,

Should be 3 ?

> + CDMA_CALL_STATUS_DISCONNECTED
> +};

We can use the existing gsm call status itself ?
Just that we wont use the HELD and WAITING status
in CDMA.

BR,
Rajesh
 
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] doc: Add RoamingPreference property

2010-12-02 Thread Rajesh Kadhiravan Nagaiah
---
 doc/cdma-network-api.txt |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/doc/cdma-network-api.txt b/doc/cdma-network-api.txt
index fd88d4e..62da5d8 100644
--- a/doc/cdma-network-api.txt
+++ b/doc/cdma-network-api.txt
@@ -68,3 +68,14 @@ Properties   string Status [readonly]
string Name [readonly, optional]
 
Contains the name of the current network.
+
+   string RoamingPreference [readwrite]
+
+   Contains the roaming preference used in the network
+   selection.
+
+   The possible values are:
+   "home"Home networks only
+   "roamonly"Roaming networks only
+   "affiliated"  Affiliated networks only
+   "any" Any network
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


doc: Add RoamingPreference property

2010-12-02 Thread Rajesh Kadhiravan Nagaiah
Hi,
In CDMA network selection the user can select the type of network to register.
It can be Home/Roaming only/Affliated/Any network. Added this user selection
as a property in cdma network registration interface.
BR,
Rajesh
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 5/5] test: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am   |5 -
 test/cdma-dial-number |   25 +
 test/cdma-hangup  |   20 
 test/cdma-list-call   |   30 ++
 4 files changed, 79 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

diff --git a/Makefile.am b/Makefile.am
index 929ce63..1d0b414 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -432,7 +432,10 @@ test_scripts = test/backtrace \
test/test-push-notification \
test/test-smart-messaging \
test/send-vcard \
-   test/set-tty
+   test/set-tty \
+   test/cdma-list-call \
+   test/cdma-dial-number \
+   test/cdma-hangup
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-dial-number b/test/cdma-dial-number
new file mode 100755
index 000..fbf5e85
--- /dev/null
+++ b/test/cdma-dial-number
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv) > 2:
+   path = sys.argv[1]
+   number = sys.argv[2]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+   number = sys.argv[1]
+
+print "Using modem %s" % path
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Dial(number, "")
+
diff --git a/test/cdma-hangup b/test/cdma-hangup
new file mode 100755
index 000..f8e631e
--- /dev/null
+++ b/test/cdma-hangup
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+if len(sys.argv) > 2:
+   path = sys.argv[1]
+else:
+   modems = manager.GetModems()
+   path, properties = modems[0]
+
+manager = dbus.Interface(bus.get_object('org.ofono', path),
+   
'org.ofono.cdma.VoiceCallManager')
+
+manager.Hangup()
diff --git a/test/cdma-list-call b/test/cdma-list-call
new file mode 100755
index 000..9f9fdbc
--- /dev/null
+++ b/test/cdma-list-call
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   print "[ %s ]" % (path)
+
+   if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
+   continue
+
+   mgr = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.VoiceCallManager')
+
+   properties = mgr.GetProperties()
+
+   for key in properties.keys():
+   if key in ["Interfaces", "Features"]:
+   val = ""
+   for i in properties[key]:
+   val += i + " "
+   else:
+   val = str(properties[key])
+   print "%s = %s" % (key, val)
\ No newline at end of file
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/5] cdmagen: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am |3 +
 plugins/cdmagen.c   |  276 +++
 plugins/ofono.rules |4 +
 plugins/udev.c  |   21 
 4 files changed, 304 insertions(+), 0 deletions(-)
 create mode 100644 plugins/cdmagen.c

diff --git a/Makefile.am b/Makefile.am
index 9aac08b..929ce63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -293,6 +293,9 @@ builtin_sources += plugins/ste.c
 
 builtin_modules += caif
 builtin_sources += plugins/caif.c
+
+builtin_modules += cdmagen
+builtin_sources += plugins/cdmagen.c
 endif
 
 if MAINTAINER_MODE
diff --git a/plugins/cdmagen.c b/plugins/cdmagen.c
new file mode 100644
index 000..41a4bd2
--- /dev/null
+++ b/plugins/cdmagen.c
@@ -0,0 +1,276 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia 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 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "common.h"
+
+struct cdmagen_data {
+   GAtChat *chat;
+   ofono_bool_t online;
+   ofono_bool_t registration_status;
+};
+
+static void cdmagen_debug(const char *str, void *data)
+{
+   const char *prefix = data;
+
+   ofono_info("%s%s", prefix, str);
+}
+
+static int cdmagen_probe(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data;
+
+   DBG("%p", modem);
+
+   data = g_try_new0(struct cdmagen_data, 1);
+   if (data == NULL)
+   return -ENOMEM;
+
+   ofono_modem_set_data(modem, data);
+
+   return 0;
+}
+
+static void cdmagen_remove(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG("%p", modem);
+
+   ofono_modem_set_data(modem, NULL);
+
+   if (data->chat)
+   g_at_chat_unref(data->chat);
+
+   g_free(data);
+}
+
+static GAtChat *create_port(const char *device)
+{
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   GAtChat *chat;
+
+   channel = g_at_tty_open(device, NULL);
+   if (channel == NULL)
+   return NULL;
+
+   syntax = g_at_syntax_new_gsmv1();
+
+   chat = g_at_chat_new(channel, syntax);
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (chat == NULL)
+   return NULL;
+
+   return chat;
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+   const char *key, char *debug)
+{
+   const char *device;
+   GAtChat *chat;
+
+   device = ofono_modem_get_string(modem, key);
+   if (device == NULL)
+   return NULL;
+
+   DBG("%s %s", key, device);
+
+   chat = create_port(device);
+   if (chat == NULL)
+   return NULL;
+
+   g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE);
+
+   if (getenv("OFONO_AT_DEBUG"))
+   g_at_chat_set_debug(chat, cdmagen_debug, debug);
+
+   return chat;
+}
+
+static void cdmagen_disconnect(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG("%p", modem);
+
+   g_at_chat_unref(data->chat);
+   data->chat = NULL;
+
+   data->chat = open_device(modem, "Device", "CDMA Device: ");
+   if (data->chat == NULL)
+   return;
+
+   g_at_chat_set_disconnect_function(data->chat,
+   cdmagen_disconnect, modem);
+}
+
+/* power up hardware */
+static int cdmagen_enable(struct ofono_modem *modem)
+{
+   struct cdmagen_data *data = ofono_modem_get_data(modem);
+
+   DBG("%p", modem);
+
+   ofono_modem_set_boolean(modem, "no_sim_required", TRUE);
+
+   data->chat = open_device(modem, "Device", "CDMA Device: ");
+   if (data->chat == NULL)
+   return -EINVAL;
+
+   g_at_chat_set_disconnect_function(data->chat,
+   cdmagen_disconnect, modem);
+
+   if (getenv("OFONO_AT_DEBUG"))
+   g_at_chat_set_debug(data->chat, cdmagen_debug,
+   "CDMA Generic: ");
+
+   return 0;
+}
+
+static int cdmagen_disabl

[PATCH 3/5] cdma-atmodem: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am  |7 ++
 configure.ac |5 +
 drivers/cdma-atmodem/atmodem.c   |   47 +
 drivers/cdma-atmodem/atmodem.h   |   26 +
 drivers/cdma-atmodem/atutil.c|   45 +
 drivers/cdma-atmodem/atutil.h|   65 +
 drivers/cdma-atmodem/voicecall.c |  195 ++
 7 files changed, 390 insertions(+), 0 deletions(-)
 create mode 100644 drivers/cdma-atmodem/atmodem.c
 create mode 100644 drivers/cdma-atmodem/atmodem.h
 create mode 100644 drivers/cdma-atmodem/atutil.c
 create mode 100644 drivers/cdma-atmodem/atutil.h
 create mode 100644 drivers/cdma-atmodem/voicecall.c

diff --git a/Makefile.am b/Makefile.am
index f111f96..9aac08b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,6 +242,13 @@ conf_DATA += plugins/phonesim.conf
 endif
 endif
 
+if CDMA_ATMODEM
+builtin_modules += cdma_atmodem
+builtin_sources += drivers/cdma-atmodem/atmodem.c \
+   drivers/cdma-atmodem/atmodem.h \
+   drivers/cdma-atmodem/voicecall.c
+endif
+
 builtin_modules += g1
 builtin_sources += plugins/g1.c
 
diff --git a/configure.ac b/configure.ac
index 0c1986a..090f3ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,11 @@ AC_ARG_ENABLE(atmodem, AC_HELP_STRING([--disable-atmodem],
[enable_atmodem=${enableval}])
 AM_CONDITIONAL(ATMODEM, test "${enable_atmodem}" != "no")
 
+AC_ARG_ENABLE(cdmaatmodem, AC_HELP_STRING([--disable-cdma-atmodem],
+   [disable CDMA AT modem support]),
+   [enable_cdma_atmodem=${enableval}])
+AM_CONDITIONAL(CDMA_ATMODEM, test "${enable_cdma_atmodem}" != "no")
+
 AC_ARG_ENABLE(phonesim, AC_HELP_STRING([--disable-phonesim],
[disable Phone simulator support]),
[enable_phonesim=${enableval}])
diff --git a/drivers/cdma-atmodem/atmodem.c b/drivers/cdma-atmodem/atmodem.c
new file mode 100644
index 000..86dd074
--- /dev/null
+++ b/drivers/cdma-atmodem/atmodem.c
@@ -0,0 +1,47 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 
+#endif
+
+#include 
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include 
+#include 
+
+#include "atmodem.h"
+
+static int cdma_atmodem_init(void)
+{
+   cdma_at_voicecall_init();
+
+   return 0;
+}
+
+static void cdma_atmodem_exit(void)
+{
+   cdma_at_voicecall_exit();
+}
+
+OFONO_PLUGIN_DEFINE(cdma_atmodem, "CDMA AT modem driver", VERSION,
+   OFONO_PLUGIN_PRIORITY_DEFAULT, cdma_atmodem_init, cdma_atmodem_exit)
diff --git a/drivers/cdma-atmodem/atmodem.h b/drivers/cdma-atmodem/atmodem.h
new file mode 100644
index 000..32facbc
--- /dev/null
+++ b/drivers/cdma-atmodem/atmodem.h
@@ -0,0 +1,26 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+extern void cdma_at_voicecall_init();
+extern void cdma_at_voicecall_exit();
+
+extern void cdma_at_devinfo_init();
+extern void cdma_at_devinfo_exit();
diff --git a/drivers/cdma-atmodem/atutil.c b/drivers/cdma-atmodem/atutil.c
new file mode 100644
index 000..b58c1ee
--- /dev/null
+++ b/drivers/cdma-atmodem/atutil.c
@@ -0,0 +1,45 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 

[PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 src/cdma-voicecall.c |  449 ++
 src/common.c |   42 +
 src/common.h |   14 ++
 src/ofono.h  |3 +
 5 files changed, 510 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-voicecall.c

diff --git a/Makefile.am b/Makefile.am
index aea3fd3..f111f96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,7 +319,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/radio-settings.c src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
-   src/smsagent.c src/smsagent.h src/ctm.c
+   src/smsagent.c src/smsagent.h src/ctm.c \
+   src/cdma-voicecall.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
new file mode 100644
index 000..8ba3222
--- /dev/null
+++ b/src/cdma-voicecall.c
@@ -0,0 +1,449 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "ofono.h"
+
+#include "common.h"
+
+static GSList *g_drivers;
+
+struct ofono_cdma_voicecall_manager {
+   struct ofono_cdma_phone_number phone_number;
+   int direction;
+   enum cdma_call_status status;
+   time_t start_time;
+   DBusMessage *pending;
+   const struct ofono_cdma_voicecall_manager_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static void generic_callback(const struct ofono_error *error, void *data);
+
+static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
+{
+   switch (r) {
+   case OFONO_DISCONNECT_REASON_LOCAL_HANGUP:
+   return "local";
+   case OFONO_DISCONNECT_REASON_REMOTE_HANGUP:
+   return "remote";
+   default:
+   return "network";
+   }
+}
+
+static const char *cdma_call_status_to_string(enum cdma_call_status status)
+{
+   switch (status) {
+   case CDMA_CALL_STATUS_ACTIVE:
+   return "active";
+   case CDMA_CALL_STATUS_DIALING:
+   return "dialing";
+   case CDMA_CALL_STATUS_ALERTING:
+   return "alerting";
+   case CDMA_CALL_STATUS_INCOMING:
+   return "incoming";
+   default:
+   return "disconnected";
+   }
+}
+
+static const char *time_to_str(const time_t *t)
+{
+   static char buf[128];
+   struct tm tm;
+
+   strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime_r(t, &tm));
+   buf[127] = '\0';
+
+   return buf;
+}
+
+static void append_voicecall_properties(struct ofono_cdma_voicecall_manager *v,
+   DBusMessageIter *dict)
+{
+   const char *status;
+   const char *lineid;
+   const char *timestr;
+
+   status = cdma_call_status_to_string(v->status);
+   lineid = cdma_phone_number_to_string(&v->phone_number);
+
+   ofono_dbus_dict_append(dict, "State", DBUS_TYPE_STRING, &status);
+
+   ofono_dbus_dict_append(dict, "LineIdentification",
+   DBUS_TYPE_STRING, &lineid);
+
+   if (v->status == CDMA_CALL_STATUS_ACTIVE ||
+   (v->status == CDMA_CALL_STATUS_DISCONNECTED &&
+   v->start_time != 0)) {
+   timestr = time_to_str(&v->start_time);
+
+   ofono_dbus_dict_append(dict, "StartTime", DBUS_TYPE_STRING,
+   ×tr);
+   }
+}
+
+static DBusMessage *voicecall_manager_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_voicecall_manager *v = data;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   reply = dbus_message_new_method_return(msg);
+
+   if (reply == NULL)
+   return NULL;
+
+   dbus_message_iter_init_append(reply, &iter);
+
+   

[PATCH 0/5] Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
This set of patches introduces the foundation for CDMA Voicecall support in
oFono. They cover making a simple MO call over a CDMA network, including call
state management, LineIdentification, dialing and hanging up through the
cdma-voicecall atom DBus interface. 
Currently, the implemented call states available are "dialing" and
"disconnected", initiated on dialing and hanging up, and the LineIdentification
property is updated only upon dialing. The StartTime for when a call would 
become
"active" has been implemented, but is untested until support for call state
transition changes is implemented. This is future work.

AT command support for dial and hangup is provided with a cdma-atmodem driver.
Also included in these patches are test scripts and a CDMA generic hardware
plugin (cdmagen) to support testing of these features.

These patches have been tested against the Nokia 7205 CDMA device in a tethered
mode.

Limitations
---
The Nokia 7205 device does not support an AT interface for reporting request
responses, such as the call status and remote/network disconnect reasons, so
these are currently untested.

Dara Spieker-Doyle (5):
  cdma-voicecall: Add CDMA MO Call Support
  cdma-voicecall: Add CDMA MO Call Support
  cdma-atmodem: Add CDMA MO Call Support
  cdmagen: Add CDMA MO Call Support
  test: Add CDMA MO Call Support

 Makefile.am  |   20 ++-
 configure.ac |5 +
 drivers/cdma-atmodem/atmodem.c   |   47 
 drivers/cdma-atmodem/atmodem.h   |   26 +++
 drivers/cdma-atmodem/atutil.c|   45 
 drivers/cdma-atmodem/atutil.h|   65 ++
 drivers/cdma-atmodem/voicecall.c |  195 +
 include/cdma-voicecall.h |   82 +++
 include/dbus.h   |3 +
 include/types.h  |8 +
 plugins/cdmagen.c|  276 +++
 plugins/ofono.rules  |4 +
 plugins/udev.c   |   21 ++
 src/cdma-voicecall.c |  449 ++
 src/common.c |   42 
 src/common.h |   14 ++
 src/ofono.h  |3 +
 test/cdma-dial-number|   25 ++
 test/cdma-hangup |   20 ++
 test/cdma-list-call  |   30 +++
 20 files changed, 1377 insertions(+), 3 deletions(-)
 create mode 100644 drivers/cdma-atmodem/atmodem.c
 create mode 100644 drivers/cdma-atmodem/atmodem.h
 create mode 100644 drivers/cdma-atmodem/atutil.c
 create mode 100644 drivers/cdma-atmodem/atutil.h
 create mode 100644 drivers/cdma-atmodem/voicecall.c
 create mode 100644 include/cdma-voicecall.h
 create mode 100644 plugins/cdmagen.c
 create mode 100644 src/cdma-voicecall.c
 create mode 100755 test/cdma-dial-number
 create mode 100755 test/cdma-hangup
 create mode 100755 test/cdma-list-call

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-02 Thread Dara Spieker-Doyle
---
 Makefile.am  |2 +-
 include/cdma-voicecall.h |   82 ++
 include/dbus.h   |3 ++
 include/types.h  |8 
 4 files changed, 94 insertions(+), 1 deletions(-)
 create mode 100644 include/cdma-voicecall.h

diff --git a/Makefile.am b/Makefile.am
index a4c47e8..aea3fd3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/gprs.h include/gprs-context.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
-   include/ctm.h
+   include/ctm.h include/cdma-voicecall.h
 
 nodist_include_HEADERS = include/version.h
 
diff --git a/include/cdma-voicecall.h b/include/cdma-voicecall.h
new file mode 100644
index 000..d5ef3c5
--- /dev/null
+++ b/include/cdma-voicecall.h
@@ -0,0 +1,82 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia 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
+ *
+ */
+
+#ifndef __OFONO_CDMA_VOICECALL_H
+#define __OFONO_CDMA_VOICECALL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+struct ofono_cdma_voicecall_manager;
+
+typedef void (*ofono_cdma_voicecall_cb_t)(const struct ofono_error *error,
+   void *data);
+
+/* Voice call related functionality, including AT+CDV, AT+CHV */
+struct ofono_cdma_voicecall_manager_driver {
+   const char *name;
+   int (*probe)(struct ofono_cdma_voicecall_manager *vc,
+   unsigned int vendor, void *data);
+   void (*remove)(struct ofono_cdma_voicecall_manager *vc);
+
+   void (*dial)(struct ofono_cdma_voicecall_manager *vc,
+   const struct ofono_cdma_phone_number *number,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+
+   /* Hangs up active, dialing, alerting or incoming calls */
+   void (*hangup)(struct ofono_cdma_voicecall_manager *vc,
+   ofono_cdma_voicecall_cb_t cb, void *data);
+
+};
+
+void ofono_cdma_voicecall_manager_disconnected(
+   struct ofono_cdma_voicecall_manager *vc,
+   enum ofono_disconnect_reason reason,
+   const struct ofono_error *error);
+
+int ofono_cdma_voicecall_manager_driver_register(
+   const struct ofono_cdma_voicecall_manager_driver *d);
+void ofono_cdma_voicecall_manager_driver_unregister(
+   const struct ofono_cdma_voicecall_manager_driver *d);
+
+struct ofono_cdma_voicecall_manager *ofono_cdma_voicecall_manager_create(
+   struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_cdma_voicecall_manager_register(
+   struct ofono_cdma_voicecall_manager *vc);
+void ofono_cdma_voicecall_manager_remove(
+   struct ofono_cdma_voicecall_manager *vc);
+
+void ofono_cdma_voicecall_manager_set_data(
+   struct ofono_cdma_voicecall_manager *vc, void *data);
+void *ofono_cdma_voicecall_manager_get_data(
+   struct ofono_cdma_voicecall_manager *vc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_VOICECALL_H */
diff --git a/include/dbus.h b/include/dbus.h
index 9e29afb..ad84ca9 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -55,6 +55,9 @@ extern "C" {
 #define OFONO_STK_INTERFACE OFONO_SERVICE ".SimToolkit"
 #define OFONO_SIM_APP_INTERFACE OFONO_SERVICE ".SimToolkitAgent"
 
+/*CDMA Interfaces*/
+#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE 
"org.ofono.cdma.VoiceCallManager"
+
 /* Essentially a{sv} */
 #define OFONO_PROPERTIES_ARRAY_SIGNATURE DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
diff --git a/include/types.h b/include/types.h
index ba2481f..1ebedc6 100644
--- a/include/types.h
+++ b/include/types.h
@@ -83,6 +83,14 @@ struct ofono_phone_number {
int type;
 };
 
+/* Length of NUM_FIELDS in 3GPP2 C.S0005-E v2.0*/
+#define OFONO_MAX_CDMA_PHONE_NUMBER_LENGTH 256
+
+struct ofono_cd

[PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-02 Thread Dara Spieker-Doyle
---
 TODO |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a421a99..3007620 100644
--- a/TODO
+++ b/TODO
@@ -496,3 +496,61 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
   Owner: Sjur Br??ndeland 
+
+CDMA Voicecall
+==
+
+- Add support for Mobile Originated and Mobile Terminated Voice Call over
+  a CDMA network. This includes management of call state and providing
+  appropriate values for the LineIdentification in each case.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Three-Way Calling over a CDMA network. Three-Way Calling
+  provides the subscriber with the capability to add a third party to an
+  established two-party call, so that all three parties may communicate in a
+  three-way call.
+
+  In CDMA mode, the originating subscriber of a current conversation can
+  request for a third party to be added to a conversation by sending a Flash
+  With Information Message (FWIM) with dialed digits to the network. Upon
+  setting up a two-way conversation with the added party, the originating
+  subscriber can request to establish a three-way conversation by sending
+  another Flash With Information Message. Upon receiving the second Flash With
+  Information Message, the MSC reconnects the original party to the
+  conversation thus completing the setup of a three-way conversation.
+
+  CDMA Three-Way Calling is described by Figure B-5 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
+  notification of an incoming call to an originating subscriber, while the
+  subscriber's call is in the 2-way state. Subsequently, the originating
+  subscriber can either answer or ignore the incoming call. If the originating
+  subscriber answers the second call, it may alternate between the two calls.
+
+  In CDMA mode, the originating subscriber of a current conversation will
+  receive either a Flash With Information Message or an Alert With Information
+  Message from the network if there is an additional mobile terminated voice
+  call incoming. The originating subscriber can change conversation parties by
+  sending a Flash With Information Message to the network and the MSC will
+  toggle the speech path between the two conversations.
+
+  CDMA Call Waiting is described by Figure B-6 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Support sending DTMF tones over CDMA network.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] Skip unsolicited CREG/CGREG correctly

2010-12-02 Thread Denis Kenzior
Hi Tonny,

On 12/02/2010 08:23 AM, Tonny Tzeng wrote:
> This patch skip unsolicited CREG/CGREG correctly.
> 
> Signed-off-by: Tonny Tzeng 

Please don't use Signed-off-by

> ---
>  drivers/atmodem/atutil.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
> index b6f0d92..2ca7b44 100644
> --- a/drivers/atmodem/atutil.c
> +++ b/drivers/atmodem/atutil.c
> @@ -244,8 +244,9 @@ gboolean at_util_parse_reg(GAtResult *result, const
> char *prefix,
>   continue;
>  
>   /* Some firmware will report bogus lac/ci when unregistered */
> + /* in this case, we should skip it  */
>   if (s != 1 && s != 5)
> - goto out;
> + continue;

And this fix is wrong.  what this is doing is skipping the parsing of
the lac/ci values if we're not registered / roaming.  Using continue
here will cause the parser to fail for those cases.

What you probably meant was continuing if the status was not between 1
and 5.  But even that won't really help you if an lac of 1..5 is
encountered ;)

>  
>   switch (vendor) {
>   case OFONO_VENDOR_HUAWEI:

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] gatchat: fix canceling in progress commands

2010-12-02 Thread Vinicius Costa Gomes
As g_queue_peek_head() returns the node data field, we have to compare
it against the actual command, not against the pointer to the queue node.
---
 gatchat/gatchat.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index d82a02e..96da657 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -1060,7 +1060,7 @@ static gboolean at_chat_cancel(struct at_chat *chat, 
guint group, guint id)
if (c->gid != group)
return FALSE;
 
-   if (l == g_queue_peek_head(chat->command_queue) &&
+   if (c == g_queue_peek_head(chat->command_queue) &&
chat->cmd_bytes_written > 0) {
/* We can't actually remove it since it is most likely
 * already in progress, just null out the callback
-- 
1.7.3.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 4/5] Add Lockdown property to Modem interface

2010-12-02 Thread Denis Kenzior
On 11/25/2010 01:02 PM, Gustavo F. Padovan wrote:
> Setting Lockdown to TRUE means power down the modem and hold a lock that
> only permits the lock's owner power up the modem back. When released
> it restores the last state of the modem before holding the lock.
> ---
>  doc/modem-api.txt |   10 +
>  src/modem.c   |  105 
> +
>  2 files changed, 115 insertions(+), 0 deletions(-)
> 
> diff --git a/doc/modem-api.txt b/doc/modem-api.txt
> index b92e53c..7189245 100644
> --- a/doc/modem-api.txt
> +++ b/doc/modem-api.txt
> @@ -37,6 +37,16 @@ Properties boolean Powered [readwrite]
>   Boolean representing the rf state of the modem.
>   Online is false in flight mode.
>  
> + boolean Lockdown [readwrite]
> +
> + Boolean representing the lock state of the modem.
> + Setting it to true, makes the calling application hold
> + the modem lock and power it down. Setting to false
> + makes the it restore the modem state before the
> + lockdown and release the modem lock. Only the

Can you update the docs to mention that oFono does not re-power up the
modem.

> + application that holds the lock can power up the modem.
> + If the the application exits Lockdown is set to false.
> +
>   boolean Emergency [readonly, optional, experimental]
>  
>   Boolean representing the emergency mode of the
> diff --git a/src/modem.c b/src/modem.c
> index 1828a3b..0ad488d 100644
> --- a/src/modem.c
> +++ b/src/modem.c
> @@ -71,6 +71,9 @@ struct ofono_modem {
>   ofono_bool_tpowered;
>   ofono_bool_tpowered_pending;
>   ofono_bool_tget_online;
> + ofono_bool_tlockdown;
> + char*lock_owner;
> + guint   lock_watch;
>   guint   timeout;
>   ofono_bool_tonline;
>   struct ofono_watchlist  *online_watches;
> @@ -579,6 +582,9 @@ void __ofono_modem_append_properties(struct ofono_modem 
> *modem,
>   ofono_dbus_dict_append(dict, "Powered", DBUS_TYPE_BOOLEAN,
>   &modem->powered);
>  
> + ofono_dbus_dict_append(dict, "Lockdown", DBUS_TYPE_BOOLEAN,
> + &modem->lockdown);
> +
>   devinfo_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_DEVINFO);
>  
>   /* We cheat a little here and don't check the registered status */
> @@ -713,6 +719,22 @@ static gboolean set_powered_timeout(gpointer user)
>   return FALSE;
>  }
>  
> +static void lockdown_disconnect(DBusConnection *conn, void *user_data)
> +{
> + struct ofono_modem *modem = user_data;
> +
> + DBG("");
> +
> + g_free(modem->lock_owner);
> +
> + modem->lockdown = FALSE;
> +
> + ofono_dbus_signal_property_changed(conn, modem->path,
> + OFONO_MODEM_INTERFACE,
> + "Lockdown", DBUS_TYPE_BOOLEAN,
> + &modem->lockdown);
> +}
> +
>  static DBusMessage *modem_set_property(DBusConnection *conn,
>   DBusMessage *msg, void *data)
>  {
> @@ -755,6 +777,9 @@ static DBusMessage *modem_set_property(DBusConnection 
> *conn,
>   if (modem->powered == powered)
>   return dbus_message_new_method_return(msg);
>  
> + if (modem->lockdown)
> + return __ofono_error_access_denied(msg);
> +
>   err = set_powered(modem, powered);
>   if (err < 0) {
>   if (err != -EINPROGRESS)
> @@ -786,6 +811,81 @@ static DBusMessage *modem_set_property(DBusConnection 
> *conn,
>   return NULL;
>   }
>  
> + if (g_str_equal(name, "Lockdown")) {

Can you break this out into a separate function, similar to how we
handle Online?  Otherwise this function becomes way too long.

> + ofono_bool_t lockdown, powered;
> + const char *caller;
> + int err;
> +
> + if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
> + return __ofono_error_invalid_args(msg);
> +
> + dbus_message_iter_get_basic(&var, &lockdown);
> +
> + if (modem->pending != NULL)
> + return __ofono_error_busy(msg);
> +
> + if (modem->lockdown == lockdown)
> + return dbus_message_new_method_return(msg);
> +
> + if (modem->powered != modem->powered_pending)
> + return __ofono_error_not_available(msg);
> +
> + caller = dbus_message_get_sender(msg);
> +
> + if (lockdown) {
> + modem->lock_owner = g_strdup(caller);
> +
> + modem->lock_watch = g_dbus_add_s

Re: [PATCH 5/5] Add test script for the Lockdown property

2010-12-02 Thread Denis Kenzior
Hi Gustavo,

On 11/25/2010 01:02 PM, Gustavo F. Padovan wrote:
> ---
>  test/lockdown-modem |   25 +
>  1 files changed, 25 insertions(+), 0 deletions(-)
>  create mode 100755 test/lockdown-modem
> 

Please make sure to update Makefile.am as well.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/5] modem: add support to restore state when resetting the modem

2010-12-02 Thread Denis Kenzior
Hi Gustavo,

> @@ -488,16 +465,18 @@ static void online_cb(const struct ofono_error *error, 
> void *data)
>   DBusMessage *reply;
>  
>   if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
> - modem->modem_state == MODEM_STATE_OFFLINE)
> + modem->modem_state == MODEM_STATE_OFFLINE) {
> + modem_change_state(modem, MODEM_STATE_ONLINE);
> +
> + if (!modem->pending)
> + return;
> +

Fair enough...

>   reply = dbus_message_new_method_return(modem->pending);
> - else
> + } else {
>   reply = __ofono_error_failed(modem->pending);

But what about the error case?

> + }
>  
>   __ofono_dbus_pending_reply(&modem->pending, reply);
> -
> - if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
> - modem->modem_state == MODEM_STATE_OFFLINE)
> - modem_change_state(modem, MODEM_STATE_ONLINE);
>  }
>  
>  static void offline_cb(const struct ofono_error *error, void *data)

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/5] Add ofono_modem_reset()

2010-12-02 Thread Denis Kenzior
Hi Gustavo,

On 11/25/2010 01:02 PM, Gustavo F. Padovan wrote:
> Some modems can screw up everything and then we will need to do a silent
> reset of the modem. This patch take the modem back to the OFFLINE state.
> ---
>  include/modem.h |2 ++
>  src/modem.c |   15 +++
>  2 files changed, 17 insertions(+), 0 deletions(-)

Two patches please.  One for the include change, one for the implementation.

Otherwise looks good.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] TODO: Add onwer to 'GPS power control atom' task

2010-12-02 Thread Rafael Ignacio Zurita

---
 TODO |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a421a99..a365d38 100644
--- a/TODO
+++ b/TODO
@@ -488,6 +488,7 @@ Miscellaneous
 
   Priority: Low
   Complexity: C4
+  Owner: Rafael Ignacio Zurita 
 
 - Add Location Service API for providing basic E911 suport.
   This will be based on the 27.007 defined AT commands using
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: DUN Client Support

2010-12-02 Thread Gustavo F. Padovan
Hi Claudio,

* Claudio Degioanni  [2010-12-02 19:16:47 +0100]:

> Hi all,
> 
> I have a question about ofono current release. It supports the DUN profile
> passing throw bluez dbus ?

No, it doesn't. But there is a initial implementation that I've started some
months ago. You can find it at:

http://lists.ofono.org/pipermail/ofono/2010-November/005523.html

It is not finished yet. Feel free to take my patches as base and finish the
DUN client implementation.

Regards,

-- 
Gustavo F. Padovan
http://profusion.mobi
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


DUN Client Support

2010-12-02 Thread Claudio Degioanni

Hi all,

I have a question about ofono current release. It supports the DUN profile
passing throw bluez dbus ?

thank you
Claudio

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] TODO: Add onwer to CNAP task

2010-12-02 Thread Gustavo F. Padovan
---
 TODO |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a421a99..edf9841 100644
--- a/TODO
+++ b/TODO
@@ -249,6 +249,7 @@ Supplementary Services
 
   Priority: Low
   Complexity: C2
+  Owner: Gustavo F Padovan 
 
 - User to User Signaling (UUS) support
 
-- 
1.7.3.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/3] isimodem: context activation might follow attach

2010-12-02 Thread Mika Liljeberg
---
 drivers/isimodem/gprs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index 3c9facd..deffb1a 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -259,7 +259,7 @@ static GIsiRequest *attach_request_send(GIsiClient *client, 
void *data)
 {
const unsigned char msg[] = {
GPDS_ATTACH_REQ,
-   GPDS_FOLLOW_OFF
+   GPDS_FOLLOW_ON
};
 
return g_isi_send(client, msg, sizeof(msg), GPDS_TIMEOUT,
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/3] gprs: attach on demand

2010-12-02 Thread Mika Liljeberg
Attach automatically when a GPRS context is activated
---
 src/gprs.c |  153 ---
 1 files changed, 83 insertions(+), 70 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 610f3b2..d4b4e24 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -106,6 +106,7 @@ struct context_settings {
 
 struct pri_context {
ofono_bool_t active;
+   ofono_bool_t activation_pending;
enum ofono_gprs_context_type type;
char name[MAX_CONTEXT_NAME_LENGTH + 1];
char message_proxy[MAX_MESSAGE_PROXY_LENGTH + 1];
@@ -647,6 +648,49 @@ static DBusMessage *pri_get_properties(DBusConnection 
*conn,
return reply;
 }
 
+static gboolean assign_context(struct pri_context *ctx)
+{
+   struct idmap *cidmap = ctx->gprs->cid_map;
+   unsigned int cid_min;
+   GSList *l;
+
+   if (cidmap == NULL)
+   return FALSE;
+
+   cid_min = idmap_get_min(cidmap);
+
+   ctx->context.cid = gprs_cid_alloc(ctx->gprs);
+   if (ctx->context.cid == 0)
+   return FALSE;
+
+   for (l = ctx->gprs->context_drivers; l; l = l->next) {
+   struct ofono_gprs_context *gc = l->data;
+
+   if (gc->inuse == TRUE)
+   continue;
+
+   if (gc->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
+   gc->type == ctx->type) {
+   ctx->context_driver = gc;
+   ctx->context_driver->inuse = TRUE;
+   return TRUE;
+   }
+   }
+
+   return FALSE;
+}
+
+static void free_context(struct pri_context *ctx)
+{
+   gprs_cid_release(ctx->gprs, ctx->context.cid);
+   ctx->context.cid = 0;
+   ctx->active = FALSE;
+   ctx->activation_pending = FALSE;
+   if (ctx->context_driver)
+   ctx->context_driver->inuse = FALSE;
+   ctx->context_driver = NULL;
+}
+
 static void pri_activate_callback(const struct ofono_error *error,
const char *interface,
ofono_bool_t static_ip,
@@ -666,11 +710,7 @@ static void pri_activate_callback(const struct ofono_error 
*error,
__ofono_dbus_pending_reply(&ctx->pending,
__ofono_error_failed(ctx->pending));
 
-   gprs_cid_release(ctx->gprs, ctx->context.cid);
-   ctx->context.cid = 0;
-   ctx->context_driver->inuse = FALSE;
-   ctx->context_driver = NULL;
-
+   free_context(ctx);
return;
}
 
@@ -706,15 +746,9 @@ static void pri_deactivate_callback(const struct 
ofono_error *error, void *data)
return;
}
 
-   gprs_cid_release(ctx->gprs, ctx->context.cid);
-   ctx->context.cid = 0;
-   ctx->active = FALSE;
-   ctx->context_driver->inuse = FALSE;
-   ctx->context_driver = NULL;
-
+   free_context(ctx);
__ofono_dbus_pending_reply(&ctx->pending,
dbus_message_new_method_return(ctx->pending));
-
pri_reset_context_settings(ctx);
 
value = ctx->active;
@@ -957,38 +991,6 @@ static DBusMessage *pri_set_message_center(struct 
pri_context *ctx,
return NULL;
 }
 
-static gboolean assign_context(struct pri_context *ctx)
-{
-   struct idmap *cidmap = ctx->gprs->cid_map;
-   unsigned int cid_min;
-   GSList *l;
-
-   if (cidmap == NULL)
-   return FALSE;
-
-   cid_min = idmap_get_min(cidmap);
-
-   ctx->context.cid = gprs_cid_alloc(ctx->gprs);
-   if (ctx->context.cid == 0)
-   return FALSE;
-
-   for (l = ctx->gprs->context_drivers; l; l = l->next) {
-   struct ofono_gprs_context *gc = l->data;
-
-   if (gc->inuse == TRUE)
-   continue;
-
-   if (gc->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
-   gc->type == ctx->type) {
-   ctx->context_driver = gc;
-   ctx->context_driver->inuse = TRUE;
-   return TRUE;
-   }
-   }
-
-   return FALSE;
-}
-
 static DBusMessage *pri_set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
 {
@@ -1030,8 +1032,19 @@ static DBusMessage *pri_set_property(DBusConnection 
*conn,
if (ctx->active == (ofono_bool_t) value)
return dbus_message_new_method_return(msg);
 
-   if (value && !ctx->gprs->attached)
-   return __ofono_error_not_attached(msg);
+   if (value && !ctx->gprs->attached) {
+   gprs_netreg_update(ctx->gprs);
+
+   if (!(ctx->gprs->flags & GPRS_FLAG_ATTACHING))
+   return __ofono_error_not_attached(msg);
+
+   if (!assign_context(c

[PATCH 0/3] Attach GPRS on demand

2010-12-02 Thread Mika Liljeberg
Hi All,

Currently, if GPRS service is detached for whatever reason, the only way
to get PS services back is to set the Powered property to FALSE and back
to TRUE.

With these patches, GPRS context activation will cause oFono to
automatically attempt GPRS attach if the modem is presently detached.

Br,

MikaL

[PATCH 1/3] gprs: attach on demand
[PATCH 2/3] gprs: update documentation
[PATCH 3/3] isimodem: context activation might follow attach
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/3] gprs: update documentation

2010-12-02 Thread Mika Liljeberg
---
 doc/connman-api.txt |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/doc/connman-api.txt b/doc/connman-api.txt
index 22e02e5..e53032c 100644
--- a/doc/connman-api.txt
+++ b/doc/connman-api.txt
@@ -142,6 +142,9 @@ Properties  boolean Active [readwrite]
Holds whether the context is activated.  This value
can be set to activate / deactivate the context.
 
+   Activating a context will automatically trigger the
+   GPRS attach procedure if necessary.
+
string AccessPointName [readwrite]
 
Holds the name of the access point.  This is
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] Skip unsolicited CREG/CGREG correctly

2010-12-02 Thread Tonny Tzeng
This patch skip unsolicited CREG/CGREG correctly.

Signed-off-by: Tonny Tzeng 
---
 drivers/atmodem/atutil.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index b6f0d92..2ca7b44 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -244,8 +244,9 @@ gboolean at_util_parse_reg(GAtResult *result, const
char *prefix,
continue;
 
/* Some firmware will report bogus lac/ci when unregistered */
+   /* in this case, we should skip it  */
if (s != 1 && s != 5)
-   goto out;
+   continue;
 
switch (vendor) {
case OFONO_VENDOR_HUAWEI:
-- 
1.7.2.2


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] HACKING: Add ofono.conf file copy command required

2010-12-02 Thread Denis Kenzior
Hi Rafael,

On 11/30/2010 03:56 PM, Rafael Ignacio Zurita wrote:
> 
> Add ofono.conf copy command required for oFono core daemon to work.
> 
> ---
>  HACKING |3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] HACKING: add guidelines to patch submission

2010-12-02 Thread Denis Kenzior
Hi Lucas,

On 12/01/2010 09:46 AM, Lucas De Marchi wrote:
> ---
>  HACKING |   19 +++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] smsutil: Fix issue in mwi dcs decoding

2010-12-02 Thread Denis Kenzior
Hi Jeevaka,

On 12/02/2010 03:43 AM, Jeevaka Badrappan wrote:
> ---
>  src/smsutil.c |7 ++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 

Yes, good catch.  Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] To fix the test agent quit issue when execute play-tone command of stk

2010-12-02 Thread Denis Kenzior
On 12/02/2010 03:29 AM, Zhigang Li wrote:
> ---
>  test/test-stk-menu |   12 
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] gprs: Fix for gprs context conversion

2010-12-02 Thread Denis Kenzior
Hi Antti,

On 12/02/2010 01:19 AM, Antti Paila wrote:
> ---
>  src/gprs.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: Need Clarification on DCS handling in Status Report for SMS

2010-12-02 Thread Denis Kenzior
Hi Rajesh,

> 
> Yes, this is a bug. But rather than setting the DCS to default in
> this case, we should rather not call that sms_dcs_decode() function
> from ofono_sms_status_notify(), as the class information derived from
> the DCS decoding is not used there and also we are not handling the
> optional text information in the status report handling currently.

It is still a bug that should be fixed ;)

> 
> If we decide to handle this optional text information (most likely not
> going to happen), then some modifications are required.
> 
> Also there is another bug in the current code which might not be
> relevant
> if we decide to remove the sms_dcs_decode() function call from
> ofono_sms_status_notify(). In that function call instead of passing
> s.status_report.dcs, we are currently passing s.deliver.dcs.

That is a good catch.  We should actually check the DCS to filter out
any malformed status reports.

Anyway, both issues should now be fixed with commits:
c5a42cfabe3abe0d99299daffbe04c33a217fb25
ac72349017fbfdecbba000c0259cc6b99f0873ed

Please test and report back whether the issues persist.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] TODO: add owner to 'SIM PIN retry counter' task

2010-12-02 Thread Lucas De Marchi
---
 TODO |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index a421a99..878b0ab 100644
--- a/TODO
+++ b/TODO
@@ -114,6 +114,7 @@ SIM / SIM File system
 
   Priority: Low
   Complexity: C2
+  Owner: Lucas De Marchi 
 
 - Add support for SIM 'ready' notifications from the driver to the core.  Most
   modem manufacturers initialize the SIM (e.g. cache SIM file system, STK
-- 
1.7.3.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] plugins: Restructure caif channel creation

2010-12-02 Thread Helen Clemson
From: Helen Clemson 

This is restructuring the caif channel creation, so that at a later
date multiple AT channels can be supported. This effectively moves
the channel creation from ste_enable, into its own function,
ste_create_channel.
---
 plugins/ste.c |   40 
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/plugins/ste.c b/plugins/ste.c
index ecdc326..8bebfa4 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -64,8 +64,12 @@
 #include 
 #include 
 
+#define NUM_CHAT   1
+
 static const char *cpin_prefix[] = { "+CPIN:", NULL };
 
+static char *chat_prefixes[NUM_CHAT] = { "Default: " };
+
 struct ste_data {
GAtChat *chat;
guint cpin_poll_source;
@@ -162,11 +166,9 @@ static void cfun_enable(gboolean ok, GAtResult *result, 
gpointer user_data)
init_simpin_check(modem);
 }
 
-static int ste_enable(struct ofono_modem *modem)
+static GIOChannel *ste_create_channel(struct ofono_modem *modem)
 {
-   struct ste_data *data = ofono_modem_get_data(modem);
GIOChannel *channel;
-   GAtSyntax *syntax;
const char *device;
int fd;
 
@@ -182,7 +184,7 @@ static int ste_enable(struct ofono_modem *modem)
fd = socket(AF_CAIF, SOCK_STREAM, CAIFPROTO_AT);
if (fd < 0) {
ofono_error("Failed to create CAIF socket for AT");
-   return -EIO;
+   return NULL;
}
 
/* Bind CAIF socket to specified interface */
@@ -197,7 +199,7 @@ static int ste_enable(struct ofono_modem *modem)
ofono_error("Failed to bind caif socket "
"to interface");
close(fd);
-   return err;
+   return NULL;
}
}
 
@@ -210,37 +212,51 @@ static int ste_enable(struct ofono_modem *modem)
if (err < 0) {
ofono_error("Failed to connect CAIF socket for AT");
close(fd);
-   return err;
+   return NULL;
}
} else {
fd = open(device, O_RDWR);
if (fd < 0) {
ofono_error("Failed to open device %s", device);
-   return -EIO;
+   return NULL;
}
}
 
channel = g_io_channel_unix_new(fd);
if (channel == NULL)  {
close(fd);
-   return -EIO;
+   return NULL;
}
g_io_channel_set_close_on_unref(channel, TRUE);
 
+   return channel;
+}
+
+static int ste_enable(struct ofono_modem *modem)
+{
+   struct ste_data *data = ofono_modem_get_data(modem);
+   GIOChannel *channel;
+   GAtSyntax *syntax;
+
syntax = g_at_syntax_new_gsm_permissive();
 
+   channel = ste_create_channel(modem);
+   if (!channel)
+   return -EIO;
+
data->chat = g_at_chat_new_blocking(channel, syntax);
-   g_at_syntax_unref(syntax);
+   g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
+   NULL, NULL, NULL, NULL);
+
g_io_channel_unref(channel);
+   g_at_syntax_unref(syntax);
 
if (data->chat == NULL)
return -ENOMEM;
 
if (getenv("OFONO_AT_DEBUG"))
-   g_at_chat_set_debug(data->chat, ste_debug, "");
+   g_at_chat_set_debug(data->chat, ste_debug, chat_prefixes[0]);
 
-   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=4", NULL, cfun_enable, modem, NULL);
 
return -EINPROGRESS;
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] smsutil: Fix issue in mwi dcs decoding

2010-12-02 Thread Jeevaka Badrappan
---
 src/smsutil.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index b06e9bf..ccd30f6 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -219,7 +219,12 @@ gboolean sms_mwi_dcs_decode(guint8 dcs, enum sms_mwi_type 
*type,
else
dis = FALSE;
 
-   if (upper == 3)
+   /*
+* As per 3GPP TS 23.038 specification, if bits 7..4 set to 1110,
+* text included in the user data is coded in the uncompresssed
+* UCS2 character set.
+*/
+   if (upper == 2)
ch = SMS_CHARSET_UCS2;
else
ch = SMS_CHARSET_7BIT;
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] To fix the test agent quit issue when execute play-tone command of stk

2010-12-02 Thread Zhigang Li
---
 test/test-stk-menu |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/test-stk-menu b/test/test-stk-menu
index 916a527..456a522 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -138,6 +138,18 @@ class StkAgent(dbus.service.Object):
def Cancel(self):
print "Cancel"
 
+   @dbus.service.method("org.ofono.SimToolkitAgent",
+   in_signature="ssy", out_signature="")
+
+   def PlayTone(self, tone, text, icon):
+   print "playtone is %s" % (tone)
+
+@dbus.service.method("org.ofono.SimToolkitAgent",
+in_signature="ssy", out_signature="")
+
+def LoopTone(self, tone, text, icon):
+print "the loop tone is %s" % (tone)
+
 if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
-- 
1.6.5.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono