RE: [PATCH 02/12] gprs: driver interface changes for IPv6

2011-02-08 Thread Mika.Liljeberg
Hi Marcel, 

Thanks for the comments.

  Normally, IPv6 addresses and routes are autoconfigured 
 using IPv6 stateless address autoconfiguration followed 
 optionally by DHCPv6 to get additional settings. The kernel 
 actually starts stateless address autoconfiguration 
 immediately when the interface is configured up (which oFono 
 does), assuming the interface already has a link-local IPv6 
 address (which all Ethernet interface do have, as it is 
 calculated from the MAC address and added automatically).
  
  Point-to-point interfaces, on the other, require the 
 link-local address to be added manually to the interface 
 before the autoconfiguration can happen. oFono should 
 probably add the address to be consistent with Ethernet interfaces.
 
 I am not sure we really wanna be consistent with how Ethernet works
 since we are not actually Ethernet.
 
 So I can see benefits for having ConnMan control the 
 link-local in case
 of point-to-point, but then I also do see the benefit oFono doing it.
 
 We might have to spin of ideas and see what is the most 
 logical one and
 what works best. Especially also in the context of LTE support in the
 future.

I agree. The pragmatic way would be to just choose one option now and see how 
that works for us. We can revisit the issue later when we understand the 
requirements better.

  The upshot would be that IPv6 could be autoconfigured 
 immediately without connman's intervention. IPv6 does not 
 have private address spaces, so in theory connman does not 
 really have to care about IPv6 addresses and routes. However, 
 the optional DHCPv6 step would probably be controlled by 
 connman. Configuration of IPv6 tethering would be another 
 optional followup step controlled by connman.
 
 Yes, DHCPv6 step needs to be done by ConnMan. We do not have DHCPv6
 support right now. We only plan to use it for extra settings like
 proxies, timeservers etc.
 
  On the other hand, if we want connman to be fully in 
 charge, we could change oFono to always leave the network 
 interface down and let connman do everything. Marcels input 
 on this would be welcome as well.
 
 This is something we need to figure out. And of course this 
 all needs to
 be aligned with IPv4 and IPv6. Right now we are treating this 
 similar to
 how wpa_supplicant for WiFi does this.
 
 So going back to potential LTE and IMS support; if that runs IPv6 then
 it might make sense to just autoconfigure it without ConnMan
 interaction.

Ok. If you agree, I'll add link-local address configuration to my patches for 
all IPv6 contexts for the time being. Autonomous autoconfiguration is in 
accordance with IPv6 philosophy anyway. Might as well see how far it takes us. 
We can always move to a connman controlled approach later if that turns out to 
be necessary.

Regards,

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


Re: [RFC] voicecall API changes (proposal v3)

2011-02-08 Thread Andras Domokos

Hi Denis,

On 02/07/2011 09:39 PM, ext Denis Kenzior wrote:

Hi Andras,

On 02/07/2011 11:09 AM, Andras Domokos wrote:

---
  doc/call-barring-api.txt |   10 --
  doc/voicecall-api.txt|   11 +++
  doc/voicecallmanager-api.txt |   25 +
  3 files changed, 36 insertions(+), 10 deletions(-)


Your patch still didn't apply due to whitespace at EOF, but I was nice
and enough and fixed it for you.  Patch has been applied.  I went ahead
and marked the properties / signals as experimental until an
implementation arrives.

Thanks a lot!
I move on to preparing the implementation patches.

Regards,
-Denis

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


Re: [PATCH -v2 5/7] dun_gw: Add DUN server plugin for oFono

2011-02-08 Thread Guillaume Zajac

Hi Gustavo,

Thanks for clarification.

Kind regards,
Guillaume

On 07/02/2011 19:19, Gustavo F. Padovan wrote:

Hi Guillaume,

* Guillaume Zajacguillaume.za...@linux.intel.com  [2011-02-07 10:21:58 +0100]:


Hi Padovan,

One comment below.

Kind regards,
Guillaume

On 04/02/2011 22:46, Gustavo F. Padovan wrote:

DUN server is probed when modem state changes to online. It registers
DUN record to Bluetooth adapter and wait for incoming DUN connection.

Based on a patch from Zhenhua Zhangzhenhua.zh...@intel.com
---
   Makefile.am |3 +
   plugins/bluetooth.h |3 +
   plugins/dun_gw.c|  189 
+++
   3 files changed, 195 insertions(+), 0 deletions(-)
   create mode 100644 plugins/dun_gw.c

diff --git a/Makefile.am b/Makefile.am
index 047a85f..8a845fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,9 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
   builtin_modules += hfp
   builtin_sources += plugins/hfp.c plugins/bluetooth.h

+builtin_modules += dun_gw
+builtin_sources += plugins/dun_gw.c plugins/bluetooth.h
+
   builtin_sources += $(btio_sources)
   builtin_cflags += @BLUEZ_CFLAGS@
   builtin_libadd += @BLUEZ_LIBS@
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 505d908..79e1a4a 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -32,6 +32,9 @@
   /* Profiles bitfield */
   #define HFP_AG 0x01

+/* Server bitfield */
+#define DUN_GW 0x01
+
   struct bluetooth_profile {
const char *name;
int (*create)(const char *device, const char *dev_addr,
diff --git a/plugins/dun_gw.c b/plugins/dun_gw.c
new file mode 100644
index 000..32c199e
--- /dev/null
+++ b/plugins/dun_gw.c
@@ -0,0 +1,189 @@
+/*
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#includeconfig.h
+#endif
+#includestdio.h
+#includestring.h
+#includeerrno.h
+#includeglib.h
+#includeofono.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#includeofono/plugin.h
+#includeofono/log.h
+#includeofono/modem.h
+#includegdbus.h
+
+#include bluetooth.h
+
+#define DUN_GW_CHANNEL 1
+
+static struct server *server;
+static guint modemwatch_id;
+static guint channel_watch;
+
+static const gchar *dun_record = ?xml version=\1.0\ encoding=\UTF-8\ ?  
  \
+record   
  \
+attribute id=\0x0001\  
\
+sequence   \
+uuid value=\0x1103\/   \
+/sequence  \
+/attribute   
\
+   
\
+attribute id=\0x0004\  
\
+sequence   \
+sequence \
+uuid value=\0x0100\/ \
+/sequence\
+sequence \
+uuid value=\0x0003\/ \
+uint8 value=\1\ name=\channel\/   \
+/sequence\
+/sequence  \
+/attribute   
\
+   
\
+attribute id=\0x0009\  
\
+sequence   \
+sequence \
+uuid value=\0x1103\/ \
+uint16 value=\0x0100\ name=\version\/  \
+/sequence\
+/sequence  

RE: [PATCH v3 4/4] ifxmodem: move call creation to xcallstat_notify

2011-02-08 Thread Jeevaka.Badrappan
Hi Denis,

Denis Kenzior wrote:
 
 So if you really insist on creating the call with a
 particular id, you might as well make that a parameter of the
 create_call function. However, do note that you still have one
 potential problem. 
 If the ATD callback returns before the call is signaled, then
 oFono synthesizes an outgoing call and picks an ID for you
 (according to the rules I outlined).  If the ID that oFono
 picked doesn't match the ID you have, you're in trouble.  So
 I'm not sure if you still want to go through all this trouble or
 not... 

Yep, agreed. Atleast with ifx I can confirm that ATD callback returns
before the call is signalled. I still want to have the call creation
done inside the xcallstat_notify so that call creation remains in
one place and also done in a place which has call id information.

  /* Assume the CLIP always arrives, and we signal the call there
*/
 DBG(cring_notify); @@ -617,13 +636,16 @@ static void
  ccwa_notify(GAtResult *result, gpointer user_data)
GAtResultIter
  iter; const char *num; int num_type, validity, cls;
 +GSList *l;
  struct ofono_call *call;
 
 -/* Some modems resend CCWA, ignore it the second time around */
 -if (g_slist_find_custom(vd-calls,
 +l = g_slist_find_custom(vd-calls,
 
 Can CCWA repeat on IFX?

CCWA comes only one time in IFX.

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


[PATCH 0/3] gprs-provision: Add SPN to provision API

2011-02-08 Thread Jukka Saunamaki
Hello

This patchset adds Service Provider Name (SPN) into GPRS context provisioning 
API.
SPN is read (asynchronously) in the middle of gprs atom registration, if 
provisioning is needed.

--Jukka

Jukka Saunamaki (3):
  gprs-provision: add SPN to provisioning API header
  gprs,gprs-provision: add SPN to provisioning API
  gprs-provision: update example with SPN

 examples/provision.c |8 +++--
 include/gprs-provision.h |2 +-
 src/gprs-provision.c |4 +-
 src/gprs.c   |   87 ++---
 src/ofono.h  |2 +-
 5 files changed, 74 insertions(+), 29 deletions(-)


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


[PATCH 1/3] gprs-provision: add SPN to provisioning API header

2011-02-08 Thread Jukka Saunamaki
---
 include/gprs-provision.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/gprs-provision.h b/include/gprs-provision.h
index bc021a8..e9eec61 100644
--- a/include/gprs-provision.h
+++ b/include/gprs-provision.h
@@ -42,7 +42,7 @@ struct ofono_gprs_provision_data {
 struct ofono_gprs_provision_driver {
const char *name;
int priority;
-   int (*get_settings)(const char *mcc, const char *mnc,
+   int (*get_settings)(const char *mcc, const char *mnc, const char *spn,
struct ofono_gprs_provision_data **settings,
int *count);
 };
-- 
1.7.1

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


[PATCH 2/3] gprs,gprs-provision: add SPN to provisioning API

2011-02-08 Thread Jukka Saunamaki
---
 src/gprs-provision.c |4 +-
 src/gprs.c   |   87 +
 src/ofono.h  |2 +-
 3 files changed, 68 insertions(+), 25 deletions(-)

diff --git a/src/gprs-provision.c b/src/gprs-provision.c
index 3cd84e8..011d5a8 100644
--- a/src/gprs-provision.c
+++ b/src/gprs-provision.c
@@ -48,7 +48,7 @@ void  __ofono_gprs_provision_free_settings(
 }
 
 ofono_bool_t __ofono_gprs_provision_get_settings(const char *mcc,
-   const char *mnc,
+   const char *mnc, const char *spn,
struct ofono_gprs_provision_data **settings,
int *count)
 {
@@ -65,7 +65,7 @@ ofono_bool_t __ofono_gprs_provision_get_settings(const char 
*mcc,
 
DBG(Calling provisioning plugin '%s', driver-name);
 
-   if (driver-get_settings(mcc, mnc, settings, count)  0)
+   if (driver-get_settings(mcc, mnc, spn, settings, count)  0)
continue;
 
return TRUE;
diff --git a/src/gprs.c b/src/gprs.c
index 5ea864c..bb1b173 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -97,6 +97,7 @@ struct ofono_gprs {
const struct ofono_gprs_driver *driver;
void *driver_data;
struct ofono_atom *atom;
+   struct ofono_sim_context *sim_context;
 };
 
 struct ofono_gprs_context {
@@ -2291,6 +2292,9 @@ static void gprs_remove(struct ofono_atom *atom)
if (gprs-driver  gprs-driver-remove)
gprs-driver-remove(gprs);
 
+   if (gprs-sim_context)
+   ofono_sim_context_free(gprs-sim_context);
+
g_free(gprs);
 }
 
@@ -2627,14 +2631,14 @@ static void provision_context(const struct 
ofono_gprs_provision_data *ap,
gprs-contexts = g_slist_append(gprs-contexts, context);
 }
 
-static void provision_contexts(struct ofono_gprs *gprs, struct ofono_sim *sim)
+static void provision_contexts(struct ofono_gprs *gprs, const char *mcc,
+   const char *mnc, const char *spn)
 {
struct ofono_gprs_provision_data *settings;
int count;
int i;
 
-   if (__ofono_gprs_provision_get_settings(ofono_sim_get_mcc(sim),
-   ofono_sim_get_mnc(sim),
+   if (__ofono_gprs_provision_get_settings(mcc, mnc, spn,
settings, count) == FALSE) {
ofono_warn(Provisioning failed);
return;
@@ -2646,13 +2650,15 @@ static void provision_contexts(struct ofono_gprs *gprs, 
struct ofono_sim *sim)
__ofono_gprs_provision_free_settings(settings, count);
 }
 
-void ofono_gprs_register(struct ofono_gprs *gprs)
+static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
 {
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(gprs-atom);
const char *path = __ofono_atom_get_path(gprs-atom);
struct ofono_atom *netreg_atom;
-   struct ofono_atom *sim_atom;
+
+   if (gprs-contexts == NULL) /* Automatic provisioning failed */
+   add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
 
if (!g_dbus_register_interface(conn, path,
OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -2661,29 +2667,13 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
ofono_error(Could not create %s interface,
OFONO_CONNECTION_MANAGER_INTERFACE);
 
+   gprs_unregister(gprs-atom);
return;
}
 
ofono_modem_add_interface(modem,
OFONO_CONNECTION_MANAGER_INTERFACE);
 
-   sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
-
-   if (sim_atom) {
-   const char *imsi;
-   struct ofono_sim *sim = __ofono_atom_get_data(sim_atom);
-
-   imsi = ofono_sim_get_imsi(sim);
-   gprs_load_settings(gprs, imsi);
-
-   if (gprs-contexts == NULL)
-   provision_contexts(gprs, sim);
-
-   }
-
-   if (gprs-contexts == NULL)
-   add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET);
-
gprs-netreg_watch = __ofono_modem_add_atom_watch(modem,
OFONO_ATOM_TYPE_NETREG,
netreg_watch, gprs, NULL);
@@ -2697,6 +2687,59 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
__ofono_atom_register(gprs-atom, gprs_unregister);
 }
 
+static void sim_spn_read_cb(int ok, int length, int record,
+   const unsigned char *data,
+   int record_length, void *userdata)
+{
+   struct ofono_gprs *gprs = userdata;
+   char *spn = NULL;
+   struct ofono_atom *sim_atom;
+   struct ofono_sim *sim = NULL;
+
+   if (ok)
+   spn = 

[PATCH 3/3] gprs-provision: update example with SPN

2011-02-08 Thread Jukka Saunamaki
---
 examples/provision.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/provision.c b/examples/provision.c
index 356b0b3..546a161 100644
--- a/examples/provision.c
+++ b/examples/provision.c
@@ -37,6 +37,7 @@
 #include ofono/log.h
 
 static int example_provision_get_settings(const char *mcc, const char *mnc,
+   const char *spn,
struct ofono_gprs_provision_data **settings,
int *count)
 {
@@ -44,10 +45,11 @@ static int example_provision_get_settings(const char *mcc, 
const char *mnc,
*count = 0;
*settings = NULL;
 
-   ofono_debug(Finding settings for MCC %s, MNC %s,
-   mcc, mnc);
+   ofono_debug(Finding settings for MCC %s, MNC %s, SPN '%s',
+   mcc, mnc, spn);
 
-   if (strcmp(mcc, 246) != 0 || strcmp(mnc, 81) != 0)
+   if (strcmp(mcc, 246) != 0 || strcmp(mnc, 81) != 0 ||
+   strcmp(spn, oFono) != 0)
return -ENOENT;
 
ofono_debug(Creating example settings for phonesim);
-- 
1.7.1

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


[PATCH] atmodem: close the list in clvl_range_query

2011-02-08 Thread Jeevaka Badrappan
---
 drivers/atmodem/call-volume.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/call-volume.c b/drivers/atmodem/call-volume.c
index 6d87276..1e32a69 100644
--- a/drivers/atmodem/call-volume.c
+++ b/drivers/atmodem/call-volume.c
@@ -114,6 +114,7 @@ static void clvl_range_query(gboolean ok, GAtResult 
*result, gpointer user_data)
/* Try opening the list, but don't fail */
g_at_result_iter_open_list(iter);
g_at_result_iter_next_range(iter, cvd-clvl_min, cvd-clvl_max);
+   g_at_result_iter_close_list(iter);
 }
 
 static void cv_generic_set_cb(gboolean ok, GAtResult *result,
-- 
1.7.0.4

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


[PATCH 1/2] ste: Add support for multiple pdp contexts.

2011-02-08 Thread Marit Henriksen
From: Marit Henriksen marit.henrik...@stericsson.com

---
 plugins/ste.c |   17 -
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/plugins/ste.c b/plugins/ste.c
index cf8aed8..749c4f3 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -66,6 +66,7 @@
 #include drivers/stemodem/if_caif.h
 
 #define NUM_CHAT   1
+#define MAX_PDP_CONTEXTS   4
 
 static const char *cpin_prefix[] = { +CPIN:, NULL };
 
@@ -363,6 +364,7 @@ static void ste_post_online(struct ofono_modem *modem)
struct ofono_message_waiting *mw;
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+   int i;
 
DBG(%p, modem);
 
@@ -378,13 +380,18 @@ static void ste_post_online(struct ofono_modem *modem)
 
gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
atmodem, data-chat);
-   gc = ofono_gprs_context_create(modem, 0, stemodem, data-chat);
-
-   if (gprs  gc)
-   ofono_gprs_add_context(gprs, gc);
+   if (gprs) {
+   for (i = 0; i  MAX_PDP_CONTEXTS; i++) {
+   gc = ofono_gprs_context_create(
+   modem, 0, stemodem, data-chat);
+   if (gc == NULL)
+   break;
+
+   ofono_gprs_add_context(gprs, gc);
+   }
+   }
 
mw = ofono_message_waiting_create(modem);
-
if (mw)
ofono_message_waiting_register(mw);
 }
-- 
1.7.1

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


[PATCH 2/2] stemodem: Add support for multiple pdp contexts.

2011-02-08 Thread Marit Henriksen
From: Marit Henriksen marit.henrik...@stericsson.com

Redesigned, there will be only one contexts for each instance of
the driver and only one CAIF interface, no longer need the list
of caif devices.
---
 drivers/stemodem/gprs-context.c |  273 ---
 1 files changed, 57 insertions(+), 216 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index e247f35..c0496f7 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -50,29 +50,17 @@
 #include caif_rtnl.h
 #include common.h
 
-#define MAX_CAIF_DEVICES 4
 #define MAX_DNS 2
 #define IP_ADDR_LEN 20
 
 #define AUTH_BUF_LENGTH (OFONO_GPRS_MAX_USERNAME_LENGTH + \
OFONO_GPRS_MAX_PASSWORD_LENGTH + 128)
 
-static const char *cgact_prefix[] = { +CGACT:, NULL };
 static const char *none_prefix[] = { NULL };
 
-static GSList *g_caif_devices;
-
 struct gprs_context_data {
GAtChat *chat;
unsigned int active_context;
-};
-
-struct conn_info {
-   /*
-* cid is allocated in oFono Core and is identifying
-* the Account. cid = 0 indicates that it is currently unused.
-*/
-   unsigned int cid;
/* Id used by CAIF and EPPSD to identify the CAIF channel*/
unsigned int channel_id;
/* Linux Interface Id */
@@ -150,62 +138,19 @@ static GMarkupParser parser = {
error_handler
 };
 
-static gint conn_compare_by_cid(gconstpointer a, gconstpointer b)
-{
-   const struct conn_info *conn = a;
-   unsigned int used = GPOINTER_TO_UINT(b);
-
-   if (used != conn-cid)
-   return 1;
-
-   return 0;
-}
-
-static struct conn_info *conn_info_create(unsigned int channel_id)
-{
-   struct conn_info *connection = g_try_new0(struct conn_info, 1);
-
-   if (connection == NULL)
-   return NULL;
-
-   connection-cid = 0;
-   connection-channel_id = channel_id;
-
-   return connection;
-}
-
 static void rtnl_callback(int ifindex, const char *ifname, void *user_data)
 {
-   struct conn_info *conn = user_data;
+   struct gprs_context_data *gcd = user_data;
 
if (ifindex  0) {
-   conn-created = FALSE;
-   ofono_error(Failed to create caif interface %s,
-   conn-interface);
+   gcd-created = FALSE;
+   ofono_error(Failed to create caif interface);
return;
}
 
-   strncpy(conn-interface, ifname, sizeof(conn-interface));
-   conn-ifindex = ifindex;
-   conn-created = TRUE;
-}
-
-/*
- * Removes IP interface for CAIF.
- */
-static void caif_if_remove(struct conn_info *conn)
-{
-   if (!conn-created)
-   return;
-
-   if (caif_rtnl_delete_interface(conn-ifindex)  0) {
-   ofono_error(Failed to delete caif interface %s,
-   conn-interface);
-   return;
-   }
-
-   DBG(removed CAIF interface ch:%d ifname:%s ifindex:%d\n,
-   conn-channel_id, conn-interface, conn-ifindex);
+   strncpy(gcd-interface, ifname, sizeof(gcd-interface));
+   gcd-ifindex = ifindex;
+   gcd-created = TRUE;
 }
 
 static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
@@ -215,8 +160,6 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult 
*result,
ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-   struct conn_info *conn;
-   GSList *l;
 
if (!ok) {
struct ofono_error error;
@@ -226,20 +169,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult 
*result,
return;
}
 
-   l = g_slist_find_custom(g_caif_devices,
-   GUINT_TO_POINTER(gcd-active_context),
-   conn_compare_by_cid);
-
-   if (l == NULL) {
-   DBG(Did not find data (used caif device) for
-   connection with cid; %d,
-   gcd-active_context);
-   CALLBACK_WITH_FAILURE(cb, cbd-data);
-   return;
-   }
-
-   conn = l-data;
-   conn-cid = 0;
+   gcd-active_context = 0;
CALLBACK_WITH_SUCCESS(cb, cbd-data);
 }
 
@@ -249,9 +179,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
ofono_gprs_context_up_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-   struct conn_info *conn;
GAtResultIter iter;
-   GSList *l;
int i;
gsize length;
const char *res_string;
@@ -259,21 +187,9 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
struct eppsd_response rsp;
GMarkupParseContext *context;
 
-   l = 

[RFC 0/1] use fsync in storage

2011-02-08 Thread Kai Vehmanen
Hi,

this is potentially a bit controversial, so sending as RFC.

Storage write_file() is used for SMS spooling (both in core for fragments and
in e.g. Marcel's history plugin patches). As we want to be sure we don't ack
SMS'es to network until we have succesfully stored them on device, I think we
need to use fsync() when storing the data. I know this is strictly not needed in
all systems (e.g. with ext3), and can be expensive on some systems (again
ext3), but I still think this is the right thing to do (especially with btrfs,
ext4, xfs, et al now commonly used).

I know there's been a lot of discussion around fsync() usage (especially
related to pre-2.6.30 ext4), but I think this specific case of SMS 
delivery is one where fsync definitely makes sense (similar to MTA usage).
I'm also aware this is not bullet proof (e.g. there are still hardware
caches not covered by fsync at all), but this is just one easy step
to increase system reliability and predictability.

A few questions:

1) Do we agree that fsync should be used?

2) Should storage provide also the old variant of write_file (e.g.
   transactionally safe, but not syncing). I see at least simfs
   is using write_file a lot as well. With this patch I just modified 
   write_file semantics for simplicity, but I could add a variant
   as well.

3) Is it ok, build-wise, for ofono to require availability fdatasync()
   (which I think would be sufficient in this case and slightly 
   less expensive).

Kai Vehmanen (1):
  storage: make write_file synchronous with fsync

 src/storage.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

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


[RFC 1/1] storage: make write_file synchronous with fsync

2011-02-08 Thread Kai Vehmanen
From: Kai Vehmanen kai.vehma...@nokia.com

Extend the implementation to perform data flushing in addition
to being transactionally safe.

An explicit fsync() is needed as neither close() nor rename()
guarantee the file data is flushed from kernel buffers.
---
 src/storage.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/storage.c b/src/storage.c
index 530439d..0b84f69 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -106,7 +106,9 @@ ssize_t read_file(unsigned char *buffer, size_t len,
  * consistent (ie: a crash right after opening or during write()
  * doesn't leave a file half baked), the contents are written to a
  * file with a temporary name and when closed, it is renamed to the
- * specified name (@path_fmt+args).
+ * specified name (@path_fmt+args). Operation is also synchronous,
+ * guaranteeing data is flushed from kernel buffers (e.g. with
+ * fsync()) before returning.
  */
 ssize_t write_file(const unsigned char *buffer, size_t len, mode_t mode,
const char *path_fmt, ...)
@@ -132,6 +134,13 @@ ssize_t write_file(const unsigned char *buffer, size_t 
len, mode_t mode,
 
r = TFR(write(fd, buffer, len));
 
+   /**
+* Make sure file contents are flushed from kernel buffers
+* before renaming. fsyncdata() would be sufficient, but let's
+* be more portable and just use fsync().
+*/
+   TFR(fsync(fd));
+
TFR(close(fd));
 
if (r != (ssize_t) len) {
-- 
1.7.0.4

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


Re: [PATCH 1/4] nettime: Network time plugin implementation

2011-02-08 Thread Antti Paila
Hi Marcel,

On Mon, 2011-02-07 at 10:58 -0800, ext Marcel Holtmann wrote:
 Hi Antti,
 
   plugins/nettime.c |  326 
  +
   1 files changed, 326 insertions(+), 0 deletions(-)
   create mode 100644 plugins/nettime.c
 
 I would prefer if we call this nokia-timed.c or in case this actually
 becomes default part of MeeGo, them maybe meego-timed.c. I would be also
 fine with {nokia,meego}-nettime.c.
 
 Just calling it nettime.c is too generic. It needs to be clear what this
 is for.
 
  +#define TIMED_PATH /com/meego/time
  +#define TIMED_SERVICE com.meego.time
 
 So the intention is to convert the Nokia timed into a MeeGo specific
 daemon? I would have expected to see com.nokia.timed here.

My understanding is that this will be Meego specific plugin since timed
is part of Meego. Hence, the service 'com.meego.timed'.  

  +struct nt_data {
  +   gboolean time_available;
  +   gboolean time_pending;
  +   time_t nw_time_utc;
  +   time_t received;
  +   int dst;
  +   int time_zone;
  +   const char *mcc;
  +   const char *mnc;
 
 Why do you bother with these here. You might better just reference the
 netreg atom. The memory is only valid if netreg atom is present.

Timed expects to receive the mcc and mnc in the time notification.
However, if the mcc and mnc don't change we don't resend the
information. These fields contain the mnc and mcc that oFono sent
in the previous time notification.

Best Regards,
  Antti

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


[sim-ready-nofify-v5 PATCH 3/3] isimodem/sim: added PIN and SIM state handling

2011-02-08 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

Using PN_SECURITY resource to obtain PIN statuses.

Using ofono_sim_ready_notify() to report the ready state.
---
 drivers/isimodem/debug.c |   59 +
 drivers/isimodem/debug.h |6 +
 drivers/isimodem/sim.c   |  574 -
 drivers/isimodem/sim.h   |   50 -
 4 files changed, 624 insertions(+), 65 deletions(-)

diff --git a/drivers/isimodem/debug.c b/drivers/isimodem/debug.c
index 3d667b4..e641ba4 100644
--- a/drivers/isimodem/debug.c
+++ b/drivers/isimodem/debug.c
@@ -34,6 +34,8 @@
 
 #define OFONO_API_SUBJECT_TO_CHANGE
 #include ofono/log.h
+#include ofono/modem.h
+#include ofono/sim.h
 
 #include debug.h
 
@@ -48,6 +50,7 @@ const char *pn_resource_name(int value)
_(PN_CALL);
_(PN_SMS);
_(PN_SIM);
+   _(PN_SECURITY);
_(PN_MTC);
_(PN_GSS);
_(PN_GPDS);
@@ -379,18 +382,72 @@ const char *sim_message_id_name(enum sim_message_id value)
_(SIM_IMSI_RESP_READ_IMSI);
_(SIM_SERV_PROV_NAME_REQ);
_(SIM_SERV_PROV_NAME_RESP);
+   _(SIM_DYNAMIC_FLAGS_REQ);
+   _(SIM_DYNAMIC_FLAGS_RESP);
_(SIM_READ_FIELD_REQ);
_(SIM_READ_FIELD_RESP);
_(SIM_SMS_REQ);
_(SIM_SMS_RESP);
+   _(SIM_STATUS_REQ);
+   _(SIM_STATUS_RESP);
_(SIM_PB_REQ_SIM_PB_READ);
_(SIM_PB_RESP_SIM_PB_READ);
+   _(SIM_SERVER_READY_IND);
_(SIM_IND);
_(SIM_COMMON_MESSAGE);
}
+
return SIM_UNKNOWN;
 }
 
+const char *sim_password_name(enum ofono_sim_password_type type)
+{
+   static const char *const passwd_name[] = {
+   [OFONO_SIM_PASSWORD_NONE] = none,
+   [OFONO_SIM_PASSWORD_SIM_PIN] = pin,
+   [OFONO_SIM_PASSWORD_SIM_PUK] = puk,
+   [OFONO_SIM_PASSWORD_PHSIM_PIN] = phone,
+   [OFONO_SIM_PASSWORD_PHFSIM_PIN] = firstphone,
+   [OFONO_SIM_PASSWORD_PHFSIM_PUK] = firstphonepuk,
+   [OFONO_SIM_PASSWORD_SIM_PIN2] = pin2,
+   [OFONO_SIM_PASSWORD_SIM_PUK2] = puk2,
+   [OFONO_SIM_PASSWORD_PHNET_PIN] = network,
+   [OFONO_SIM_PASSWORD_PHNET_PUK] = networkpuk,
+   [OFONO_SIM_PASSWORD_PHNETSUB_PIN] = netsub,
+   [OFONO_SIM_PASSWORD_PHNETSUB_PUK] = netsubpuk,
+   [OFONO_SIM_PASSWORD_PHSP_PIN] = service,
+   [OFONO_SIM_PASSWORD_PHSP_PUK] = servicepuk,
+   [OFONO_SIM_PASSWORD_PHCORP_PIN] = corp,
+   [OFONO_SIM_PASSWORD_PHCORP_PUK] = corppuk,
+   [OFONO_SIM_PASSWORD_INVALID] = invalid,
+   };
+
+   if (OFONO_SIM_PASSWORD_NONE = (int)type 
+   type = OFONO_SIM_PASSWORD_PHCORP_PUK)
+   return passwd_name[type];
+   else
+   return UNKNOWN;
+}
+
+const char *sec_message_id_name(enum sec_message_id value)
+{
+   switch (value) {
+   _(SEC_CODE_STATE_REQ);
+   _(SEC_CODE_STATE_OK_RESP);
+   _(SEC_CODE_STATE_FAIL_RESP);
+   _(SEC_CODE_CHANGE_REQ);
+   _(SEC_CODE_CHANGE_OK_RESP);
+   _(SEC_CODE_CHANGE_FAIL_RESP);
+   _(SEC_CODE_VERIFY_REQ);
+   _(SEC_CODE_VERIFY_OK_RESP);
+   _(SEC_CODE_VERIFY_FAIL_RESP);
+   _(SEC_STATE_REQ);
+   _(SEC_STATE_RESP);
+   }
+
+   return SEC_UNKNOWN;
+}
+
 const char *sim_subblock_name(enum sim_subblock value)
 {
switch (value) {
@@ -1062,6 +1119,8 @@ static const char *res_to_name(uint8_t res, uint8_t id)
return ss_message_id_name(id);
case PN_CALL:
return call_message_id_name(id);
+   case PN_SECURITY:
+   return sec_message_id_name(id);
case PN_SMS:
return sms_message_id_name(id);
case PN_SIM:
diff --git a/drivers/isimodem/debug.h b/drivers/isimodem/debug.h
index e149c2c..08a5ab6 100644
--- a/drivers/isimodem/debug.h
+++ b/drivers/isimodem/debug.h
@@ -51,6 +51,12 @@ const char *sim_isi_cause_name(enum sim_isi_cause value);
 const char *sim_message_id_name(enum sim_message_id value);
 const char *sim_subblock_name(enum sim_subblock value);
 
+enum ofono_sim_password_type;
+
+const char *sim_password_name(enum ofono_sim_password_type value);
+
+const char *sec_message_id_name(enum sec_message_id value);
+
 const char *info_isi_cause_name(enum info_isi_cause value);
 const char *info_message_id_name(enum info_message_id value);
 const char *info_subblock_name(enum info_subblock value);
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
index bfecbc9..8c83642 100644
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -48,7 +48,10 @@
 
 struct sim_data {
GIsiClient *client;
-   gboolean 

[sim-ready-nofify-v5 PATCH 1/3] sim: add ofono_sim_ready_notify

2011-02-08 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

The sim atom waits for ofono_sim_ready_notify() after the callback
to query_passwd_state.

Upon call to ofono_sim_ready_notify(), SIM atom either continues
initialization or rechecks if the SIM still requires a pin code.

Based on patches by Kristen Accardi and Denis Kenzior.
---
 include/sim.h |1 +
 src/sim.c |   35 +--
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 412ae44..b33cf8c 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -196,6 +196,7 @@ void ofono_sim_remove_state_watch(struct ofono_sim *sim, 
unsigned int id);
 enum ofono_sim_state ofono_sim_get_state(struct ofono_sim *sim);
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
+void ofono_sim_ready_notify(struct ofono_sim *sim);
 
 struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim);
 void ofono_sim_context_free(struct ofono_sim_context *context);
diff --git a/src/sim.c b/src/sim.c
index 3350166..818d813 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -45,6 +45,8 @@
 #include simfs.h
 #include stkutil.h
 
+#define SIM_FLAG_WAIT_FOR_READY (1  0)
+
 static GSList *g_drivers = NULL;
 
 static void sim_own_numbers_update(struct ofono_sim *sim);
@@ -76,6 +78,7 @@ struct ofono_sim {
unsigned char efsst_length;
gboolean fixed_dialing;
gboolean barred_dialing;
+   guint flags;
 
char *imsi;
char mcc[OFONO_MAX_MCC_LENGTH + 1];
@@ -1621,6 +1624,8 @@ static void sim_efphase_read_cb(int ok, int length, int 
record,
 
 static void sim_initialize_after_pin(struct ofono_sim *sim)
 {
+   sim-flags = ~SIM_FLAG_WAIT_FOR_READY;
+
ofono_sim_read(sim-context, SIM_EFPHASE_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efphase_read_cb, sim);
@@ -1647,10 +1652,11 @@ static void sim_pin_query_cb(const struct ofono_error 
*error,
const char *path = __ofono_atom_get_path(sim-atom);
const char *pin_name;
 
+   sim-flags |= SIM_FLAG_WAIT_FOR_READY;
+
if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error(Querying PIN authentication state failed);
-
-   goto checkdone;
+   return;
}
 
if (sim-pin_type != pin_type) {
@@ -1671,10 +1677,6 @@ static void sim_pin_query_cb(const struct ofono_error 
*error,
}
 
sim_pin_retries_check(sim);
-
-checkdone:
-   if (pin_type == OFONO_SIM_PASSWORD_NONE)
-   sim_initialize_after_pin(sim);
 }
 
 static void sim_pin_check(struct ofono_sim *sim)
@@ -1687,6 +1689,25 @@ static void sim_pin_check(struct ofono_sim *sim)
sim-driver-query_passwd_state(sim, sim_pin_query_cb, sim);
 }
 
+void ofono_sim_ready_notify(struct ofono_sim *sim)
+{
+   DBG();
+
+   if (sim == NULL)
+   return;
+
+   if (sim-state != OFONO_SIM_STATE_INSERTED)
+   return;
+
+   if (!(sim-flags  SIM_FLAG_WAIT_FOR_READY))
+   return;
+
+   if (sim-pin_type == OFONO_SIM_PASSWORD_NONE)
+   sim_initialize_after_pin(sim);
+   else
+   sim_pin_check(sim);
+}
+
 static void sim_efli_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -2146,6 +2167,8 @@ static void sim_free_state(struct ofono_sim *sim)
 
sim-fixed_dialing = FALSE;
sim-barred_dialing = FALSE;
+
+   sim-flags = 0;
 }
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
-- 
1.7.1

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


[sim-ready-nofify-v5 PATCH 2/3] atmodem/sim: use ofono_sim_ready_notify

2011-02-08 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

Schedule a call to ofono_sim_ready_notify after pin code query returns
SIM READY.

Vendor quirks:
- IFX: register unsolicated +XSIM result code
- MBM: register unsolicated *EPEV result code
---
 drivers/atmodem/sim.c |  166 ++--
 1 files changed, 117 insertions(+), 49 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d9c0d8d..666edbe 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -46,10 +46,14 @@
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
+#define READY_TIMEOUT  5000
+
 struct sim_data {
GAtChat *chat;
unsigned int vendor;
guint ready_id;
+   guint ready_source;
+   ofono_bool_t ready;
 };
 
 static const char *crsm_prefix[] = { +CRSM:, NULL };
@@ -679,10 +683,55 @@ static void at_pin_retries_query(struct ofono_sim *sim,
CALLBACK_WITH_FAILURE(cb, NULL, data);
 }
 
+static void ready_unregister_and_notify(struct ofono_sim *sim)
+{
+   struct sim_data *sd = ofono_sim_get_data(sim);
+
+   DBG();
+
+   if (sd-ready_source  0) {
+   g_source_remove(sd-ready_source);
+   sd-ready_source = 0;
+   }
+
+   ofono_sim_ready_notify(sim);
+}
+
+static gboolean ready_timeout(gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
+
+   DBG();
+
+   sd-ready_source = 0;
+
+   ofono_sim_ready_notify(sim);
+
+   return FALSE;
+}
+
+static void at_wait_for_ready(struct ofono_sim *sim)
+{
+   struct sim_data *sd = ofono_sim_get_data(sim);
+   guint timeout;
+
+   if (sd-ready_source  0)
+   return;
+
+   if (!sd-ready  sd-ready_id  0)
+   timeout = READY_TIMEOUT;
+   else
+   timeout = 0;
+
+   sd-ready_source = g_timeout_add(timeout, ready_timeout, sim);
+}
+
 static void at_cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   struct sim_data *sd = ofono_sim_get_data(cbd-user);
+   struct ofono_sim *sim = cbd-user;
+   struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
ofono_sim_passwd_cb_t cb = cbd-cb;
struct ofono_error error;
@@ -729,6 +778,11 @@ static void at_cpin_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
return;
}
 
+   if (pin_type == OFONO_SIM_PASSWORD_NONE)
+   at_wait_for_ready(sim);
+   else
+   sd-ready = FALSE;
+
DBG(crsm_pin_cb: %s, pin_required);
 
cb(error, pin_type, cbd-data);
@@ -753,13 +807,13 @@ static void at_pin_query(struct ofono_sim *sim, 
ofono_sim_passwd_cb_t cb,
 
 static void at_xsim_notify(GAtResult *result, gpointer user_data)
 {
-   struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
-   ofono_sim_lock_unlock_cb_t cb = cbd-cb;
-   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
int state;
 
+   DBG();
+
g_at_result_iter_init(iter, result);
 
if (!g_at_result_iter_next(iter, +XSIM:))
@@ -776,65 +830,40 @@ static void at_xsim_notify(GAtResult *result, gpointer 
user_data)
return;
}
 
-   cb(error, cbd-data);
+   sd-ready = TRUE;
 
-   g_at_chat_unregister(sd-chat, sd-ready_id);
-   sd-ready_id = 0;
+   if (sd-ready_source  0)
+   ready_unregister_and_notify(sim);
 }
 
 static void at_epev_notify(GAtResult *result, gpointer user_data)
 {
-   struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
-   ofono_sim_lock_unlock_cb_t cb = cbd-cb;
-   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
 
-   cb(error, cbd-data);
+   DBG();
 
-   g_at_chat_unregister(sd-chat, sd-ready_id);
-   sd-ready_id = 0;
+   sd-ready = TRUE;
+
+   if (sd-ready_source  0)
+   ready_unregister_and_notify(sim);
 }
 
 static void at_pin_send_cb(gboolean ok, GAtResult *result,
gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
+   struct ofono_sim *sim = cbd-user;
+   struct sim_data *sd = ofono_sim_get_data(sim);
ofono_sim_lock_unlock_cb_t cb = cbd-cb;
struct ofono_error error;
 
-   decode_at_error(error, g_at_result_final_response(result));
+   if (ok  sd-ready_id)
+   at_wait_for_ready(sim);
 
-   if (!ok)
-   goto done;
-
-   switch (sd-vendor) {
-   case OFONO_VENDOR_IFX:
-   /*
-* On the IFX modem, AT+CPIN? can return READY too
-

[sim-ready-nofify-v5 PATCH 0/3] ofono_sim_ready_notify

2011-02-08 Thread Pekka . Pessi
Hi all,

The missing bitwise-not has been added to the sim, and the patches has
been rebased to current master.

A call to ofono_sim_ready_notify() is now always expected after call to
query_passwd_state.

When ofono_sim_ready_notify() is invoked, it checks that the call is
expected and if needed, retries the query_passwd_state.  Otherwise it
proceeds with sim initialization.

--Pekka

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


[PATCH] sim: enable usage of SIM pass codes longer than 8 digits

2011-02-08 Thread Jussi Kangas
---


Hi,

On Tue, 2011-02-08 at 06:17 +0200, Denis Kenzior wrote:

Why don't we keep things simple.  Modify is_valid_pin to take a pin and
 a min and max number of digits.
 
 gboolean is_valid_pin_with_limits(const char *pin, int min, int max)
 (feel free to pick some better name)
 
 Then just add two functions:
 
 __ofono_valid_net_pin(const char *pin)
 __ofono_valid_sim_pin(const char *pin, enum ofono_sim_password_type type)
 
 Stick both in ofono.h / sim.c somewhere
 

Right. Here it is. 

Br,
Jussi

 src/call-barring.c |   12 
 src/call-meter.c   |4 +-
 src/common.c   |   37 -
 src/common.h   |9 --
 src/ofono.h|5 +++
 src/sim.c  |   76 +++
 6 files changed, 83 insertions(+), 60 deletions(-)

diff --git a/src/call-barring.c b/src/call-barring.c
index 649826e..384eb43 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -402,7 +402,7 @@ static gboolean cb_ss_control(int type, const char *sc,
if (strlen(dn)  0)
goto bad_format;
 
-   if (type != SS_CONTROL_TYPE_QUERY  !is_valid_pin(sia, PIN_TYPE_NET))
+   if (type != SS_CONTROL_TYPE_QUERY  !__ofono_is_valid_net_pin(sia))
goto bad_format;
 
switch (type) {
@@ -524,7 +524,7 @@ static gboolean cb_ss_passwd(const char *sc,
if (fac == NULL)
return FALSE;
 
-   if (!is_valid_pin(old, PIN_TYPE_NET) || !is_valid_pin(new, 
PIN_TYPE_NET))
+   if (!__ofono_is_valid_net_pin(old) || !__ofono_is_valid_net_pin(new))
goto bad_format;
 
cb-pending = dbus_message_ref(msg);
@@ -862,7 +862,7 @@ static DBusMessage *cb_set_property(DBusConnection *conn, 
DBusMessage *msg,
return __ofono_error_invalid_args(msg);
 
dbus_message_iter_get_basic(iter, passwd);
-   if (!is_valid_pin(passwd, PIN_TYPE_NET))
+   if (!__ofono_is_valid_net_pin(passwd))
return __ofono_error_invalid_format(msg);
}
 
@@ -909,7 +909,7 @@ static DBusMessage *cb_disable_all(DBusConnection *conn, 
DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
 
-   if (!is_valid_pin(passwd, PIN_TYPE_NET))
+   if (!__ofono_is_valid_net_pin(passwd))
return __ofono_error_invalid_format(msg);
 
cb_set_query_bounds(cb, fac, FALSE);
@@ -957,10 +957,10 @@ static DBusMessage *cb_set_passwd(DBusConnection *conn, 
DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
 
-   if (!is_valid_pin(old_passwd, PIN_TYPE_NET))
+   if (!__ofono_is_valid_net_pin(old_passwd))
return __ofono_error_invalid_format(msg);
 
-   if (!is_valid_pin(new_passwd, PIN_TYPE_NET))
+   if (!__ofono_is_valid_net_pin(new_passwd))
return __ofono_error_invalid_format(msg);
 
cb-pending = dbus_message_ref(msg);
diff --git a/src/call-meter.c b/src/call-meter.c
index d483e2e..0789935 100644
--- a/src/call-meter.c
+++ b/src/call-meter.c
@@ -549,7 +549,7 @@ static DBusMessage *cm_set_property(DBusConnection *conn, 
DBusMessage *msg,
 
dbus_message_iter_get_basic(iter, passwd);
 
-   if (!is_valid_pin(passwd, PIN_TYPE_PIN))
+   if (!__ofono_is_valid_sim_pin(passwd, OFONO_SIM_PASSWORD_SIM_PIN2))
return __ofono_error_invalid_format(msg);
 
for (property = cm_properties; property-name; property++) {
@@ -621,7 +621,7 @@ static DBusMessage *cm_acm_reset(DBusConnection *conn, 
DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
 
-   if (!is_valid_pin(pin2, PIN_TYPE_PIN))
+   if (!__ofono_is_valid_sim_pin(pin2, OFONO_SIM_PASSWORD_SIM_PIN2))
return __ofono_error_invalid_format(msg);
 
cm-pending = dbus_message_ref(msg);
diff --git a/src/common.c b/src/common.c
index f25f105..247fff0 100644
--- a/src/common.c
+++ b/src/common.c
@@ -649,43 +649,6 @@ const char *bearer_class_to_string(enum bearer_class cls)
return NULL;
 }
 
-gboolean is_valid_pin(const char *pin, enum pin_type type)
-{
-   unsigned int i;
-
-   /* Pin must not be empty */
-   if (pin == NULL || pin[0] == '\0')
-   return FALSE;
-
-   i = strlen(pin);
-   if (i != strspn(pin, 0123456789))
-   return FALSE;
-
-   switch (type) {
-   case PIN_TYPE_PIN:
-   /* 11.11 Section 9.3 (CHV): 4..8 IA-5 digits */
-   if (4 = i  i = 8)
-   return TRUE;
-   break;
-   case PIN_TYPE_PUK:
-   /* 11.11 Section 9.3 (UNBLOCK CHV), 8 IA-5 digits */
-   if (i == 8)
-   return TRUE;
-   break;
-   case 

Re: [PATCH -v2 6/7] emulator: Implement dialing up for DUN

2011-02-08 Thread Guillaume Zajac

Hi Gustavo,

On 04/02/2011 22:46, Gustavo F. Padovan wrote:

It handles client ATD*99# request and then initiate the PPP negotiation.
IP forward through the new ppp interface is not done yet.

Initially based on patches from Zhenhua Zhangzhenhua.zh...@intel.com
---
  src/emulator.c |  123 
  1 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 49b129b..f1a079d 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -32,11 +32,18 @@
  #include ofono.h
  #include common.h
  #include gatserver.h
+#include gatppp.h
+
+#define DUN_SERVER_ADDRESS 192.168.1.1
+#define DUN_PEER_ADDRESS   192.168.1.2
+#define DUN_DNS_SERVER_1   10.10.10.10
+#define DUN_DNS_SERVER_2   10.10.10.11

  struct ofono_emulator {
struct ofono_modem *modem;
struct ofono_atom *atom;
GAtServer *server;
+   GAtPPP *ppp;
struct ofono_emulator_driver *driver;
  };

@@ -55,10 +62,124 @@ void ofono_emulator_remove(struct ofono_emulator *emulator)
__ofono_atom_free(emulator-atom);
  }

+static void ppp_connect(const char *iface, const char *local,
+   const char *remote,
+   const char *dns1, const char *dns2,
+   gpointer user_data)
+{
+   DBG(Network Device: %s\n, iface);
+   DBG(IP Address: %s\n, local);
+   DBG(Remote IP Address: %s\n, remote);
+   DBG(Primary DNS Server: %s\n, dns1);
+   DBG(Secondary DNS Server: %s\n, dns2);
+}
+
+static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   DBG();
+
+   g_at_ppp_unref(e-ppp);
+   e-ppp = NULL;
+
+   if (e-server == NULL)
+   return;
+
+   g_at_server_resume(e-server);
+
+   g_at_server_send_final(e-server, G_AT_SERVER_RESULT_NO_CARRIER);
+}
+
+static gboolean setup_ppp(gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = e-server;
+   GAtIO *io;
+
+   DBG();
+
+   io = g_at_server_get_io(server);
+
+   g_at_server_suspend(server);
+
+   e-ppp = g_at_ppp_server_new_from_io(io, DUN_SERVER_ADDRESS);
+   if (e-ppp == NULL) {
+   g_at_server_resume(server);
+   return FALSE;
+   }
+
+   g_at_ppp_set_server_info(e-ppp, DUN_PEER_ADDRESS,
+   DUN_DNS_SERVER_1, DUN_DNS_SERVER_2);
+
+   g_at_ppp_set_credentials(e-ppp, , );
+   g_at_ppp_set_debug(e-ppp, ofono_emulator_debug, PPP);
+
+   g_at_ppp_set_connect_function(e-ppp, ppp_connect, e);
+   g_at_ppp_set_disconnect_function(e-ppp, ppp_disconnect, e);
+
+   return FALSE;
+}
+
+static gboolean dial_call(struct ofono_emulator *e, const char *dial_str)
+{
+   char c = *dial_str;
+
+   DBG(dial call %s, dial_str);
+
+   if (c == '*' || c == '#' || c == 'T' || c == 't') {
+
+   g_at_server_send_intermediate(e-server, CONNECT);
+   g_idle_add(setup_ppp, e);
+   }
+
+   return TRUE;
+}
+
+static void dial_cb(GAtServerRequestType type, GAtResult *result,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = e-server;
+   GAtResultIter iter;
+   const char *dial_str;
+
+   DBG();
+
+   if (type != G_AT_SERVER_REQUEST_TYPE_SET)
+   goto error;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, D))
+   goto error;
+
+   dial_str = g_at_result_iter_raw_line(iter);
+   if (!dial_str)
+   goto error;
+
+   if (e-ppp)
+   goto error;
+
+   if (!dial_call(e, dial_str))
+   goto error;
+
+   return;
+
+error:
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+}
+


Shouldn't we register a generic dial_cb() and separate it in 2 cases:
OFONO_ATOM_TYPE_DUN_EMULATOR, we do a dun_dial() that would look 
like the dial_cb() you have implemented.
OFONO_ATOM_TYPE_HFP_AG, we do a hfp_dial() e.g. dial a number for a 
voice call.



  static void emulator_disable(struct ofono_emulator *e)
  {
DBG();

+   if (e-ppp) {
+   g_at_ppp_shutdown(e-ppp);
+   g_at_ppp_unref(e-ppp);
+   e-ppp = NULL;
+   }
+
g_at_server_shutdown(e-server);
g_at_server_unref(e-server);
e-server = NULL;
@@ -93,6 +214,8 @@ int ofono_emulator_enable(struct ofono_emulator *e, int fd)
g_at_server_set_disconnect_function(e-server,
emulator_disconnect_cb, e);

+   g_at_server_register(e-server, D, dial_cb, e, NULL);
+
return 0;
  }


Kind regards,
Guillaume
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [RFC 0/1] use fsync in storage

2011-02-08 Thread Kai.Vehmanen
Hi,

On 08 Feb 2011, Zabaluev Mikhail (Nokia-MS/Helsinki) wrote:
 I would use fdatasync().
 
 What about ensuring that file metadata are synced as well (e.g. the
 file itself cannot be lost on the filesystem)?

Rémi already responded about fdatasync semantics, but I do
wonder a bit about directory flushing (or lack of it).

Many filesystems implement special-casing for rename() which in 
practise solves the problem, but current ofono code does not 
actually call rename but instead 'link(tmp,real);unlink(tmp)'. This 
is ok for transaction safety, but possibly problematic for data safety.

So AFAIU, even if we flush tmp (with the patch I sent today), 
and hardlink, the directory inode might not be flushed for a long 
time.

And I just noticed that e.g. btrfs (which is the default in
e.g. MeeGo) does not special case rename() in case destination is 
not overwritten (but it does have a special case for the 
overwriting-rename case - https://btrfs.wiki.kernel.org/index.php/FAQ). 
So just using fdatasync+rename won't solve all cases either.

Hmm, so fdatasync on the file, rename and fsync on directory should 
be ok then.

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


[RFCv2] doc: Proposal for LTE/IMS API

2011-02-08 Thread Sjur Brændeland
From: Sjur Brændeland sjur.brandel...@stericsson.com

Thanks for lots of useful feedback from last RFC,
here is my next revision on the LTE/IMS API.
Comments are still very much welcome!

Changes from RFC-V1:
- Renamed IMS to IpMultimediaSubsystem (some places)
- Changed registration of IMS application.
- Moved IMS Identities to a separate interface
- Dropped the entire TFT/QoS info.
  Instead oFono checks the QoS SIP Preconditions.
  IMS application is notified about changes in QoS,
  and asks oFono if the QoS SIP preconditions are
  satisfied.
---
 doc/ims-api.txt |  162 +++
 1 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 doc/ims-api.txt

diff --git a/doc/ims-api.txt b/doc/ims-api.txt
new file mode 100644
index 000..5404e61
--- /dev/null
+++ b/doc/ims-api.txt
@@ -0,0 +1,162 @@
+Ip Multimedia Subsystem hierarchy [experimental]
+=
+
+Serviceorg.ofono
+Interface  org.ofono.IpMultimediaSubsystem
+Object path[variable prefix]
+
+Methodsdict GetProperties()
+
+   Returns all IMS properties. See the
+   properties section for available properties.
+
+   void Register(string type)
+
+   Register a IMS Application. It must register
+   with one of the types:
+   voice, messaging, voice_messaging.
+
+   This registration will inform modem's radio
+   stack that the IMS application has registered
+   for Voice and/or Messaging over IMS.
+   This registration may impact UE Mode of operation
+   and the ISR feature in the radio stack.
+
+   The registered application is tracked, if the
+   application exits the registration will be
+   automatically released.
+
+   Related AT command: AT+EISR.
+
+   Possible Errors: [service].Error.InvalidArguments
+
+   void UnRegister(object path)
+
+   Un-register a IpMultimediaSubsystemAgent.
+
+   Possible Errors: [service].Error.InvalidArguments
+
+   boolean PreConditionCheck(string Type, string PeerAddress,
+   uint16 PeerPort,  uint16 LocalPort)
+
+   This method is used by the IMS application to check
+   if the QoS SIP precondition is fulfilled.
+
+   The IMS application should call this method when
+   receiving a PreConditionChanged() signal.
+   The IMS Application is not allowed to start alerting
+   before it has confirmed that it has a voice-ready
+   Dedicated Bearer and QoS set up in the network.
+
+   The legal parameter for Type currently is currently
+   voice only. In future video (Conversational Video,
+   Live Streaming) will be added.
+
+   PeerAddress can be IPv4 or IPv6 address. PeerPort and
+   LocalPort is the RTP port used for the media stream.
+
+   This method returns true if the Traffic Flow Template
+   read from the modem matches the address information
+   provided, and the QCI and Bit Rates fulfills the
+   requirements for the specified type.
+
+   Related AT commands: AT+CGEQOSRDP, AT+CGTFTRDP
+
+   NOTE:   Should the Type parameter be removed?
+   Maybe IMS-video still is a bit futuristic.
+
+SignalsPropertyChanged(string property, variant value)
+
+   This signal indicates a changed value of the given
+   property.
+
+   void PreConditionChanged()
+
+   This signal is sent when the network has changed
+   the QoS or Packet Filters for a Bearer.
+   The IMS application can then check the QoS SIP
+   preconditions by calling PreConditionCheck().
+
+   Only QoS information relevant for IMS will be
+   signaled, i.e. QCI=1 for voice and QCI=2 for video.
+
+   Related AT commands: AT+CGEREP,
+   +CGEV: NW ACT, +CGEV: NW MODIFY
+
+Properties
+   array{object} Identities [readonly]
+
+   Array of IP Multimedia Identities objects and
+   properties.
+   NOTE:   It is assumed that Identities will not change.
+
+   boolean VoiceOverPs [readonly]
+
+ 

Re: [RFCv2] doc: Proposal for LTE/IMS API

2011-02-08 Thread Rémi Denis-Courmont
On Tuesday 08 February 2011 16:29:17 ext Sjur Brændeland, you wrote:
 From: Sjur Brændeland sjur.brandel...@stericsson.com
 
 Thanks for lots of useful feedback from last RFC,
 here is my next revision on the LTE/IMS API.
 Comments are still very much welcome!
 
 Changes from RFC-V1:
   - Renamed IMS to IpMultimediaSubsystem (some places)
   - Changed registration of IMS application.
   - Moved IMS Identities to a separate interface
   - Dropped the entire TFT/QoS info.
 Instead oFono checks the QoS SIP Preconditions.
 IMS application is notified about changes in QoS,
 and asks oFono if the QoS SIP preconditions are
 satisfied.
 ---
  doc/ims-api.txt |  162
 +++ 1 files changed,
 162 insertions(+), 0 deletions(-)
  create mode 100644 doc/ims-api.txt
 
 diff --git a/doc/ims-api.txt b/doc/ims-api.txt
 new file mode 100644
 index 000..5404e61
 --- /dev/null
 +++ b/doc/ims-api.txt
 @@ -0,0 +1,162 @@
 +Ip Multimedia Subsystem hierarchy [experimental]
 +=
 +
 +Service  org.ofono
 +Interfaceorg.ofono.IpMultimediaSubsystem
 +Object path  [variable prefix]

I guess this is meant to be a modem object path, but it seems the oFono 
documentation is already a bit sloppy on this point.

 +Methods  dict GetProperties()
 +
 + Returns all IMS properties. See the
 + properties section for available properties.
 +
 + void Register(string type)
 +
 + Register a IMS Application. It must register
 + with one of the types:
 + voice, messaging, voice_messaging.

I am not very familiar with the underlying protocol... If it really makes 
sense to register both services simultaneously, then I think we should have an 
array of strings. Or if there are no benefits, then why bother with 
'voice_messaging' anyway.

 + This registration will inform modem's radio
 + stack that the IMS application has registered
 + for Voice and/or Messaging over IMS.
 + This registration may impact UE Mode of operation
 + and the ISR feature in the radio stack.
 +
 + The registered application is tracked, if the
 + application exits the registration will be
 + automatically released.
 +
 + Related AT command: AT+EISR.

Is this a standard command? As it is not in the 3GPP namespace (AT+C...), it 
might be nice to provide a reference pointer.

 + Possible Errors: [service].Error.InvalidArguments
 +
 + void UnRegister(object path)
 +
 + Un-register a IpMultimediaSubsystemAgent.
 +
 + Possible Errors: [service].Error.InvalidArguments
 +
 + boolean PreConditionCheck(string Type, string PeerAddress,
 + uint16 PeerPort,  uint16 LocalPort)
 +
 + This method is used by the IMS application to check
 + if the QoS SIP precondition is fulfilled.
 +
 + The IMS application should call this method when
 + receiving a PreConditionChanged() signal.
 + The IMS Application is not allowed to start alerting
 + before it has confirmed that it has a voice-ready
 + Dedicated Bearer and QoS set up in the network.
 +
 + The legal parameter for Type currently is currently
 + voice only. In future video (Conversational Video,
 + Live Streaming) will be added.
 +
 + PeerAddress can be IPv4 or IPv6 address. PeerPort and
 + LocalPort is the RTP port used for the media stream.
 +
 + This method returns true if the Traffic Flow Template
 + read from the modem matches the address information
 + provided, and the QCI and Bit Rates fulfills the
 + requirements for the specified type.
 +
 + Related AT commands: AT+CGEQOSRDP, AT+CGTFTRDP
 +
 + NOTE:   Should the Type parameter be removed?
 + Maybe IMS-video still is a bit futuristic.

That stuff is per context. Should it not be in the context object rather than 
in the IMS manager?

 +
 +Signals  PropertyChanged(string property, variant value)
 +
 + This signal indicates a changed value of the given
 + property.
 +
 + void PreConditionChanged()
 +
 + This signal is sent when the network has changed
 + the QoS or Packet Filters for a Bearer.
 + The IMS application can then 

Re: [PATCH v2 3/3] isimodem: header updates for ISI2.5

2011-02-08 Thread Aki Niemi
Hi,

2011/2/1 Aki Niemi aki.ni...@nokia.com:
 I'm starting to think me just saying this out loud is not concrete
 enough, so I guess one way forward here could be for me to go ahead and
 adapt e.g. the netreg driver to work with N900 and later ISI modems. The
 netreg driver would make a good example, as it is one of those where the
 resource ID changes post N900, and the messages do vary based on it.

I went ahead and pushed some patches refactoring the isimodem netreg
driver to work with both the old modem API as well as the new wgmodem
2.5 version.

Please take a look if it works for you.

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


[PATCH 01/13] gprs: factor out common code

2011-02-08 Thread Mika Liljeberg
---
 src/gprs.c |  111 +++-
 1 files changed, 50 insertions(+), 61 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 7d36633..fa56f62 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -255,6 +255,49 @@ static void gprs_cid_release(struct ofono_gprs *gprs, 
unsigned int id)
idmap_put(gprs-cid_map, id);
 }
 
+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 release_context(struct pri_context *ctx)
+{
+   if (ctx == NULL || ctx-gprs == NULL || ctx-context_driver == NULL)
+   return;
+
+   gprs_cid_release(ctx-gprs, ctx-context.cid);
+   ctx-context.cid = 0;
+   ctx-context_driver-inuse = FALSE;
+   ctx-context_driver = NULL;
+}
+
 static struct pri_context *gprs_context_by_path(struct ofono_gprs *gprs,
const char *ctx_path)
 {
@@ -703,12 +746,7 @@ static void pri_activate_callback(const struct ofono_error 
*error,
telephony_error_to_str(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;
-
+   release_context(ctx);
return;
}
 
@@ -744,11 +782,8 @@ 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;
+   release_context(ctx);
ctx-active = FALSE;
-   ctx-context_driver-inuse = FALSE;
-   ctx-context_driver = NULL;
 
__ofono_dbus_pending_reply(ctx-pending,
dbus_message_new_method_return(ctx-pending));
@@ -995,38 +1030,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)
 {
@@ -1344,14 +1347,9 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
if (ctx-active == FALSE)
continue;
 
-   gprs_cid_release(gprs, ctx-context.cid);
-   ctx-context.cid = 0;
+   release_context(ctx);
ctx-active = FALSE;
-   ctx-context_driver-inuse = FALSE;
-   ctx-context_driver = NULL;
-
pri_reset_context_settings(ctx);
-
value = FALSE;
ofono_dbus_signal_property_changed(conn, ctx-path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
@@ -1736,10 +1734,7 @@ static void gprs_deactivate_for_remove(const struct 
ofono_error *error,
return;
}
 
-   gprs_cid_release(gprs, ctx-context.cid);
-   ctx-context.cid = 0;
-   ctx-context_driver-inuse = FALSE;
-   ctx-context_driver = NULL;
+   release_context(ctx);
 

[PATCH 0/13] IPv6 support (take 2)

2011-02-08 Thread Mika Liljeberg
Hi All,

Here's another go at IPv6 with latest comments hopefully
addressed.

Regards,

MikaL

[PATCH 01/13] gprs: factor out common code
[PATCH 02/13] gprs: Update documentation for IPv6
[PATCH 03/13] gprs: driver interface changes for IPv6
[PATCH 04/13] gprs: core support for IPv6
[PATCH 05/13] test: modify test scripts for IPv6
[PATCH 06/13] isimodem: IPv6 support
[PATCH 07/13] atmodem: update to new gprs context interface
[PATCH 08/13] huaweimodem: update to new gprs context interface
[PATCH 09/13] mbmmodem: update to new gprs context interface
[PATCH 10/13] hsomodem: update to new gprs context interface
[PATCH 11/13] ifxmodem: update to new gprs context interface
[PATCH 12/13] stemodem: update to new gprs context interface
[PATCH 13/13] phonesim: add IPv6 support

 Makefile.am|3 +-
 doc/connman-api.txt|9 +-
 drivers/atmodem/gprs-context.c |   41 ++--
 drivers/hsomodem/gprs-context.c|   48 +++--
 drivers/huaweimodem/gprs-context.c |   43 +++--
 drivers/ifxmodem/gprs-context.c|   36 ++--
 drivers/isimodem/gprs-context.c|  119 +++-
 drivers/mbmmodem/gprs-context.c|   65 ---
 drivers/stemodem/gprs-context.c|   31 ++-
 include/gprs-context.h |   27 ++-
 plugins/phonesim.c |   32 +++-
 src/gprs.c |  390 
 test/list-contexts |6 +-
 test/set-context-property  |   38 
 14 files changed, 583 insertions(+), 305 deletions(-)
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/13] gprs: Update documentation for IPv6

2011-02-08 Thread Mika Liljeberg
---
 doc/connman-api.txt |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/connman-api.txt b/doc/connman-api.txt
index 22c59dc..de1b938 100644
--- a/doc/connman-api.txt
+++ b/doc/connman-api.txt
@@ -182,7 +182,7 @@ Properties  boolean Active [readwrite]
string Protocol [readwrite]
 
Holds the protocol for this context.  Valid values
-   are: ip and ipv6.
+   are: ip, ipv6 and ipv4v6.
 
string Name [readwrite]
 
@@ -196,7 +196,7 @@ Properties  boolean Active [readwrite]
 
string Interface [readonly, optional]
 
-   Holds the interface of the network interface
+   Holds the name of the network interface
used by this context (e.g. ppp0 usb0)
 
string Method [readonly, optional]
@@ -242,6 +242,11 @@ Properties boolean Active [readwrite]
via this proxy.  All other values are left
out in this case.
 
+   string IPv6Address [readonly, optional]
+
+   Holds the IPv6 link local address for this
+   context.
+
string MessageProxy [readwrite, MMS only]
 
Holds the MMS Proxy setting.
-- 
1.7.1

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


[PATCH 03/13] gprs: driver interface changes for IPv6

2011-02-08 Thread Mika Liljeberg
---
 include/gprs-context.h |   27 ++-
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index c29c0dc..f2d6df4 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -37,6 +37,7 @@ struct ofono_gprs_context;
 enum ofono_gprs_proto {
OFONO_GPRS_PROTO_IP = 0,
OFONO_GPRS_PROTO_IPV6,
+   OFONO_GPRS_PROTO_IPV4V6,
 };
 
 enum ofono_gprs_context_type {
@@ -47,6 +48,12 @@ enum ofono_gprs_context_type {
OFONO_GPRS_CONTEXT_TYPE_IMS,
 };
 
+enum ofono_gprs_addrconf {
+   OFONO_GPRS_ADDRCONF_NONE,
+   OFONO_GPRS_ADDRCONF_STATIC,
+   OFONO_GPRS_ADDRCONF_DHCP,
+};
+
 struct ofono_gprs_primary_context {
unsigned int cid;
int direction;
@@ -58,10 +65,6 @@ struct ofono_gprs_primary_context {
 
 typedef void (*ofono_gprs_context_cb_t)(const struct ofono_error *error,
void *data);
-typedef void (*ofono_gprs_context_up_cb_t)(const struct ofono_error *error,
-   const char *interface, ofono_bool_t static_ip,
-   const char *address, const char *netmask,
-   const char *gw, const char **dns, void *data);
 
 struct ofono_gprs_context_driver {
const char *name;
@@ -70,7 +73,7 @@ struct ofono_gprs_context_driver {
void (*remove)(struct ofono_gprs_context *gc);
void (*activate_primary)(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data);
+   ofono_gprs_context_cb_t cb, void *data);
void (*deactivate_primary)(struct ofono_gprs_context *gc,
unsigned int id,
ofono_gprs_context_cb_t cb, void *data);
@@ -94,6 +97,20 @@ struct ofono_modem *ofono_gprs_context_get_modem(struct 
ofono_gprs_context *gc);
 
 void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
enum ofono_gprs_context_type type);
+void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
+   const char *interface);
+void ofono_gprs_context_set_ip_addrconf(struct ofono_gprs_context *gc,
+   enum ofono_gprs_addrconf method);
+void ofono_gprs_context_set_ip_address(struct ofono_gprs_context *gc,
+   const char *address);
+void ofono_gprs_context_set_ip_netmask(struct ofono_gprs_context *gc,
+   const char *netmask);
+void ofono_gprs_context_set_ip_gateway(struct ofono_gprs_context *gc,
+   const char *netmask);
+void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
+   const char *address);
+void ofono_gprs_context_set_dns_servers(struct ofono_gprs_context *gc,
+   const char **dns);
 
 #ifdef __cplusplus
 }
-- 
1.7.1

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


[PATCH 04/13] gprs: core support for IPv6

2011-02-08 Thread Mika Liljeberg
---
 src/gprs.c |  285 +---
 1 files changed, 213 insertions(+), 72 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index fa56f62..5345fa1 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -34,6 +34,8 @@
 #include net/route.h
 #include netinet/in.h
 #include arpa/inet.h
+#include linux/netlink.h
+#include linux/rtnetlink.h
 
 #include glib.h
 #include gdbus.h
@@ -99,10 +101,12 @@ struct ofono_gprs {
struct ofono_atom *atom;
 };
 
+struct pri_context;
+
 struct ofono_gprs_context {
struct ofono_gprs *gprs;
+   struct pri_context *pri;
enum ofono_gprs_context_type type;
-   ofono_bool_t inuse;
const struct ofono_gprs_context_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -111,10 +115,11 @@ struct ofono_gprs_context {
 struct context_settings {
enum ofono_gprs_context_type type;
char *interface;
-   gboolean static_ip;
+   enum ofono_gprs_addrconf method;
char *ip;
char *netmask;
char *gateway;
+   char *ipv6;
char **dns;
char *proxy;
 };
@@ -226,6 +231,8 @@ static const char *gprs_proto_to_string(enum 
ofono_gprs_proto proto)
return ip;
case OFONO_GPRS_PROTO_IPV6:
return ipv6;
+   case OFONO_GPRS_PROTO_IPV4V6:
+   return ipv4v6;
};
 
return NULL;
@@ -240,11 +247,28 @@ static gboolean gprs_proto_from_string(const char *str,
} else if (g_str_equal(str, ipv6)) {
*proto = OFONO_GPRS_PROTO_IPV6;
return TRUE;
+   } else if (g_str_equal(str, ipv4v6)) {
+   *proto = OFONO_GPRS_PROTO_IPV4V6;
+   return TRUE;
}
 
return FALSE;
 }
 
+static const char *gprs_addrconf_to_string(enum ofono_gprs_addrconf method)
+{
+   switch (method) {
+   case OFONO_GPRS_ADDRCONF_NONE:
+   return NULL;
+   case OFONO_GPRS_ADDRCONF_STATIC:
+   return static;
+   case OFONO_GPRS_ADDRCONF_DHCP:
+   return dhcp;
+   }
+
+   return NULL;
+}
+
 static unsigned int gprs_cid_alloc(struct ofono_gprs *gprs)
 {
return idmap_alloc(gprs-cid_map);
@@ -273,13 +297,13 @@ static gboolean assign_context(struct pri_context *ctx)
for (l = ctx-gprs-context_drivers; l; l = l-next) {
struct ofono_gprs_context *gc = l-data;
 
-   if (gc-inuse == TRUE)
+   if (gc-pri != NULL)
continue;
 
if (gc-type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
gc-type == ctx-type) {
ctx-context_driver = gc;
-   ctx-context_driver-inuse = TRUE;
+   gc-pri = ctx;
return TRUE;
}
}
@@ -294,7 +318,7 @@ static void release_context(struct pri_context *ctx)
 
gprs_cid_release(ctx-gprs, ctx-context.cid);
ctx-context.cid = 0;
-   ctx-context_driver-inuse = FALSE;
+   ctx-context_driver-pri = NULL;
ctx-context_driver = NULL;
 }
 
@@ -313,14 +337,22 @@ static struct pri_context *gprs_context_by_path(struct 
ofono_gprs *gprs,
return NULL;
 }
 
-static void context_settings_free(struct context_settings *settings)
+static void pri_context_settings_free(struct pri_context *ctx)
 {
+   struct context_settings *settings = ctx-settings;
+
+   if (settings == NULL)
+   return;
+
+   ctx-settings = NULL;
+
g_free(settings-interface);
g_free(settings-ip);
g_free(settings-netmask);
g_free(settings-gateway);
g_strfreev(settings-dns);
g_free(settings-proxy);
+   g_free(settings-ipv6);
 
g_free(settings);
 }
@@ -359,12 +391,10 @@ static void context_settings_append_variant(struct 
context_settings *settings,
goto done;
}
 
-   if (settings-static_ip == TRUE)
-   method = static;
-   else
-   method = dhcp;
-
-   ofono_dbus_dict_append(array, Method, DBUS_TYPE_STRING, method);
+   method = gprs_addrconf_to_string(settings-method);
+   if (method != NULL)
+   ofono_dbus_dict_append(array, Method, DBUS_TYPE_STRING,
+   method);
 
if (settings-ip)
ofono_dbus_dict_append(array, Address, DBUS_TYPE_STRING,
@@ -378,6 +408,10 @@ static void context_settings_append_variant(struct 
context_settings *settings,
ofono_dbus_dict_append(array, Gateway, DBUS_TYPE_STRING,
settings-gateway);
 
+   if (settings-ipv6 != NULL)
+   ofono_dbus_dict_append(array, IPv6Address, DBUS_TYPE_STRING,
+   settings-ipv6);
+
if (settings-dns)
ofono_dbus_dict_append_array(array, DomainNameServers,

[PATCH 05/13] test: modify test scripts for IPv6

2011-02-08 Thread Mika Liljeberg
---
 Makefile.am   |3 ++-
 test/list-contexts|6 +++---
 test/set-context-property |   38 ++
 3 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100755 test/set-context-property

diff --git a/Makefile.am b/Makefile.am
index 758fb10..ee3e11a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -479,7 +479,8 @@ test_scripts = test/backtrace \
test/cdma-hangup \
test/disable-call-forwarding \
test/list-messages \
-   test/test-sms
+   test/test-sms \
+   test/set-context-property
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/list-contexts b/test/list-contexts
index 68dae6a..9519ade 100755
--- a/test/list-contexts
+++ b/test/list-contexts
@@ -24,15 +24,15 @@ for path, properties in modems:
print [ %s ] % (path)
 
for key in properties.keys():
-   if key in [Settings]:
+   if key in [Settings] or key in [IPv6Settings]:
val = {
for i in properties[key].keys():
val +=   + i + =
if i in [DomainNameServers]:
for n in properties[key][i]:
-   val += n + ,
+   val += str(n) + ,
else:
-   val += properties[key][i]
+   val += str(properties[key][i])
val +=  }
else:
val = str(properties[key])
diff --git a/test/set-context-property b/test/set-context-property
new file mode 100755
index 000..8ea0e3a
--- /dev/null
+++ b/test/set-context-property
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if len(sys.argv)  4:
+   print Usage: set-context-property context name value
+   sys.exit(1)
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+   if org.ofono.ConnectionManager not in properties[Interfaces]:
+   continue
+
+   connman = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.ConnectionManager')
+
+   contexts = connman.GetContexts()
+
+   if (len(contexts) == 0):
+   print No context available
+   sys.exit(1)
+
+   path = contexts[int(sys.argv[1])][0]
+   context = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.ConnectionContext')
+
+   try:
+   context.SetProperty(sys.argv[2], sys.argv[3])
+   except dbus.DBusException, e:
+   print Error setting context %s property %s: %s % (path, 
sys.argv[2], str(e))
+   exit(2)
-- 
1.7.1

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


[PATCH 06/13] isimodem: IPv6 support

2011-02-08 Thread Mika Liljeberg
---
 drivers/isimodem/gprs-context.c |  119 ---
 1 files changed, 73 insertions(+), 46 deletions(-)

diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
index 6d579d8..942cb13 100644
--- a/drivers/isimodem/gprs-context.c
+++ b/drivers/isimodem/gprs-context.c
@@ -62,10 +62,7 @@ struct context_data {
uint16_t gpds;  /* GPDS object handle */
unsigned cid;   /* oFono core context ID */
struct ofono_gprs_context *context;
-   union {
-   ofono_gprs_context_up_cb_t up_cb;
-   ofono_gprs_context_cb_t down_cb;
-   };
+   ofono_gprs_context_cb_t cb;
void *data;
 
GIsiPEP *pep;
@@ -112,15 +109,14 @@ typedef void (*ContextFailFunc)(struct context_data *cd);
 
 static void gprs_up_fail(struct context_data *cd)
 {
-   CALLBACK_WITH_FAILURE(cd-up_cb, NULL, 0, NULL, NULL, NULL, NULL,
-   cd-data);
reset_context(cd);
+   CALLBACK_WITH_FAILURE(cd-cb, cd-data);
 }
 
 static void gprs_down_fail(struct context_data *cd)
 {
-   CALLBACK_WITH_FAILURE(cd-down_cb, cd-data);
reset_context(cd);
+   CALLBACK_WITH_FAILURE(cd-cb, cd-data);
 }
 
 static gboolean check_resp(const GIsiMessage *msg, uint8_t id, size_t minlen,
@@ -206,12 +202,12 @@ static void activate_ind_cb(const GIsiMessage *msg, void 
*opaque)
 {
struct context_data *cd = opaque;
GIsiSubBlockIter iter;
+   const char *dns[5];
+   int dns_count = 0;
 
char ifname[IF_NAMESIZE];
-   char *ip = NULL;
-   char *pdns = NULL;
-   char *sdns = NULL;
-   const char *dns[3];
+   char *ip_addr = NULL;
+   char *ipv6_addr = NULL;
 
if (!check_ind(msg, 2, cd))
return;
@@ -225,8 +221,6 @@ static void activate_ind_cb(const GIsiMessage *msg, void 
*opaque)
 
switch (g_isi_sb_iter_get_id(iter)) {
 
-   /* TODO: IPv6 address support */
-
case GPDS_PDP_ADDRESS_INFO:
 
if (!g_isi_sb_iter_get_byte(iter, addr_len, 3))
@@ -236,9 +230,15 @@ static void activate_ind_cb(const GIsiMessage *msg, void 
*opaque)
4))
goto error;
 
-   ip = alloca(INET_ADDRSTRLEN);
-   inet_ntop(AF_INET, (const void *)addr_value, ip,
-   INET_ADDRSTRLEN);
+   if (addr_len == 4) {
+   ip_addr = alloca(INET_ADDRSTRLEN);
+   inet_ntop(AF_INET, (const void *)addr_value,
+   ip_addr, INET_ADDRSTRLEN);
+   } else if (addr_len == 16) {
+   ipv6_addr = alloca(INET6_ADDRSTRLEN);
+   inet_ntop(AF_INET6, (const void *)addr_value,
+   ipv6_addr, INET6_ADDRSTRLEN);
+   }
break;
 
case GPDS_PDNS_ADDRESS_INFO:
@@ -250,9 +250,17 @@ static void activate_ind_cb(const GIsiMessage *msg, void 
*opaque)
4))
break;
 
-   pdns = alloca(INET_ADDRSTRLEN);
-   inet_ntop(AF_INET, (const void *)addr_value, pdns,
-   INET_ADDRSTRLEN);
+   if (addr_len == 4) {
+   char *addr = alloca(INET_ADDRSTRLEN);
+   inet_ntop(AF_INET, (const void *)addr_value,
+   addr, INET_ADDRSTRLEN);
+   dns[dns_count++] = addr;
+   } else if (addr_len == 16) {
+   char *addr = alloca(INET6_ADDRSTRLEN);
+   inet_ntop(AF_INET6, (const void *)addr_value,
+   addr, INET6_ADDRSTRLEN);
+   dns[dns_count++] = addr;
+   }
break;
 
case GPDS_SDNS_ADDRESS_INFO:
@@ -264,9 +272,17 @@ static void activate_ind_cb(const GIsiMessage *msg, void 
*opaque)
4))
break;
 
-   sdns = alloca(INET_ADDRSTRLEN);
-   inet_ntop(AF_INET, (const void *)addr_value, sdns,
-   INET_ADDRSTRLEN);
+   if (addr_len == 4) {
+   char *addr = alloca(INET_ADDRSTRLEN);
+   inet_ntop(AF_INET, (const void *)addr_value,
+   addr, INET_ADDRSTRLEN);
+   dns[dns_count++] = addr;
+   } 

[PATCH 08/13] huaweimodem: update to new gprs context interface

2011-02-08 Thread Mika Liljeberg
---
 drivers/huaweimodem/gprs-context.c |   43 +---
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/huaweimodem/gprs-context.c 
b/drivers/huaweimodem/gprs-context.c
index bbc9c96..67d933e 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -53,10 +53,7 @@ struct gprs_context_data {
unsigned int dhcp_source;
unsigned int dhcp_count;
guint ndis_watch;
-   union {
-   ofono_gprs_context_cb_t down_cb;/* Down callback */
-   ofono_gprs_context_up_cb_t up_cb;   /* Up callback */
-   };
+   ofono_gprs_context_cb_t cb;
void *cb_data;  /* Callback data */
 };
 
@@ -68,8 +65,7 @@ static gboolean dhcp_poll(gpointer user_data)
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
 
if (gcd-dhcp_count  20)
-   CALLBACK_WITH_FAILURE(gcd-up_cb, NULL, 0, NULL, NULL,
-   NULL, NULL, gcd-cb_data);
+   CALLBACK_WITH_FAILURE(gcd-cb, gcd-cb_data);
else
check_dhcp(gc);
 
@@ -192,9 +188,15 @@ static void dhcp_query_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
interface = invalid;
 
-   CALLBACK_WITH_SUCCESS(gcd-up_cb, interface, TRUE, ip,
-   netmask, gateway, dns, gcd-cb_data);
-   gcd-up_cb = NULL;
+   ofono_gprs_context_set_interface(gc, interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, ip);
+   ofono_gprs_context_set_ip_netmask(gc, netmask);
+   ofono_gprs_context_set_ip_gateway(gc, gateway);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+
+   CALLBACK_WITH_SUCCESS(gcd-cb, gcd-cb_data);
+   gcd-cb = NULL;
gcd-cb_data = NULL;
 
g_free(ip);
@@ -224,7 +226,7 @@ static void at_ndisdup_down_cb(gboolean ok, GAtResult 
*result,
DBG(ok %d, ok);
 
if (ok) {
-   gcd-down_cb = cb;
+   gcd-cb = cb;
gcd-cb_data = cbd-data;
 
if (gcd-ndis_watch  0) {
@@ -241,7 +243,7 @@ static void at_ndisdup_up_cb(gboolean ok, GAtResult *result,
gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd-cb;
+   ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct ofono_error error;
@@ -249,7 +251,7 @@ static void at_ndisdup_up_cb(gboolean ok, GAtResult *result,
DBG(ok %d, ok);
 
if (ok) {
-   gcd-up_cb = cb;
+   gcd-cb = cb;
gcd-cb_data = cbd-data;
 
gcd-dhcp_count = 0;
@@ -261,13 +263,13 @@ static void at_ndisdup_up_cb(gboolean ok, GAtResult 
*result,
gcd-active_context = 0;
 
decode_at_error(error, g_at_result_final_response(result));
-   cb(error, NULL, FALSE, NULL, NULL, NULL, NULL, cbd-data);
+   cb(error, cbd-data);
 }
 
 static void at_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd-cb;
+   ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *ncbd;
@@ -281,7 +283,7 @@ static void at_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
gcd-active_context = 0;
 
decode_at_error(error, g_at_result_final_response(result));
-   cb(error, NULL, 0, NULL, NULL, NULL, NULL, cbd-data);
+   cb(error, cbd-data);
return;
}
 
@@ -297,18 +299,22 @@ static void at_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
gcd-active_context = 0;
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, cbd-data);
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
 }
 
 static void huawei_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
int len;
 
+   /* IPv6 support not implemented */
+   if (ctx-proto != OFONO_GPRS_PROTO_IP)
+   goto error;
+
DBG(cid %u, ctx-cid);
 
gcd-active_context = ctx-cid;
@@ -325,9 +331,10 @@ static void huawei_gprs_activate_primary(struct 
ofono_gprs_context *gc,
  

[PATCH 12/13] stemodem: update to new gprs context interface

2011-02-08 Thread Mika Liljeberg
---
 drivers/stemodem/gprs-context.c |   31 +++
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index e247f35..7266810 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -246,7 +246,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult 
*result,
 static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd-cb;
+   ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct conn_info *conn;
@@ -276,7 +276,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
conn-cid = 0;
gcd-active_context = 0;
decode_at_error(error, g_at_result_final_response(result));
-   cb(error, NULL, 0, NULL, NULL, NULL, NULL, cbd-data);
+   cb(error, cbd-data);
return;
}
 
@@ -305,9 +305,13 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
dns[1] = rsp.dns_server2;
dns[2] = NULL;
 
-   CALLBACK_WITH_SUCCESS(cb, conn-interface, TRUE, rsp.ip_address,
-   rsp.subnet_mask, NULL,
-   dns, cbd-data);
+   ofono_gprs_context_set_interface(gc, conn-interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, rsp.ip_address);
+   ofono_gprs_context_set_ip_netmask(gc, rsp.subnet_mask);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
return;
 
 error:
@@ -320,13 +324,13 @@ error:
 error_no_device:
DBG(ste_eppsd_up_cb error);
gcd-active_context = 0;
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, cbd-data);
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
 }
 
 static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd-cb;
+   ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *ncbd;
@@ -351,7 +355,7 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
conn-cid = 0;
gcd-active_context = 0;
decode_at_error(error, g_at_result_final_response(result));
-   cb(error, NULL, 0, NULL, NULL, NULL, NULL, cbd-data);
+   cb(error, cbd-data);
return;
}
 
@@ -368,13 +372,12 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
 
 error_no_device:
gcd-active_context = 0;
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL,
-   NULL, NULL, cbd-data);
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
 }
 
 static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
@@ -383,6 +386,10 @@ static void ste_gprs_activate_primary(struct 
ofono_gprs_context *gc,
GSList *l;
struct conn_info *conn;
 
+   /* IPv6 support not implemented */
+   if (ctx-proto != OFONO_GPRS_PROTO_IP)
+   goto error_no_device;
+
gcd-active_context = ctx-cid;
cbd-user = gc;
 
@@ -432,7 +439,7 @@ error_no_device:
gcd-active_context = 0;
g_free(cbd);
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
-- 
1.7.1

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


[PATCH 11/13] ifxmodem: update to new gprs context interface

2011-02-08 Thread Mika Liljeberg
---
 drivers/ifxmodem/gprs-context.c |   36 +---
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2c68b44..91dee8c 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -67,10 +67,7 @@ struct gprs_context_data {
char address[32];
char dns1[32];
char dns2[32];
-   union {
-   ofono_gprs_context_cb_t down_cb;/* Down callback */
-   ofono_gprs_context_up_cb_t up_cb;   /* Up callback */
-   };
+   ofono_gprs_context_cb_t cb;
void *cb_data;  /* Callback data */
 };
 
@@ -123,13 +120,12 @@ static void failed_setup(struct ofono_gprs_context *gc,
gcd-state = STATE_IDLE;
 
if (result == NULL) {
-   CALLBACK_WITH_FAILURE(gcd-up_cb, NULL, 0, NULL, NULL,
-   NULL, NULL, gcd-cb_data);
+   CALLBACK_WITH_FAILURE(gcd-cb, gcd-cb_data);
return;
}
 
decode_at_error(error, g_at_result_final_response(result));
-   gcd-up_cb(error, NULL, 0, NULL, NULL, NULL, NULL, gcd-cb_data);
+   gcd-cb(error, gcd-cb_data);
 }
 
 static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -157,10 +153,15 @@ static void session_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
if (interface == NULL)
interface = invalid;
 
-   CALLBACK_WITH_SUCCESS(gcd-up_cb, interface, TRUE, gcd-address,
-   STATIC_IP_NETMASK, NULL, dns, gcd-cb_data);
+   ofono_gprs_context_set_interface(gc, interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, gcd-address);
+   ofono_gprs_context_set_ip_netmask(gc, STATIC_IP_NETMASK);
+   ofono_gprs_context_set_dns_servers(gc, dns);
 
-   gcd-up_cb = NULL;
+   CALLBACK_WITH_SUCCESS(gcd-cb, gcd-cb_data);
+
+   gcd-cb = NULL;
gcd-cb_data = NULL;
 }
 
@@ -316,16 +317,20 @@ error:
 
 static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
char buf[OFONO_GPRS_MAX_APN_LENGTH + 128];
int len;
 
+   /* IPv6 support not implemented */
+   if (ctx-proto != OFONO_GPRS_PROTO_IP)
+   goto error;
+
DBG(cid %u, ctx-cid);
 
gcd-active_context = ctx-cid;
-   gcd-up_cb = cb;
+   gcd-cb = cb;
gcd-cb_data = data;
memcpy(gcd-username, ctx-username, sizeof(ctx-username));
memcpy(gcd-password, ctx-password, sizeof(ctx-password));
@@ -342,7 +347,8 @@ static void ifx_gprs_activate_primary(struct 
ofono_gprs_context *gc,
setup_cb, gc, NULL)  0)
return;
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+error:
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -360,7 +366,7 @@ static void deactivate_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
g_at_chat_resume(gcd-chat);
 
-   CALLBACK_WITH_SUCCESS(gcd-down_cb, gcd-cb_data);
+   CALLBACK_WITH_SUCCESS(gcd-cb, gcd-cb_data);
 }
 
 static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
@@ -374,7 +380,7 @@ static void ifx_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
DBG(cid %u, cid);
 
gcd-state = STATE_DISABLING;
-   gcd-down_cb = cb;
+   gcd-cb = cb;
gcd-cb_data = data;
 
g_at_rawip_shutdown(gcd-rawip);
-- 
1.7.1

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


[PATCH 13/13] phonesim: add IPv6 support

2011-02-08 Thread Mika Liljeberg
---
 plugins/phonesim.c |   32 +---
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/plugins/phonesim.c b/plugins/phonesim.c
index 2b36fe0..2634d23 100644
--- a/plugins/phonesim.c
+++ b/plugins/phonesim.c
@@ -83,14 +83,17 @@ struct gprs_context_data {
 static void at_cgact_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd-cb;
+   ofono_gprs_context_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct ofono_error error;
 
decode_at_error(error, g_at_result_final_response(result));
-   cb(error, ok ? gcd-interface : NULL, FALSE,
-   NULL, NULL, NULL, NULL, cbd-data);
+
+   if (ok)
+   ofono_gprs_context_set_interface(gc, gcd-interface);
+
+   cb(error, cbd-data);
 }
 
 static void at_cgact_down_cb(gboolean ok, GAtResult *result, gpointer 
user_data)
@@ -105,16 +108,31 @@ static void at_cgact_down_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
 
 static void phonesim_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[OFONO_GPRS_MAX_APN_LENGTH + 128];
-   int len;
+   int len = 0;
 
cbd-user = gc;
 
-   len = snprintf(buf, sizeof(buf), AT+CGDCONT=%u,\IP\, ctx-cid);
+   switch (ctx-proto) {
+   case OFONO_GPRS_PROTO_IP:
+   len = snprintf(buf, sizeof(buf), AT+CGDCONT=%u,\IP\,
+   ctx-cid);
+   break;
+
+   case OFONO_GPRS_PROTO_IPV6:
+   len = snprintf(buf, sizeof(buf), AT+CGDCONT=%u,\IPV6\,
+   ctx-cid);
+   break;
+
+   case OFONO_GPRS_PROTO_IPV4V6:
+   len = snprintf(buf, sizeof(buf), AT+CGDCONT=%u,\IPV4V6\,
+   ctx-cid);
+   break;
+   }
 
if (ctx-apn)
snprintf(buf + len, sizeof(buf) - len - 3, ,\%s\,
@@ -132,7 +150,7 @@ static void phonesim_activate_primary(struct 
ofono_gprs_context *gc,
 error:
g_free(cbd);
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void phonesim_deactivate_primary(struct ofono_gprs_context *gc,
-- 
1.7.1

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


Re: [PATCH 1/2] ste: Add support for multiple pdp contexts.

2011-02-08 Thread Marcel Holtmann
Hi Marit,

 diff --git a/plugins/ste.c b/plugins/ste.c
 index cf8aed8..749c4f3 100644
 --- a/plugins/ste.c
 +++ b/plugins/ste.c
 @@ -66,6 +66,7 @@
  #include drivers/stemodem/if_caif.h
  
  #define NUM_CHAT 1
 +#define MAX_PDP_CONTEXTS 4
  
  static const char *cpin_prefix[] = { +CPIN:, NULL };
  
 @@ -363,6 +364,7 @@ static void ste_post_online(struct ofono_modem *modem)
   struct ofono_message_waiting *mw;
   struct ofono_gprs *gprs;
   struct ofono_gprs_context *gc;
 + int i;
  
   DBG(%p, modem);
  
 @@ -378,13 +380,18 @@ static void ste_post_online(struct ofono_modem *modem)
  
   gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
   atmodem, data-chat);
 - gc = ofono_gprs_context_create(modem, 0, stemodem, data-chat);
 -
 - if (gprs  gc)
 - ofono_gprs_add_context(gprs, gc);
 + if (gprs) {
 + for (i = 0; i  MAX_PDP_CONTEXTS; i++) {
 + gc = ofono_gprs_context_create(
 + modem, 0, stemodem, data-chat);
 + if (gc == NULL)
 + break;
 +
 + ofono_gprs_add_context(gprs, gc);
 + }
 + }

you do not need to create the GPRS context atom multiple times. You can
just add the gc multiple times.

So I just wanna make sure that you guys wanna have multiple GPRS context
atom instances. For things like PPP and RawIP we have no other choice,
but for example ISI is a bit more flexible here. That is the reason why
we do allow it. Maybe CAIF is as flexible.

It is a bit question about resources that are used. I am fine either
way, but I need you to at least think about it ;)

Regards

Marcel


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


Re: [PATCH 1/4] nettime: Network time plugin implementation

2011-02-08 Thread Marcel Holtmann
Hi Antti,

plugins/nettime.c |  326 
   +
1 files changed, 326 insertions(+), 0 deletions(-)
create mode 100644 plugins/nettime.c
  
  I would prefer if we call this nokia-timed.c or in case this actually
  becomes default part of MeeGo, them maybe meego-timed.c. I would be also
  fine with {nokia,meego}-nettime.c.
  
  Just calling it nettime.c is too generic. It needs to be clear what this
  is for.
  
   +#define TIMED_PATH /com/meego/time
   +#define TIMED_SERVICE com.meego.time
  
  So the intention is to convert the Nokia timed into a MeeGo specific
  daemon? I would have expected to see com.nokia.timed here.
 
 My understanding is that this will be Meego specific plugin since timed
 is part of Meego. Hence, the service 'com.meego.timed'.  

this is fine with me, but so far the timed.git tree has nothing alike
this mentioned. It currently still uses com.nokia.timed.

   +struct nt_data {
   + gboolean time_available;
   + gboolean time_pending;
   + time_t nw_time_utc;
   + time_t received;
   + int dst;
   + int time_zone;
   + const char *mcc;
   + const char *mnc;
  
  Why do you bother with these here. You might better just reference the
  netreg atom. The memory is only valid if netreg atom is present.
 
 Timed expects to receive the mcc and mnc in the time notification.
 However, if the mcc and mnc don't change we don't resend the
 information. These fields contain the mnc and mcc that oFono sent
 in the previous time notification.

But this const pointer points to memory inside netreg. It will never
change. It always points to the same address.

Regards

Marcel


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


Re: [PATCH] sim: enable usage of SIM pass codes longer than 8 digits

2011-02-08 Thread Denis Kenzior
Hi Jussi,

On 02/08/2011 06:48 AM, Jussi Kangas wrote:
 ---
 
 
 Hi,
 
 On Tue, 2011-02-08 at 06:17 +0200, Denis Kenzior wrote:
 
 Why don't we keep things simple.  Modify is_valid_pin to take a pin and
 a min and max number of digits.

 gboolean is_valid_pin_with_limits(const char *pin, int min, int max)
 (feel free to pick some better name)

 Then just add two functions:

 __ofono_valid_net_pin(const char *pin)
 __ofono_valid_sim_pin(const char *pin, enum ofono_sim_password_type type)

 Stick both in ofono.h / sim.c somewhere

 
 Right. Here it is. 

I applied your patch, but it did have multiple problems, namely blank
line at EOF in sim.c, mixing tab/space for indentation and a compilation
warning.  I was nice enough and fixed all these for you, but please pay
attention to this the next time.

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


Re: [RFCv2] doc: Proposal for LTE/IMS API

2011-02-08 Thread Sjur Brændeland
Hi Rémi,

  +Service              org.ofono
  +Interface    org.ofono.IpMultimediaSubsystem
  +Object path  [variable prefix]

 I guess this is meant to be a modem object path, but it seems the oFono
 documentation is already a bit sloppy on this point.

Yes, this should be the modem object path. I'll fix this in the next patch.

  +             void Register(string type)
  +
  +                     Register a IMS Application. It must register
  +                     with one of the types:
  +                     voice, messaging, voice_messaging.

 I am not very familiar with the underlying protocol... If it really makes
 sense to register both services simultaneously, then I think we should have an
 array of strings. Or if there are no benefits, then why bother with
 'voice_messaging' anyway.

Yes, an array of strings might be a good idea here.


  +             boolean PreConditionCheck(string Type, string PeerAddress,
  +                                     uint16 PeerPort,  uint16 LocalPort)
  +
 That stuff is per context. Should it not be in the context object rather than
 in the IMS manager?

oFono should only consider QoS information from the IMS
Default and Dedicated bearers when checking the precondition.

In theory there might be more than one IMS APN for a operator,
but I really don't see this as a real life scenario for this.
If anyone disagrees please speak out and explain...

  +             array{string} PcscfAddresses [readonly]
 Should this be in the context object? The AT command is per CID. Would it make
 any sense for a network to have different P-CSCF based on the bearer?

As mentioned above, I don't see why an operator would ever have more than
one IMS APN. If we only have one IMS APN, then we might as well present
this information here in the IMS API.


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


Re: [RFCv2] doc: Proposal for LTE/IMS API

2011-02-08 Thread Sjur Brændeland
Hi Redouane,

 +             void UnRegister(object path)
 +
 +                     Un-register a IpMultimediaSubsystemAgent.

 Register and UnRegister functions are not really symmetric here ...
 How object path is used by UnRegister function ??
 Maybe we should have :
 void UnRegister(string type)

Thanks for spotting this, it's a bug. It should have been
void UnRegister(). I'll fix this in the next patch.

 +             boolean PreConditionCheck(string Type, string PeerAddress,
 +                                     uint16 PeerPort,  uint16 LocalPort)

 How to make the link between the primary context (or default bearer) 
 activated by the IMS client ,
 and the TFT and QOS.

When Dedicated bearers are created  +CGEV: NW ACT reports both the
Default Bearer and the Dedicated bearer.

 We can imagine that we have a good QOS / TFT but it doesn't belong to the 
 primary context (or default bearer) activated by the IMS client.

As mentioned to Rémi, we should only consider the QoS/TFT for the IMS
ConnectionContext
and related Dedicated Bearers. So oFono core only needs to keep track
of the QoS/TFTs for IMS.

 +             void PreConditionChanged()
 +
 +                     This signal is sent when the network has changed
 +                     the QoS or Packet Filters for a Bearer.
 +                     The IMS application can then check the QoS SIP
 +                     preconditions by calling PreConditionCheck().
 +
 +                     Only QoS information relevant for IMS will be
 +                     signaled, i.e. QCI=1 for voice and QCI=2 for video.
 +
 +                     Related AT commands: AT+CGEREP,
 +                     +CGEV: NW ACT, +CGEV: NW MODIFY
 +

 Same here , IMS client will be notified for all dedicated bearer ?
 I agree with Rémi, it 'll be better if we can put QOS/TFT somewhere under 
 primary context.

I believe we will have only one IMS APN for each operator, so we might
as well keep it here in
the IMS Interface.


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


[PATCH v4 1/1] ifxmodem: move call creation to xcallstat_notify

2011-02-08 Thread Jeevaka Badrappan
---
 drivers/ifxmodem/voicecall.c |  172 --
 1 files changed, 98 insertions(+), 74 deletions(-)

diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 648f46b..30e6991 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -79,7 +79,8 @@ static int class_to_call_type(int cls)
 
 static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
int direction, int status,
-   const char *num, int num_type, int clip)
+   const char *num, int num_type,
+   int clip, int id)
 {
struct voicecall_data *d = ofono_voicecall_get_data(vc);
struct ofono_call *call;
@@ -91,7 +92,7 @@ static struct ofono_call *create_call(struct ofono_voicecall 
*vc, int type,
 
ofono_call_init(call);
 
-   call-id = ofono_voicecall_get_next_callid(vc);
+   call-id = id;
call-type = type;
call-direction = direction;
call-status = status;
@@ -117,7 +118,8 @@ static void xcallstat_notify(GAtResult *result, gpointer 
user_data)
int id;
int status;
GSList *l;
-   struct ofono_call *call;
+   struct ofono_call *new_call;
+   struct ofono_call *existing_call = NULL;
 
g_at_result_iter_init(iter, result);
 
@@ -133,53 +135,83 @@ static void xcallstat_notify(GAtResult *result, gpointer 
user_data)
l = g_slist_find_custom(vd-calls, GINT_TO_POINTER(id),
at_util_call_compare_by_id);
 
-   if (l == NULL) {
-   /*
-* We should only receive XCALLSTAT on waiting and incoming
-* In the case of waiting, we will get the rest of the info
-* from CCWA indication.
-* In the case of incoming, we will get the info from CLIP
-* indications.
-*/
-   if (status != CALL_STATUS_INCOMING 
-   status != CALL_STATUS_WAITING) {
-   ofono_info(Received an XCALLSTAT for an untracked
-call, this indicates a bug!);
-   return;
-   }
-
+   if (l == NULL  status != CALL_STATUS_DIALING 
+   status != CALL_STATUS_INCOMING 
+   status != CALL_STATUS_WAITING) {
+   ofono_error(Received XCALLSTAT for an untracked
+call, this indicates a bug!);
return;
}
 
-   call = l-data;
+   if (l)
+   existing_call = l-data;
 
-   /* Check if call has been disconnected */
-   if (status == CALL_STATUS_DISCONNECTED) {
-   enum ofono_disconnect_reason r;
+   switch (status) {
+   case CALL_STATUS_DISCONNECTED:
+   {
+   enum ofono_disconnect_reason reason;
 
-   if (vd-local_release  (1  call-id))
-   r = OFONO_DISCONNECT_REASON_LOCAL_HANGUP;
-   else
-   r = OFONO_DISCONNECT_REASON_REMOTE_HANGUP;
+   existing_call-status = status;
 
-   if (call-type == 0)
-   ofono_voicecall_disconnected(vc, call-id, r, NULL);
+   if (vd-local_release  (1  existing_call-id))
+   reason = OFONO_DISCONNECT_REASON_LOCAL_HANGUP;
+   else
+   reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP;
 
-   vd-local_release = ~(1  call-id);
-   vd-calls = g_slist_remove(vd-calls, call);
-   g_free(call);
+   ofono_voicecall_disconnected(vc, existing_call-id,
+   reason, NULL);
 
-   return;
+   vd-local_release = ~(1  existing_call-id);
+   vd-calls = g_slist_remove(vd-calls, l-data);
+   g_free(existing_call);
+   break;
}
+   case CALL_STATUS_DIALING:
+   case CALL_STATUS_WAITING:
+   case CALL_STATUS_INCOMING:
+   {
+   int direction;
+
+   /* Handle the following situation:
+* Active Call + Waiting Call. Active Call is Released.
+* The Waiting call becomes Incoming. In this case, no
+* need to create a new call. Call status change will be
+* triggered from clip_notify.
+*/
+   if (existing_call) {
+   existing_call-status = status;
+   return;
+   }
 
-   /* For connected status, simply reset back to active */
-   if (status == 7)
-   status = 0;
+   if (status == CALL_STATUS_DIALING)
+   direction = CALL_DIRECTION_MOBILE_ORIGINATED;
+   

[PATCH v4 0/1] Refactor call status handling

2011-02-08 Thread Jeevaka Badrappan
Hi,

Since XCALLSTAT reports the voice call status information and call id,
creation of the call is moved inside xcallstat_notify function.

Regards,
Jeevaka

Jeevaka Badrappan (1):
  ifxmodem: move call creation to xcallstat_notify

 drivers/ifxmodem/voicecall.c |  172 --
 1 files changed, 98 insertions(+), 74 deletions(-)

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


Re: [PATCH v4 1/1] ifxmodem: move call creation to xcallstat_notify

2011-02-08 Thread Denis Kenzior
Hi Jeevaka,

On 02/08/2011 11:04 AM, Jeevaka Badrappan wrote:
 ---
  drivers/ifxmodem/voicecall.c |  172 
 --
  1 files changed, 98 insertions(+), 74 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH -v2 6/7] emulator: Implement dialing up for DUN

2011-02-08 Thread Gustavo F. Padovan
HI Guillaume,

* Guillaume Zajac guillaume.za...@linux.intel.com [2011-02-08 14:53:39 +0100]:

 Hi Gustavo,
 
 On 04/02/2011 22:46, Gustavo F. Padovan wrote:
  It handles client ATD*99# request and then initiate the PPP negotiation.
  IP forward through the new ppp interface is not done yet.
 
  Initially based on patches from Zhenhua Zhangzhenhua.zh...@intel.com
  ---
src/emulator.c |  123 
  
1 files changed, 123 insertions(+), 0 deletions(-)
 
  diff --git a/src/emulator.c b/src/emulator.c
  index 49b129b..f1a079d 100644
  --- a/src/emulator.c
  +++ b/src/emulator.c
  @@ -32,11 +32,18 @@
#include ofono.h
#include common.h
#include gatserver.h
  +#include gatppp.h
  +
  +#define DUN_SERVER_ADDRESS 192.168.1.1
  +#define DUN_PEER_ADDRESS   192.168.1.2
  +#define DUN_DNS_SERVER_1   10.10.10.10
  +#define DUN_DNS_SERVER_2   10.10.10.11
 
struct ofono_emulator {
  struct ofono_modem *modem;
  struct ofono_atom *atom;
  GAtServer *server;
  +   GAtPPP *ppp;
  struct ofono_emulator_driver *driver;
};
 
  @@ -55,10 +62,124 @@ void ofono_emulator_remove(struct ofono_emulator 
  *emulator)
  __ofono_atom_free(emulator-atom);
}
 
  +static void ppp_connect(const char *iface, const char *local,
  +   const char *remote,
  +   const char *dns1, const char *dns2,
  +   gpointer user_data)
  +{
  +   DBG(Network Device: %s\n, iface);
  +   DBG(IP Address: %s\n, local);
  +   DBG(Remote IP Address: %s\n, remote);
  +   DBG(Primary DNS Server: %s\n, dns1);
  +   DBG(Secondary DNS Server: %s\n, dns2);
  +}
  +
  +static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer 
  user_data)
  +{
  +   struct ofono_emulator *e = user_data;
  +
  +   DBG();
  +
  +   g_at_ppp_unref(e-ppp);
  +   e-ppp = NULL;
  +
  +   if (e-server == NULL)
  +   return;
  +
  +   g_at_server_resume(e-server);
  +
  +   g_at_server_send_final(e-server, G_AT_SERVER_RESULT_NO_CARRIER);
  +}
  +
  +static gboolean setup_ppp(gpointer user_data)
  +{
  +   struct ofono_emulator *e = user_data;
  +   GAtServer *server = e-server;
  +   GAtIO *io;
  +
  +   DBG();
  +
  +   io = g_at_server_get_io(server);
  +
  +   g_at_server_suspend(server);
  +
  +   e-ppp = g_at_ppp_server_new_from_io(io, DUN_SERVER_ADDRESS);
  +   if (e-ppp == NULL) {
  +   g_at_server_resume(server);
  +   return FALSE;
  +   }
  +
  +   g_at_ppp_set_server_info(e-ppp, DUN_PEER_ADDRESS,
  +   DUN_DNS_SERVER_1, DUN_DNS_SERVER_2);
  +
  +   g_at_ppp_set_credentials(e-ppp, , );
  +   g_at_ppp_set_debug(e-ppp, ofono_emulator_debug, PPP);
  +
  +   g_at_ppp_set_connect_function(e-ppp, ppp_connect, e);
  +   g_at_ppp_set_disconnect_function(e-ppp, ppp_disconnect, e);
  +
  +   return FALSE;
  +}
  +
  +static gboolean dial_call(struct ofono_emulator *e, const char *dial_str)
  +{
  +   char c = *dial_str;
  +
  +   DBG(dial call %s, dial_str);
  +
  +   if (c == '*' || c == '#' || c == 'T' || c == 't') {
  +
  +   g_at_server_send_intermediate(e-server, CONNECT);
  +   g_idle_add(setup_ppp, e);
  +   }
  +
  +   return TRUE;
  +}
  +
  +static void dial_cb(GAtServerRequestType type, GAtResult *result,
  +   gpointer user_data)
  +{
  +   struct ofono_emulator *e = user_data;
  +   GAtServer *server = e-server;
  +   GAtResultIter iter;
  +   const char *dial_str;
  +
  +   DBG();
  +
  +   if (type != G_AT_SERVER_REQUEST_TYPE_SET)
  +   goto error;
  +
  +   g_at_result_iter_init(iter, result);
  +
  +   if (!g_at_result_iter_next(iter, D))
  +   goto error;
  +
  +   dial_str = g_at_result_iter_raw_line(iter);
  +   if (!dial_str)
  +   goto error;
  +
  +   if (e-ppp)
  +   goto error;
  +
  +   if (!dial_call(e, dial_str))
  +   goto error;
  +
  +   return;
  +
  +error:
  +   g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
  +}
  +
 
 Shouldn't we register a generic dial_cb() and separate it in 2 cases:
  OFONO_ATOM_TYPE_DUN_EMULATOR, we do a dun_dial() that would look 
 like the dial_cb() you have implemented.
  OFONO_ATOM_TYPE_HFP_AG, we do a hfp_dial() e.g. dial a number for a 
 voice call.

Yes, once we have HFP AG support we can do that.

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


[PATCH 1/7] gatchat: Share utility with CDMA network driver

2011-02-08 Thread Dara Spieker-Doyle
---
 gatchat/gatresult.c |   11 ---
 gatchat/gatresult.h |   11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gatchat/gatresult.c b/gatchat/gatresult.c
index 8a6dfae..6bd3ff1 100644
--- a/gatchat/gatresult.c
+++ b/gatchat/gatresult.c
@@ -94,17 +94,6 @@ const char *g_at_result_iter_raw_line(GAtResultIter *iter)
return line;
 }
 
-static inline int skip_to_next_field(const char *line, int pos, int len)
-{
-   if (pos  len  line[pos] == ',')
-   pos += 1;
-
-   while (pos  len  line[pos] == ' ')
-   pos += 1;
-
-   return pos;
-}
-
 gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
const char **str)
 {
diff --git a/gatchat/gatresult.h b/gatchat/gatresult.h
index a74741f..62a2b79 100644
--- a/gatchat/gatresult.h
+++ b/gatchat/gatresult.h
@@ -68,6 +68,17 @@ const char *g_at_result_pdu(GAtResult *result);
 
 gint g_at_result_num_response_lines(GAtResult *result);
 
+static inline int skip_to_next_field(const char *line, int pos, int len)
+{
+   if (pos  len  line[pos] == ',')
+   pos += 1;
+
+   while (pos  len  line[pos] == ' ')
+   pos += 1;
+
+   return pos;
+}
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.0.4

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


[PATCH 0/7] Add CDMA Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
This is a series of patches to provide CDMA Signal Strength support for the 
1xRTT
network. It provides both new atom and driver code.

HW support for testing is implemented in the nokiacdma plugin. This modem does
not support unsolicited notifications for the signal strength via the AT
interface, so this functionality is implemented with polling for the nokiacdma
plugin.

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

Limitations
---

The Nokia 7205 device does not support multiple AT ports, so notification of
network properties (such as the signal strength) is not available while the
port is busy with e.g. data traffic.
Support for handling these scenarios is future work.

Dara Spieker-Doyle (7):
  gatchat: Share utility with CDMA network driver
  dbus: Add CDMA netreg atom support
  cdma-netreg: Add Signal Strength Support
  cdma-netreg: Add Signal Strength Support
  cdmamodem: Add Signal Strength Support
  nokiacdma: Add cdma-netreg Support
  test: Add CDMA Signal Strength Support

 Makefile.am   |   11 +-
 drivers/cdmamodem/cdmamodem.c |2 +
 drivers/cdmamodem/cdmamodem.h |2 +
 drivers/cdmamodem/network-registration.c  |  211 
 gatchat/gatresult.c   |   11 -
 gatchat/gatresult.h   |   11 +
 include/cdma-netreg.h |   77 +++
 include/dbus.h|2 +
 plugins/nokiacdma.c   |4 +
 src/cdma-network.c|  263 +
 src/ofono.h   |2 +
 test/cdma-get-current-network-signal-strength |   21 ++
 12 files changed, 602 insertions(+), 15 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c
 create mode 100644 include/cdma-netreg.h
 create mode 100644 src/cdma-network.c
 create mode 100755 test/cdma-get-current-network-signal-strength

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


[PATCH 2/7] dbus: Add CDMA netreg atom support

2011-02-08 Thread Dara Spieker-Doyle
---
 include/dbus.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/dbus.h b/include/dbus.h
index 19a138a..3e80c36 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -60,6 +60,8 @@ extern C {
 /* CDMA Interfaces */
 #define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE 
org.ofono.cdma.VoiceCallManager
 #define OFONO_CDMA_MESSAGE_MANAGER_INTERFACE org.ofono.cdma.MessageManager
+#define OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE \
+   org.ofono.cdma.NetworkRegistration
 
 /* Essentially a{sv} */
 #define OFONO_PROPERTIES_ARRAY_SIGNATURE DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
-- 
1.7.0.4

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


[PATCH 3/7] cdma-netreg: Add Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am   |2 +-
 include/cdma-netreg.h |   77 +
 2 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100644 include/cdma-netreg.h

diff --git a/Makefile.am b/Makefile.am
index 758fb10..93550d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
include/cdma-sms.h include/sim-auth.h \
-   include/gprs-provision.h
+   include/gprs-provision.h include/cdma-netreg.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h
new file mode 100644
index 000..4472a89
--- /dev/null
+++ b/include/cdma-netreg.h
@@ -0,0 +1,77 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  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_NETREG_H
+#define __OFONO_CDMA_NETREG_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_cdma_netreg;
+
+typedef void (*ofono_cdma_netreg_strength_cb_t)(
+   const struct ofono_error *error,
+   int strength, void *data);
+
+/*
+ * Network related functions, including registration status, operator selection
+ * and signal strength indicators.
+ */
+struct ofono_cdma_netreg_driver {
+   const char *name;
+   int (*probe)(struct ofono_cdma_netreg *netreg, unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_cdma_netreg *netreg);
+   void (*strength)(struct ofono_cdma_netreg *netreg,
+   ofono_cdma_netreg_strength_cb_t, void *data);
+};
+
+/*
+ * It is the plugin's responsibility to implement CSQ polling if the modem
+ * does not support vendor extensions for signal strength notification.
+ */
+void ofono_cdma_netreg_strength_notify(struct ofono_cdma_netreg *netreg,
+   int strength);
+
+int ofono_cdma_netreg_driver_register(
+   const struct ofono_cdma_netreg_driver *d);
+void ofono_cdma_netreg_driver_unregister(
+   const struct ofono_cdma_netreg_driver *d);
+
+struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver,
+   void *data);
+
+void ofono_cdma_netreg_register(struct ofono_cdma_netreg *netreg);
+void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *netreg);
+
+void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *netreg, void *data);
+void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *netreg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_NETREG_H */
-- 
1.7.0.4

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


[PATCH 4/7] cdma-netreg: Add Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am|3 +-
 src/cdma-network.c |  263 
 src/ofono.h|2 +
 3 files changed, 267 insertions(+), 1 deletions(-)
 create mode 100644 src/cdma-network.c

diff --git a/Makefile.am b/Makefile.am
index 93550d0..c245b4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -362,7 +362,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
src/cdma-voicecall.c src/sim-auth.c \
-   src/message.h src/message.c src/gprs-provision.c
+   src/message.h src/message.c src/gprs-provision.c \
+   src/cdma-network.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/cdma-network.c b/src/cdma-network.c
new file mode 100644
index 000..4c03536
--- /dev/null
+++ b/src/cdma-network.c
@@ -0,0 +1,263 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  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 config.h
+#endif
+
+#include string.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+#include simutil.h
+#include util.h
+#include storage.h
+
+static GSList *g_drivers;
+
+struct ofono_cdma_netreg {
+   int signal_strength;
+   const struct ofono_cdma_netreg_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+static DBusMessage *network_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_cdma_netreg *netreg = 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);
+
+   dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+   OFONO_PROPERTIES_ARRAY_SIGNATURE,
+   dict);
+
+   /* TODO: Add Status Property */
+
+   if (netreg-signal_strength != -1) {
+   unsigned char strength = netreg-signal_strength;
+
+   ofono_dbus_dict_append(dict, Strength, DBUS_TYPE_BYTE,
+   strength);
+   }
+
+   /* TODO: Add DataStrength Property */
+
+   /* TODO: Add SystemIdentifier Property */
+
+   /* TODO: Add NetworkIdentifier Property */
+
+   /* TODO: Add MobileCountryCode Property */
+
+   /* TODO: Add MobileNetworkCode Property */
+
+   /* TODO: Add Name Property */
+
+   /* TODO: Add RoamingPreference Property */
+
+   dbus_message_iter_close_container(iter, dict);
+
+   return reply;
+}
+
+static GDBusMethodTable network_registration_methods[] = {
+   { GetProperties,  ,  a{sv},   network_get_properties },
+   { }
+};
+
+static GDBusSignalTable network_registration_signals[] = {
+   { PropertyChanged,sv },
+   { }
+};
+
+static void signal_strength_callback(const struct ofono_error *error,
+   int strength, void *data)
+{
+   struct ofono_cdma_netreg *netreg = data;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Error during signal strength query);
+   return;
+   }
+
+   ofono_cdma_netreg_strength_notify(netreg, strength);
+}
+
+void ofono_cdma_netreg_strength_notify(struct ofono_cdma_netreg *netreg,
+   int strength)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+
+   if (netreg-signal_strength == strength)
+   return;
+
+   netreg-signal_strength = strength;
+
+   if (strength != -1) {
+   const char *path = __ofono_atom_get_path(netreg-atom);
+   unsigned char strength = netreg-signal_strength;
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+   Strength, 

[PATCH 6/7] nokiacdma: Add cdma-netreg Support

2011-02-08 Thread Dara Spieker-Doyle
---
 plugins/nokiacdma.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/nokiacdma.c b/plugins/nokiacdma.c
index 7bd224d..946c1f2 100644
--- a/plugins/nokiacdma.c
+++ b/plugins/nokiacdma.c
@@ -44,6 +44,7 @@
 #include drivers/atmodem/atutil.h
 #include ofono/cdma-voicecall.h
 #include ofono/devinfo.h
+#include ofono/cdma-netreg.h
 
 #include common.h
 
@@ -147,7 +148,10 @@ static void nokiacdma_post_sim(struct ofono_modem *modem)
 
 static void nokiacdma_post_online(struct ofono_modem *modem)
 {
+   struct nokiacdma_data *data = ofono_modem_get_data(modem);
+
DBG(%p, modem);
+   ofono_cdma_netreg_create(modem, 0, cdmamodem, data-chat);
 }
 
 static struct ofono_modem_driver nokiacdma_driver = {
-- 
1.7.0.4

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


[PATCH 5/7] cdmamodem: Add Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am  |3 +-
 drivers/cdmamodem/cdmamodem.c|2 +
 drivers/cdmamodem/cdmamodem.h|2 +
 drivers/cdmamodem/network-registration.c |  211 ++
 4 files changed, 217 insertions(+), 1 deletions(-)
 create mode 100644 drivers/cdmamodem/network-registration.c

diff --git a/Makefile.am b/Makefile.am
index c245b4c..272e28d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -257,7 +257,8 @@ builtin_modules += cdmamodem
 builtin_sources += drivers/cdmamodem/cdmamodem.h \
drivers/cdmamodem/cdmamodem.c \
drivers/cdmamodem/voicecall.c \
-   drivers/cdmamodem/devinfo.c
+   drivers/cdmamodem/devinfo.c \
+   drivers/cdmamodem/network-registration.c
 endif
 
 builtin_modules += g1
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
index 9eddd88..492f1f0 100644
--- a/drivers/cdmamodem/cdmamodem.c
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -36,6 +36,7 @@ static int cdmamodem_init(void)
 {
cdma_voicecall_init();
cdma_devinfo_init();
+   cdma_netreg_init();
 
return 0;
 }
@@ -44,6 +45,7 @@ static void cdmamodem_exit(void)
 {
cdma_voicecall_exit();
cdma_devinfo_exit();
+   cdma_netreg_exit();
 }
 
 OFONO_PLUGIN_DEFINE(cdmamodem, CDMA AT modem driver, VERSION,
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index 4365bec..a1fbf65 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -25,3 +25,5 @@ extern void cdma_voicecall_init(void);
 extern void cdma_voicecall_exit(void);
 extern void cdma_devinfo_init(void);
 extern void cdma_devinfo_exit(void);
+extern void cdma_netreg_init(void);
+extern void cdma_netreg_exit(void);
diff --git a/drivers/cdmamodem/network-registration.c 
b/drivers/cdmamodem/network-registration.c
new file mode 100644
index 000..4135fe1
--- /dev/null
+++ b/drivers/cdmamodem/network-registration.c
@@ -0,0 +1,211 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  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 config.h
+#endif
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/cdma-netreg.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include cdmamodem.h
+
+/* Time interval in seconds between CSQ polls */
+#define CSQ_INTERVAL 5
+
+struct cdma_netreg_data {
+   GAtChat *chat;
+   unsigned int vendor;
+   unsigned int csq_source;
+};
+
+static gboolean cdma_get_next_number(const char *line, gint *number)
+{
+   int pos;
+   int end;
+   int len;
+   int value = 0;
+
+   len = strlen(line);
+
+   pos = 0;
+   end = pos;
+
+   while (line[end] = '0'  line[end] = '9') {
+   value = value * 10 + (int)(line[end] - '0');
+   end += 1;
+   }
+
+   if (pos == end)
+   return FALSE;
+
+   pos = skip_to_next_field(line, end, len);
+
+   if (number)
+   *number = value;
+
+   return TRUE;
+}
+
+static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_cdma_netreg_strength_cb_t cb = cbd-cb;
+   const char *prefix = cbd-user;
+   struct ofono_error error;
+   const char *attr;
+   int strength = -1;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok) {
+   cb(error, -1, cbd-data);
+   return;
+   }
+
+   if (at_util_parse_attr(result, prefix, attr) == FALSE) {
+   CALLBACK_WITH_FAILURE(cb, -1, cbd-data);
+   return;
+   }
+
+   cdma_get_next_number(attr, strength);
+
+   DBG(csq_cb: %d, strength);
+
+   cb(error, at_util_convert_signal_strength(strength), cbd-data);
+}
+
+static void cdma_signal_strength(struct ofono_cdma_netreg *netreg,
+   ofono_cdma_netreg_strength_cb_t cb, void *data)
+{
+   struct cdma_netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   cbd-user = 

[PATCH 7/7] test: Add CDMA Signal Strength Support

2011-02-08 Thread Dara Spieker-Doyle
---
 Makefile.am   |3 ++-
 test/cdma-get-current-network-signal-strength |   21 +
 2 files changed, 23 insertions(+), 1 deletions(-)
 create mode 100755 test/cdma-get-current-network-signal-strength

diff --git a/Makefile.am b/Makefile.am
index 272e28d..d7048f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -481,7 +481,8 @@ test_scripts = test/backtrace \
test/cdma-hangup \
test/disable-call-forwarding \
test/list-messages \
-   test/test-sms
+   test/test-sms \
+   test/cdma-get-current-network-signal-strength
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/cdma-get-current-network-signal-strength 
b/test/cdma-get-current-network-signal-strength
new file mode 100755
index 000..3c2a457
--- /dev/null
+++ b/test/cdma-get-current-network-signal-strength
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import dbus, sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+modems = manager.GetModems()
+path = modems[0][0]
+
+netreg = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.cdma.NetworkRegistration')
+
+properties = netreg.GetProperties()
+
+if properties.has_key('Strength'):
+   print Returned signal strength for current CDMA network is: '%d' %\
+   (properties['Strength'])
+else:
+   print No strength reported with GetProperties
-- 
1.7.0.4

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


[PATCH -v3 1/7] bluetooth: Add bluetooth server support

2011-02-08 Thread Gustavo F. Padovan
From: Frédéric Danis frederic.da...@linux.intel.com

---
 Makefile.am |1 +
 plugins/bluetooth.c |  247 ++-
 plugins/bluetooth.h |9 ++
 3 files changed, 254 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 758fb10..e402de4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,7 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
 builtin_modules += hfp
 builtin_sources += plugins/hfp.c plugins/bluetooth.h
 
+builtin_sources += $(btio_sources)
 builtin_cflags += @BLUEZ_CFLAGS@
 builtin_libadd += @BLUEZ_LIBS@
 endif
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 13f3b3b..d17e056 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -35,12 +35,30 @@
 
 #include ofono/dbus.h
 
+#include btio.h
 #include bluetooth.h
 
 static DBusConnection *connection;
 static GHashTable *uuid_hash = NULL;
 static GHashTable *adapter_address_hash = NULL;
 static gint bluetooth_refcount;
+static GSList *server_list = NULL;
+
+struct server {
+   guint8 channel;
+   char *sdp_record;
+   GIOChannel *io;
+   GHashTable *adapter_hash;
+   ConnectFunc connect_cb;
+   gpointer user_data;
+   GSList *client_list;
+};
+
+struct cb_data {
+   struct server *server;
+   char *path;
+   guint source;
+};
 
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
char *buf, int size)
@@ -417,6 +435,166 @@ static void get_adapter_properties(const char *path, 
const char *handle,
g_strdup(path), g_free, -1, DBUS_TYPE_INVALID);
 }
 
+static void remove_record(char *path, guint handle, struct server *server)
+{
+   DBusMessage *msg;
+
+   msg = dbus_message_new_method_call(BLUEZ_SERVICE, path,
+   BLUEZ_SERVICE_INTERFACE,
+   RemoveRecord);
+   if (msg == NULL) {
+   ofono_error(Unable to allocate D-Bus RemoveRecord message);
+   return;
+   }
+
+   dbus_message_append_args(msg, DBUS_TYPE_UINT32, handle,
+   DBUS_TYPE_INVALID);
+   g_dbus_send_message(connection, msg);
+
+   ofono_info(Unregistered handle for %s, channel %d: 0x%x, path,
+   server-channel, handle);
+}
+
+static void server_stop(struct server *server)
+{
+   /* Remove all client sources related to server */
+   while (server-client_list) {
+   g_source_remove(GPOINTER_TO_UINT(server-client_list-data));
+   server-client_list = g_slist_remove(server-client_list,
+   server-client_list-data);
+   }
+
+   g_hash_table_foreach_remove(server-adapter_hash,
+   (GHRFunc) remove_record, server);
+
+   if (server-io != NULL) {
+   g_io_channel_shutdown(server-io, TRUE, NULL);
+   g_io_channel_unref(server-io);
+   server-io = NULL;
+   }
+}
+
+static void cb_data_destroy(gpointer data)
+{
+   struct cb_data *cb_data = data;
+
+   if (cb_data-path != NULL)
+   g_free(cb_data-path);
+   g_free(cb_data);
+}
+
+static gboolean client_event(GIOChannel *chan, GIOCondition cond, gpointer 
data)
+{
+   struct cb_data *cb_data = data;
+   struct server *server = cb_data-server;
+
+   server-client_list = g_slist_remove(server-client_list,
+   GUINT_TO_POINTER(cb_data-source));
+
+   cb_data_destroy(cb_data);
+
+   return FALSE;
+}
+
+static void new_connection(GIOChannel *io, gpointer user_data)
+{
+   struct server *server = user_data;
+   struct cb_data *client_data;
+   GError *err = NULL;
+   char laddress[18], raddress[18];
+   guint8 channel;
+
+   bt_io_get(io, BT_IO_RFCOMM, err, BT_IO_OPT_SOURCE, laddress,
+   BT_IO_OPT_DEST, raddress,
+   BT_IO_OPT_CHANNEL, channel,
+   BT_IO_OPT_INVALID);
+   if (err) {
+   ofono_error(%s, err-message);
+   g_error_free(err);
+   return;
+   }
+
+   ofono_info(New connection for %s on channel %u from: %s,, laddress,
+   channel, raddress);
+
+   if (!bt_io_accept(io, server-connect_cb, server-user_data,
+   NULL, err)) {
+   ofono_error(%s, err-message);
+   g_error_free(err);
+   g_io_channel_unref(io);
+   return;
+   }
+
+   client_data = g_try_new0(struct cb_data, 1);
+   if (client_data == NULL) {
+   ofono_error(Unable to allocate client cb_data structure);
+   return;
+   }
+
+   client_data-server = server;
+   

[PATCH -v3 2/7] bluetooth: Add Bluetooth service authorization support

2011-02-08 Thread Gustavo F. Padovan
From: Frédéric Danis frederic.da...@linux.intel.com

---
 plugins/bluetooth.c |  125 ++
 1 files changed, 115 insertions(+), 10 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index d17e056..7edf4a7 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -44,6 +44,8 @@ static GHashTable *adapter_address_hash = NULL;
 static gint bluetooth_refcount;
 static GSList *server_list = NULL;
 
+#define TIMEOUT 60 /* Timeout for user response (seconds) */
+
 struct server {
guint8 channel;
char *sdp_record;
@@ -58,6 +60,8 @@ struct cb_data {
struct server *server;
char *path;
guint source;
+   GIOChannel *io;
+   gboolean pending_auth;
 };
 
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
@@ -483,26 +487,104 @@ static void cb_data_destroy(gpointer data)
g_free(cb_data);
 }
 
+static void cancel_authorization(struct cb_data *user_data)
+{
+   DBusMessage *msg;
+
+   if (user_data-path == NULL)
+   return;
+
+   msg = dbus_message_new_method_call(BLUEZ_SERVICE, user_data-path,
+   BLUEZ_SERVICE_INTERFACE,
+   CancelAuthorization);
+
+   if (msg == NULL) {
+   ofono_error(Unable to allocate D-Bus CancelAuthorization
+message);
+   return;
+   }
+
+   g_dbus_send_message(connection, msg);
+}
+
 static gboolean client_event(GIOChannel *chan, GIOCondition cond, gpointer 
data)
 {
struct cb_data *cb_data = data;
struct server *server = cb_data-server;
 
+   if (cb_data-pending_auth == TRUE) {
+   cancel_authorization(cb_data);
+
+   cb_data-pending_auth = FALSE;
+   } else {
+
+   server-client_list = g_slist_remove(server-client_list,
+   GUINT_TO_POINTER(cb_data-source));
+   cb_data_destroy(cb_data);
+   }
+
+   return FALSE;
+}
+
+static void auth_cb(DBusPendingCall *call, gpointer user_data)
+{
+   struct cb_data *cb_data = user_data;
+   struct server *server = cb_data-server;
+   DBusMessage *reply = dbus_pending_call_steal_reply(call);
+   DBusError derr;
+   GError *err = NULL;
+
+   dbus_error_init(derr);
+
+   cb_data-pending_auth = FALSE;
+
+   if (dbus_set_error_from_message(derr, reply)) {
+   ofono_error(RequestAuthorization error: %s, %s,
+   derr.name, derr.message);
+
+   if (dbus_error_has_name(derr, DBUS_ERROR_NO_REPLY))
+   cancel_authorization(cb_data);
+
+   dbus_error_free(derr);
+
+   dbus_message_unref(reply);
+
+   goto failed;
+   }
+
+   dbus_message_unref(reply);
+
+   ofono_info(RequestAuthorization succeeded);
+
+   if (!bt_io_accept(cb_data-io, server-connect_cb, server-user_data,
+   NULL, err)) {
+   ofono_error(%s, err-message);
+   g_error_free(err);
+   goto failed;
+   }
+
+   return;
+
+failed:
+   g_source_remove(cb_data-source);
server-client_list = g_slist_remove(server-client_list,
GUINT_TO_POINTER(cb_data-source));
 
cb_data_destroy(cb_data);
-
-   return FALSE;
 }
 
 static void new_connection(GIOChannel *io, gpointer user_data)
 {
struct server *server = user_data;
struct cb_data *client_data;
+   guint handle;
+   const char *addr;
+   int ret;
GError *err = NULL;
char laddress[18], raddress[18];
guint8 channel;
+   GHashTableIter iter;
+   gpointer key, value;
 
bt_io_get(io, BT_IO_RFCOMM, err, BT_IO_OPT_SOURCE, laddress,
BT_IO_OPT_DEST, raddress,
@@ -517,14 +599,6 @@ static void new_connection(GIOChannel *io, gpointer 
user_data)
ofono_info(New connection for %s on channel %u from: %s,, laddress,
channel, raddress);
 
-   if (!bt_io_accept(io, server-connect_cb, server-user_data,
-   NULL, err)) {
-   ofono_error(%s, err-message);
-   g_error_free(err);
-   g_io_channel_unref(io);
-   return;
-   }
-
client_data = g_try_new0(struct cb_data, 1);
if (client_data == NULL) {
ofono_error(Unable to allocate client cb_data structure);
@@ -532,11 +606,42 @@ static void new_connection(GIOChannel *io, gpointer 
user_data)
}
 
client_data-server = server;
+
+   g_hash_table_iter_init(iter, adapter_address_hash);
+
+   while (g_hash_table_iter_next(iter, key, value)) {
+   if (g_strcmp0(laddress, 

[PATCH -v3 3/7] include: add public headed to emulator atom

2011-02-08 Thread Gustavo F. Padovan
---
 include/emulator.h |   55 
 1 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 include/emulator.h

diff --git a/include/emulator.h b/include/emulator.h
new file mode 100644
index 000..1287b47
--- /dev/null
+++ b/include/emulator.h
@@ -0,0 +1,55 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_EMULATOR_H
+#define __OFONO_EMULATOR_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_emulator;
+
+struct ofono_emulator_driver {
+   const char *name;
+   enum ofono_atom_type type;
+   int (*probe)(struct ofono_emulator *emulator,
+   struct ofono_modem *modem);
+   void (*remove)();
+};
+
+int ofono_emulator_enable(struct ofono_emulator *emulator, int fd);
+void ofono_emulator_disable(struct ofono_emulator *emulator);
+void ofono_emulator_remove(struct ofono_emulator *emulator);
+struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
+   struct ofono_emulator_driver *driver);
+
+int ofono_emulator_driver_register(const struct ofono_emulator_driver *driver);
+void ofono_emulator_driver_unregister(
+   const struct ofono_emulator_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_EMULATOR_H */
-- 
1.7.4

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


[PATCH -v3 4/7] emulator: Add emulator atom in oFono

2011-02-08 Thread Gustavo F. Padovan
Create emulator atom when modem state changes to online. The emulator
driver probes each driver to create specific emulator like DUN, HFP AG,
etc. Once get client connection request, create GAtServer to talk AT
commands with client side.

Based on a patch from Zhenhua Zhang zhenhua.zh...@intel.com
---
 Makefile.am|5 +-
 include/emulator.h |6 +-
 src/emulator.c |  173 
 src/ofono.h|5 ++
 4 files changed, 183 insertions(+), 6 deletions(-)
 create mode 100644 src/emulator.c

diff --git a/Makefile.am b/Makefile.am
index e402de4..047a85f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
include/cdma-sms.h include/sim-auth.h \
-   include/gprs-provision.h
+   include/gprs-provision.h include/emulator.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
@@ -363,7 +363,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
src/cdma-voicecall.c src/sim-auth.c \
-   src/message.h src/message.c src/gprs-provision.c
+   src/message.h src/message.c src/gprs-provision.c \
+   src/emulator.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/include/emulator.h b/include/emulator.h
index 1287b47..2de2069 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -33,13 +33,11 @@ struct ofono_emulator;
 struct ofono_emulator_driver {
const char *name;
enum ofono_atom_type type;
-   int (*probe)(struct ofono_emulator *emulator,
-   struct ofono_modem *modem);
-   void (*remove)();
+   int (*probe)(struct ofono_emulator *emulator);
+   void (*remove)(void);
 };
 
 int ofono_emulator_enable(struct ofono_emulator *emulator, int fd);
-void ofono_emulator_disable(struct ofono_emulator *emulator);
 void ofono_emulator_remove(struct ofono_emulator *emulator);
 struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
struct ofono_emulator_driver *driver);
diff --git a/src/emulator.c b/src/emulator.c
new file mode 100644
index 000..49b129b
--- /dev/null
+++ b/src/emulator.c
@@ -0,0 +1,173 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include stdio.h
+#include string.h
+#include errno.h
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+#include common.h
+#include gatserver.h
+
+struct ofono_emulator {
+   struct ofono_modem *modem;
+   struct ofono_atom *atom;
+   GAtServer *server;
+   struct ofono_emulator_driver *driver;
+};
+
+static GSList *emulator_drivers = NULL;
+
+static void ofono_emulator_debug(const char *str, void *data)
+{
+   g_print(%s: %s\n, (char *)data, str);
+}
+
+void ofono_emulator_remove(struct ofono_emulator *emulator)
+{
+   if (emulator == NULL)
+   return;
+
+   __ofono_atom_free(emulator-atom);
+}
+
+static void emulator_disable(struct ofono_emulator *e)
+{
+   DBG();
+
+   g_at_server_shutdown(e-server);
+   g_at_server_unref(e-server);
+   e-server = NULL;
+}
+
+static void emulator_disconnect_cb(gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   if (e == NULL)
+   return;
+
+   emulator_disable(e);
+}
+
+int ofono_emulator_enable(struct ofono_emulator *e, int fd)
+{
+   GIOChannel *io;
+
+   if (fd  0)
+   return -EIO;
+
+   io = g_io_channel_unix_new(fd);
+
+   e-server = g_at_server_new(io);
+   if (!e-server) {
+   g_free(e);
+   return -ENOMEM;
+   }
+
+   g_at_server_set_debug(e-server, ofono_emulator_debug, Server);
+   g_at_server_set_disconnect_function(e-server,
+  

[PATCH -v3 6/7] emulator: Implement dialing up for DUN

2011-02-08 Thread Gustavo F. Padovan
It handles client ATD*99# request and then initiate the PPP negotiation.
IP forward through the new ppp interface is not done yet.

Initially based on patches from Zhenhua Zhang zhenhua.zh...@intel.com
---
 src/emulator.c |  123 
 1 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 49b129b..f1a079d 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -32,11 +32,18 @@
 #include ofono.h
 #include common.h
 #include gatserver.h
+#include gatppp.h
+
+#define DUN_SERVER_ADDRESS 192.168.1.1
+#define DUN_PEER_ADDRESS   192.168.1.2
+#define DUN_DNS_SERVER_1   10.10.10.10
+#define DUN_DNS_SERVER_2   10.10.10.11
 
 struct ofono_emulator {
struct ofono_modem *modem;
struct ofono_atom *atom;
GAtServer *server;
+   GAtPPP *ppp;
struct ofono_emulator_driver *driver;
 };
 
@@ -55,10 +62,124 @@ void ofono_emulator_remove(struct ofono_emulator *emulator)
__ofono_atom_free(emulator-atom);
 }
 
+static void ppp_connect(const char *iface, const char *local,
+   const char *remote,
+   const char *dns1, const char *dns2,
+   gpointer user_data)
+{
+   DBG(Network Device: %s\n, iface);
+   DBG(IP Address: %s\n, local);
+   DBG(Remote IP Address: %s\n, remote);
+   DBG(Primary DNS Server: %s\n, dns1);
+   DBG(Secondary DNS Server: %s\n, dns2);
+}
+
+static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   DBG();
+
+   g_at_ppp_unref(e-ppp);
+   e-ppp = NULL;
+
+   if (e-server == NULL)
+   return;
+
+   g_at_server_resume(e-server);
+
+   g_at_server_send_final(e-server, G_AT_SERVER_RESULT_NO_CARRIER);
+}
+
+static gboolean setup_ppp(gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = e-server;
+   GAtIO *io;
+
+   DBG();
+
+   io = g_at_server_get_io(server);
+
+   g_at_server_suspend(server);
+
+   e-ppp = g_at_ppp_server_new_from_io(io, DUN_SERVER_ADDRESS);
+   if (e-ppp == NULL) {
+   g_at_server_resume(server);
+   return FALSE;
+   }
+
+   g_at_ppp_set_server_info(e-ppp, DUN_PEER_ADDRESS,
+   DUN_DNS_SERVER_1, DUN_DNS_SERVER_2);
+
+   g_at_ppp_set_credentials(e-ppp, , );
+   g_at_ppp_set_debug(e-ppp, ofono_emulator_debug, PPP);
+
+   g_at_ppp_set_connect_function(e-ppp, ppp_connect, e);
+   g_at_ppp_set_disconnect_function(e-ppp, ppp_disconnect, e);
+
+   return FALSE;
+}
+
+static gboolean dial_call(struct ofono_emulator *e, const char *dial_str)
+{
+   char c = *dial_str;
+
+   DBG(dial call %s, dial_str);
+
+   if (c == '*' || c == '#' || c == 'T' || c == 't') {
+
+   g_at_server_send_intermediate(e-server, CONNECT);
+   g_idle_add(setup_ppp, e);
+   }
+
+   return TRUE;
+}
+
+static void dial_cb(GAtServerRequestType type, GAtResult *result,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = e-server;
+   GAtResultIter iter;
+   const char *dial_str;
+
+   DBG();
+
+   if (type != G_AT_SERVER_REQUEST_TYPE_SET)
+   goto error;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, D))
+   goto error;
+
+   dial_str = g_at_result_iter_raw_line(iter);
+   if (!dial_str)
+   goto error;
+
+   if (e-ppp)
+   goto error;
+
+   if (!dial_call(e, dial_str))
+   goto error;
+
+   return;
+
+error:
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+}
+
 static void emulator_disable(struct ofono_emulator *e)
 {
DBG();
 
+   if (e-ppp) {
+   g_at_ppp_shutdown(e-ppp);
+   g_at_ppp_unref(e-ppp);
+   e-ppp = NULL;
+   }
+
g_at_server_shutdown(e-server);
g_at_server_unref(e-server);
e-server = NULL;
@@ -93,6 +214,8 @@ int ofono_emulator_enable(struct ofono_emulator *e, int fd)
g_at_server_set_disconnect_function(e-server,
emulator_disconnect_cb, e);
 
+   g_at_server_register(e-server, D, dial_cb, e, NULL);
+
return 0;
 }
 
-- 
1.7.4

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


[PATCH] TODO: minor style fix

2011-02-08 Thread Dara Spieker-Doyle
Bad caps

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

diff --git a/TODO b/TODO
index 13a6baa..9bd21d6 100644
--- a/TODO
+++ b/TODO
@@ -590,7 +590,7 @@ CDMA CMAS
   Priority: Medium
   Complexity: C4
 
-CDMA NETWORK ACQUISITION
+CDMA Network Acquisition
 
 
 - Support reporting of the received signal strength indicator (RSSI)
-- 
1.7.0.4

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


[PATCH -v3 7/7] gsmdial: add option for Bluetooth DUN dialing

2011-02-08 Thread Gustavo F. Padovan
---
 gatchat/gsmdial.c |   17 ++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 1be80e3..d54a26e 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -56,6 +56,7 @@ static gboolean option_legacy = FALSE;
 static gchar *option_username = NULL;
 static gchar *option_password = NULL;
 static gchar *option_pppdump = NULL;
+static gboolean option_bluetooth = 0;
 
 static GAtPPP *ppp;
 static GAtChat *control;
@@ -266,6 +267,9 @@ static void no_carrier_notify(GAtResult *result, gpointer 
user_data)
 {
char buf[64];
 
+   if (option_bluetooth)
+   return;
+
sprintf(buf, AT+CFUN=%u, option_offmode);
g_at_chat_send(control, buf, none_prefix, power_down, NULL, NULL);
 }
@@ -612,6 +616,8 @@ static GOptionEntry options[] = {
Specify CFUN offmode },
{ legacy, 'l', 0, G_OPTION_ARG_NONE, option_legacy,
Use ATD*99***cid# },
+   { bluetooth, 'b', 0, G_OPTION_ARG_NONE, option_bluetooth,
+   Use only ATD*99 },
{ username, 'u', 0, G_OPTION_ARG_STRING, option_username,
Specify PPP username },
{ password, 'w', 0, G_OPTION_ARG_STRING, option_password,
@@ -700,9 +706,14 @@ int main(int argc, char **argv)
 
event_loop = g_main_loop_new(NULL, FALSE);
 
-   g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
-   g_at_chat_send(control, AT+CFUN?, cfun_prefix,
-   check_mode, NULL, NULL);
+   if (option_bluetooth) {
+   g_at_chat_send(control, ATD*99, none_prefix, connect_cb,
+   NULL, NULL);
+   } else {
+   g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
+   g_at_chat_send(control, AT+CFUN?, cfun_prefix,
+   check_mode, NULL, NULL);
+   }
 
g_main_loop_run(event_loop);
g_source_remove(signal_source);
-- 
1.7.4

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


[PATCH v1] ifx: Selftest at command syntax fix to support latest fw

2011-02-08 Thread anandx . ramakrishna
From: Anand Ramakrishna anandx.ramakris...@intel.com

It is a fix to support the selftest at command syntax changed in latest 
IFX fw version

---
 plugins/ifx.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/ifx.c b/plugins/ifx.c
index 2a95720..a41fc36 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -573,7 +573,7 @@ static void rtc_gti_selftest_cb(gboolean ok, GAtResult 
*result,
if (ok)
return;
 
-   ofono_error(at@rtc:rtc_gti_test_verify_32khz()-FAILED);
+   ofono_error(at@rtc_drv:rtc_gti_test_verify_32khz()-FAILED);
 
if (data-mux_init_timeout  0) {
g_source_remove(data-mux_init_timeout);
@@ -643,7 +643,7 @@ static int ifx_enable(struct ofono_modem *modem)
NULL, NULL, NULL);
 
/* Execute modem self tests */
-   g_at_chat_send(chat, at@rtc:rtc_gti_test_verify_32khz(), NULL,
+   g_at_chat_send(chat, at@rtc_drv:rtc_gti_test_verify_32khz(), NULL,
rtc_gti_selftest_cb, modem, NULL);
 
g_at_chat_send(chat, at@vers:device_version_id(), NULL,
-- 
1.7.2.3

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


Re: [PATCH v1] ifx: Selftest at command syntax fix to support latest fw

2011-02-08 Thread Marcel Holtmann
Hi Anand,

 It is a fix to support the selftest at command syntax changed in latest 
 IFX fw version
 
 ---
  plugins/ifx.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/plugins/ifx.c b/plugins/ifx.c
 index 2a95720..a41fc36 100644
 --- a/plugins/ifx.c
 +++ b/plugins/ifx.c
 @@ -573,7 +573,7 @@ static void rtc_gti_selftest_cb(gboolean ok, GAtResult 
 *result,
   if (ok)
   return;
  
 - ofono_error(at@rtc:rtc_gti_test_verify_32khz()-FAILED);
 + ofono_error(at@rtc_drv:rtc_gti_test_verify_32khz()-FAILED);

so I did apply this patch now, but I am really unhappy with this. Since
this clearly relies on internal naming of IFX firmware internal driver
and function names. That is not a good idea.

We need an IFX based abstraction like AT+XSELFTEST or similar for this.
Otherwise the concept of a generic IFX driver will not work out long
term.

Regards

Marcel


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


Re: [PATCH] TODO: minor style fix

2011-02-08 Thread Denis Kenzior
Hi Dara,

On 02/08/2011 04:10 PM, Dara Spieker-Doyle wrote:
 Bad caps
 
 ---
  TODO |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: [PATCH -v3 1/7] bluetooth: Add bluetooth server support

2011-02-08 Thread Denis Kenzior
Hi Gustavo,

On 02/08/2011 04:00 PM, Gustavo F. Padovan wrote:
 From: Frédéric Danis frederic.da...@linux.intel.com
 
 ---
  Makefile.am |1 +
  plugins/bluetooth.c |  247 
 ++-
  plugins/bluetooth.h |9 ++
  3 files changed, 254 insertions(+), 3 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH -v3 2/7] bluetooth: Add Bluetooth service authorization support

2011-02-08 Thread Denis Kenzior
Hi Gustavo,

This patch has been applied, but I refactored it heavily afterwards.
Can you make sure I didn't screw anything up?

Thanks,
-Denis

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


Re: [PATCH -v3 7/7] gsmdial: add option for Bluetooth DUN dialing

2011-02-08 Thread Denis Kenzior
Hi Gustavo,

On 02/08/2011 04:01 PM, Gustavo F. Padovan wrote:
 ---
  gatchat/gsmdial.c |   17 ++---
  1 files changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
 index 1be80e3..d54a26e 100644
 --- a/gatchat/gsmdial.c
 +++ b/gatchat/gsmdial.c
 @@ -56,6 +56,7 @@ static gboolean option_legacy = FALSE;
  static gchar *option_username = NULL;
  static gchar *option_password = NULL;
  static gchar *option_pppdump = NULL;
 +static gboolean option_bluetooth = 0;
  
  static GAtPPP *ppp;
  static GAtChat *control;
 @@ -266,6 +267,9 @@ static void no_carrier_notify(GAtResult *result, gpointer 
 user_data)
  {
   char buf[64];
  
 + if (option_bluetooth)
 + return;
 +

Should the return be quit_eventloop by any chance?

   sprintf(buf, AT+CFUN=%u, option_offmode);
   g_at_chat_send(control, buf, none_prefix, power_down, NULL, NULL);
  }
 @@ -612,6 +616,8 @@ static GOptionEntry options[] = {
   Specify CFUN offmode },
   { legacy, 'l', 0, G_OPTION_ARG_NONE, option_legacy,
   Use ATD*99***cid# },
 + { bluetooth, 'b', 0, G_OPTION_ARG_NONE, option_bluetooth,
 + Use only ATD*99 },
   { username, 'u', 0, G_OPTION_ARG_STRING, option_username,
   Specify PPP username },
   { password, 'w', 0, G_OPTION_ARG_STRING, option_password,
 @@ -700,9 +706,14 @@ int main(int argc, char **argv)
  
   event_loop = g_main_loop_new(NULL, FALSE);
  
 - g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
 - g_at_chat_send(control, AT+CFUN?, cfun_prefix,
 - check_mode, NULL, NULL);
 + if (option_bluetooth) {
 + g_at_chat_send(control, ATD*99, none_prefix, connect_cb,
 + NULL, NULL);
 + } else {
 + g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
 + g_at_chat_send(control, AT+CFUN?, cfun_prefix,
 + check_mode, NULL, NULL);
 + }
  
   g_main_loop_run(event_loop);
   g_source_remove(signal_source);

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


Re: [PATCH 0/3] gprs-provision: Add SPN to provision API

2011-02-08 Thread Denis Kenzior
Hi Jukka,

On 02/08/2011 04:03 AM, Jukka Saunamaki wrote:
 Hello
 
 This patchset adds Service Provider Name (SPN) into GPRS context provisioning 
 API.
 SPN is read (asynchronously) in the middle of gprs atom registration, if 
 provisioning is needed.
 
 --Jukka
 
 Jukka Saunamaki (3):
   gprs-provision: add SPN to provisioning API header
   gprs,gprs-provision: add SPN to provisioning API
   gprs-provision: update example with SPN
 
  examples/provision.c |8 +++--
  include/gprs-provision.h |2 +-
  src/gprs-provision.c |4 +-
  src/gprs.c   |   87 ++---
  src/ofono.h  |2 +-
  5 files changed, 74 insertions(+), 29 deletions(-)

All patches in this series have been applied, however I made one small
fix after patch 2.  Let me know if I broke anything by any chance.

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


Re: [PATCH 2/5 v3] Cell-info: Header file for Neighbor cell info

2011-02-08 Thread Antti Paila
Hi Marcel,

On Mon, 2011-02-07 at 11:30 -0800, ext Marcel Holtmann wrote:
 Hi Antti,
 
  +#define OFONO_CI_FIELD_TA_UNDEFINED 0xFF
  +#define OFONO_CI_FIELD_UCID_UNDEFINED 0x
  +#define OFONO_CI_FIELD_ECN0_UNDEFINED 0xFF
  +#define OFONO_CI_FIELD_RSCP_UNDEFINED -127
  +#define OFONO_CI_FIELD_PATHLOSS_UNDEFINED 0xFF
  +#define OFONO_CI_FIELD_FREQ_UNDEFINED 0x
  +
  +#define OFONO_MAX_NMR_COUNT 15
  +#define OFONO_MAX_MEASURED_CELL_COUNT 32
  +#define OFONO_MAX_MEAS_RES_LIST_COUNT 8
  +
  +enum ofono_cell_type {
  +   OFONO_CELL_TYPE_GERAN,
  +   OFONO_CELL_TYPE_UTRAN_FDD
  +};
 
 anything we have to keep in mind for LTE here? Or does LTE not matter
 for neighbor cell info?

Neighbor cell info does matter for LTE. I quickly browsed through the
OMA spec and it seems that eutra follows the same format as geran and
utran. Have not had time to get the details yet.

Best Regards,
  Antti

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


Re: [RFCv2] doc: Proposal for LTE/IMS API

2011-02-08 Thread Rémi Denis-Courmont
On Tuesday 08 February 2011 18:22:43 ext Sjur Brændeland, you wrote:
   + boolean PreConditionCheck(string Type, string
   PeerAddress, + uint16 PeerPort,
uint16 LocalPort) +
  
  That stuff is per context. Should it not be in the context object rather
  than in the IMS manager?
 
 oFono should only consider QoS information from the IMS
 Default and Dedicated bearers when checking the precondition.
 
 In theory there might be more than one IMS APN for a operator,
 but I really don't see this as a real life scenario for this.
 If anyone disagrees please speak out and explain...

Well, I don't care if it is part of the normal context interface, or if it is 
an extra IMS-specific interface on the IMS context object path. But this is 
clearly a per-context thing so it should be in the context.

I don't want to end up in a 'woops' situation down the line. And I don't trust 
operators not to actually implement those useless in real life scenarii...

   + array{string} PcscfAddresses [readonly]
  
  Should this be in the context object? The AT command is per CID. Would it
  make any sense for a network to have different P-CSCF based on the
  bearer?
 
 As mentioned above, I don't see why an operator would ever have more than
 one IMS APN. If we only have one IMS APN, then we might as well present
 this information here in the IMS API.

How do you cope with two connections to the same APN?

-- 
Rémi Denis-Courmont
Nokia Devices RD, Maemo Software, Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 5/5 v3] Cell-info: Documentation

2011-02-08 Thread Antti Paila
Hi Marcel,

On Mon, 2011-02-07 at 11:24 -0800, ext Marcel Holtmann wrote:
 Hi Antti,
 
   doc/cell-info.txt |  121 
  +
   1 files changed, 121 insertions(+), 0 deletions(-)
   create mode 100644 doc/cell-info.txt
  
  diff --git a/doc/cell-info.txt b/doc/cell-info.txt
  new file mode 100644
  index 000..64d9db6
  --- /dev/null
  +++ b/doc/cell-info.txt
  @@ -0,0 +1,121 @@
  +Cell Info hierarchy
  +===
  +
  +Serviceorg.ofono
  +Interface  org.ofono.CellInfo
  +Object path[variable prefix]/{modem0,modem1,...}
  +
  +Methodsaa{sv} GetNeighbors()
  +
  +   Calling this procedure returns properties of serving
  +   and neighboring cells in GSM or WCDMA networks. This
  +   information can be used to determine current location
  +   using triangulation over neighboring cell tower
  +   locations and estimated distances.
  +
  +   The returned array consists of two parts: 1) first
  +   element of the array contains a dictionary of
  +   common information about network and serving cell 2)
  +   rest of the array comprises dictionaries containing
  +   measurement results of neighboring cells. The contents
  +   of the dictionaries follow the specification
  +   OMA-TS-ULP-V2_0-20100816-C for user plane Location and
  +   is described in properties section.
 
 I am having a little bit of a problem calling this GetNeighbors and then
 also retrieving the serving cell at the same time.
 
 I am just spinning some idea here, but maybe calling the interface
 org.ofono.NeighborCellInfo and the method AquireMeasurment() would be
 better.

Sounds better to me also.

  +   Possible errors: org.ofono.Error.Failed
  +
  +Properties
  +
  +Serving cell
  +   string Type
  +   Radio access network type of neighbor cell information.
  +   The possible values are:
  +   geran Measurement results are for the GSM EDGE Radio
  +   Access Network.
  +   utran Measurement results are for UMTS Radio Access
  +   Network.
  +
  +   string MobileCountryCode
  +   Mobile Country Code of serving cell. Possible values:
  +   Values: 0...999
  +
  +   string MobileNetworkCode
  +   Mobile Network Code of serving cell.
  +   Values: 0...999
  +
  +   uint16 LocationAreaCode [GERAN]
  +   Location area code of serving cell.
  +   Values: 0...65535
  +
  +   uint16 CellId [GERAN]
  +   Cell Id of serving cell.
  +   Values: 0...65535
  +
  +   byte TimingAdvance [GERAN, optional]
  +   Timing advance.
  +   Values: 0...63
  +
  +   uint32 UniqueCellId [UTRA-FDD]
  +   Serving WCDMA unique cell ID.
  +   Values: 0...268435455
  +
  +   uint16 ScramblingCode [UTRA-FDD]
  +   Primary scrambling code.
  +   Values: 0...511
  +
  +   uint16 UARFCN-DL [UTRA-FDD]
  +   Downlink UTRA Absolute Radio Frequency Channel Number
  +   of serving cell.
  +   Values: 0...16383
 
 Do we wanna keep the UARFCN acronym?
 
  +   uint16 UARFCN-UL [UTRA-FDD, optional]
  +   Uplink UTRA Absolute Radio Frequency Channel Number.
  +   Values: 0...16383
 
 I am still going forth and back if it is a good idea to make cell[0]
 special as the serving cell. There are common fields, but also other
 fields that are totally different.
 
 So one question that came to my mind is how this mixes when the serving
 cell is UMTS, can the neighbors cells also report GSM? Do we have a mix
 of values in the dictionary anyway?

At the moment the dictionary can contain only geran or utran cells but
not both at the same time. Having thought this over, it might be
reasonable to allow the dictionary contain also mixed entries. I don't
know if it is technically possible at the moment to measure different
radio technologies but we might not want to limit this possibility on
the API level.

  +Neighbor cell measurement results
  +
  +   uint16 AbsoluteRadioFrequencyChannelNumber [GERAN]
  +   Absolute radio frequency channel number.
  +   Values: 0...1023
  +
  +   byte BaseStationIdentityCode [GERAN]
  +   Base station identity code.
  +   Values: 0...63.
  +
  +   byte RXLEV [GERAN]
  +   Measured power of the channel.
  +   Values: 0...63
 
 I think we can find something