[PATCH 3/4] isimodem: revector GPRS context driver

2010-11-10 Thread Mika Liljeberg
---
 drivers/isimodem/gprs-context.c |  280 +--
 1 files changed, 121 insertions(+), 159 deletions(-)

diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
index 47e858a..62f7ac2 100644
--- a/drivers/isimodem/gprs-context.c
+++ b/drivers/isimodem/gprs-context.c
@@ -50,22 +50,20 @@
 #include debug.h
 
 #define STATIC_IP_NETMASK 255.255.255.255
+#define ACTIVATE_TIMEOUT   (6 * 30)/* 6 * T3380 */
+#define DEACTIVATE_TIMEOUT (6 * 8) /* 6 * T3390 */
 
 #define INVALID_ID (0xff)
 # if (INVALID_ID  GPDS_MAX_CONTEXT_COUNT)
 #   error Uho! This should not happen!
 #endif
 
-struct gprs_context_data {
+struct context_data {
GIsiClient *client;
GIsiModem *idx;
uint16_t gpds;  /* GPDS object handle */
-   GSList *contexts;
-};
-
-struct context_data {
unsigned cid;   /* oFono core context ID */
-   struct ofono_gprs_context *driver;
+   struct ofono_gprs_context *context;
union {
ofono_gprs_context_up_cb_t up_cb;
ofono_gprs_context_cb_t down_cb;
@@ -74,6 +72,8 @@ struct context_data {
 
GIsiPEP *pep;
GIsiPipe *pipe;
+   guint activate_timeout;
+   guint deactivate_timeout;
 
char apn[GPDS_MAX_APN_STRING_LENGTH + 1];
char username[GPDS_MAX_USERNAME_LENGTH + 1];
@@ -83,40 +83,24 @@ struct context_data {
uint8_t type;
 };
 
-static struct context_data *find_context_by_cid(GSList *contexts,
-   unsigned int cid)
-{
-   GSList *m = NULL;
-
-   for (m = contexts; m; m = m-next) {
-   struct context_data *cd = m-data;
-
-   if (cd-cid == cid)
-   return cd;
-   }
-   return NULL;
-}
-
-static struct context_data *find_context_by_handle(GSList *contexts,
-   uint8_t handle)
-{
-   GSList *m = NULL;
-
-   for (m = contexts; m; m = m-next) {
-   struct context_data *cd = m-data;
-
-   if (cd-handle == handle)
-   return cd;
-   }
-   return NULL;
-}
-
-static void destroy_context(struct context_data *cd)
+static void reset_context(struct context_data *cd)
 {
if (!cd)
return;
 
-   DBG(destroying %p (cid=%u), cd, cd-cid);
+   g_isi_remove_subscription(cd-client, PN_GPDS,
+   GPDS_CONTEXT_ACTIVATE_IND);
+   g_isi_remove_subscription(cd-client,
+   PN_GPDS, GPDS_CONTEXT_ACTIVATE_FAIL_IND);
+   g_isi_remove_subscription(cd-client,
+   PN_GPDS, GPDS_CONTEXT_DEACTIVATE_IND);
+   g_isi_commit_subscriptions(cd-client);
+
+   if (cd-activate_timeout)
+   g_source_remove(cd-activate_timeout);
+
+   if (cd-deactivate_timeout)
+   g_source_remove(cd-deactivate_timeout);
 
if (cd-pipe)
g_isi_pipe_destroy(cd-pipe);
@@ -124,34 +108,48 @@ static void destroy_context(struct context_data *cd)
if (cd-pep)
g_isi_pep_destroy(cd-pep);
 
-   g_free(cd);
+   cd-activate_timeout = 0;
+   cd-deactivate_timeout = 0;
+   cd-pep = NULL;
+   cd-pipe = NULL;
+   cd-handle = INVALID_ID;
 }
 
 static gboolean gprs_up_fail(struct context_data *cd)
 {
-   struct ofono_gprs_context *gc = cd-driver;
-   struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-
CALLBACK_WITH_FAILURE(cd-up_cb, NULL, 0, NULL, NULL, NULL, NULL,
cd-data);
 
-   gcd-contexts = g_slist_remove(gcd-contexts, cd);
-   destroy_context(cd);
+   reset_context(cd);
return TRUE;
 }
 
 static gboolean gprs_down_fail(struct context_data *cd)
 {
-   struct ofono_gprs_context *gc = cd-driver;
-   struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-
CALLBACK_WITH_FAILURE(cd-down_cb, cd-data);
 
-   gcd-contexts = g_slist_remove(gcd-contexts, cd);
-   destroy_context(cd);
+   reset_context(cd);
return TRUE;
 }
 
+static gboolean gprs_up_timeout(gpointer data)
+{
+   struct context_data *cd = data;
+
+   cd-activate_timeout = 0;
+   gprs_up_fail(cd);
+   return FALSE;
+}
+
+static gboolean gprs_down_timeout(gpointer data)
+{
+   struct context_data *cd = data;
+
+   cd-deactivate_timeout = 0;
+   gprs_down_fail(cd);
+   return FALSE;
+}
+
 static gboolean check_resp(GIsiClient *client,
const uint8_t *restrict msg, size_t len,
uint_fast8_t cmd, struct context_data *cd)
@@ -191,12 +189,29 @@ static gboolean check_resp(GIsiClient *client,
return TRUE;
 }
 
+static void deactivate_ind_cb(GIsiClient *client,
+   const void *restrict data, size_t len,
+   uint16_t object, 

Re: Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled

2010-11-10 Thread Pekka Pessi
Hi all,

2010/11/10 Gu, Yang yang...@intel.com:
According to your tip , I tried to set HideCallerId to default, 
disabled and
enabled, and I can verify by run list-modem script that HideCallerId had 
been
modified . but I still could find phone number on both called party and 
calling party ,
regardless the value of  HideCallerId is what.

How can I let phone number be withheld on incoming at called party , when I 
make a
voice call.

 I think the reason is your operator doesn't provide this supplementary 
 service. Below is my log when enable the HideCallerId. I couldn't enable 
 this feature either.

 ofonod[17734]: PCUI:  AT+CLIR=1\r
 ofonod[17734]: PCUI:  \r\nOK\r\n
 ofonod[17734]: PCUI:  AT+CLIR?\r
 ofonod[17734]: PCUI:  \r\n+CLIR: 1,0\r\n\r\nOK\r\n
 ofonod[17734]: drivers/atmodem/call-settings.c:clir_query_cb() clir_query_cb: 
 override: 1, network: 0

What happens when you make a call? Does call get rejected or do you
get some CSSU indications?

Yang and Haitao, please set HideCallerId to disabled, try to make
call, then set HideCallerId to enabled, try to make a call, and
perhaps also try to make call with test/dial-number number enabled and
test/dial-number disabled and then post the results.

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/4] isigen: make number of PDP contexts configurable

2010-11-10 Thread Mika Liljeberg
---
 plugins/isigen.c |   23 +--
 plugins/udev.c   |6 +-
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/plugins/isigen.c b/plugins/isigen.c
index 838d060..cee4e44 100644
--- a/plugins/isigen.c
+++ b/plugins/isigen.c
@@ -58,6 +58,8 @@
 #include drivers/isimodem/mtc.h
 #include drivers/isimodem/debug.h
 
+#define ISI_DEFAULT_PDPS 4 /* Number of supported PDP contexts */
+
 struct isi_data {
struct ofono_modem *modem;
char const *ifname;
@@ -407,6 +409,8 @@ static void isigen_post_online(struct ofono_modem *modem)
struct isi_data *isi = ofono_modem_get_data(modem);
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+   int pdps = ofono_modem_get_integer(modem, PDPS);
+   int i;
 
DBG((%p) with %s, modem, isi-ifname);
 
@@ -420,13 +424,20 @@ static void isigen_post_online(struct ofono_modem *modem)
ofono_call_barring_create(isi-modem, 0, isimodem, isi-idx);
ofono_call_meter_create(isi-modem, 0, isimodem, isi-idx);
ofono_radio_settings_create(isi-modem, 0, isimodem, isi-idx);
-   gprs = ofono_gprs_create(isi-modem, 0, isimodem, isi-idx);
-   gc = ofono_gprs_context_create(isi-modem, 0, isimodem, isi-idx);
 
-   if (gprs  gc)
-   ofono_gprs_add_context(gprs, gc);
-   else
-   DBG(Failed to add context);
+   gprs = ofono_gprs_create(isi-modem, 0, isimodem, isi-idx);
+   if (!gprs)
+   return;
+   if (!pdps)
+   pdps = ISI_DEFAULT_PDPS;
+   for (i = 1; i = pdps; i++) {
+   gc = ofono_gprs_context_create(isi-modem, 0,
+   isimodem, isi-idx);
+   if (gc)
+   ofono_gprs_add_context(gprs, gc);
+   else
+   DBG(Failed to add context %d, i);
+   }
 }
 
 static int isigen_enable(struct ofono_modem *modem)
diff --git a/plugins/udev.c b/plugins/udev.c
index 737a637..a25adcd 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -423,7 +423,7 @@ static void add_nokia(struct ofono_modem *modem,
 static void add_isi(struct ofono_modem *modem,
struct udev_device *udev_device)
 {
-   const char *ifname, *type, *addr;
+   const char *ifname, *type, *addr, *pdps;
 
DBG(modem %p, modem);
 
@@ -434,6 +434,10 @@ static void add_isi(struct ofono_modem *modem,
if (addr != NULL)
ofono_modem_set_integer(modem, Address, atoi(addr));
 
+   pdps = get_property(udev_device, OFONO_ISI_PDPS);
+   if (pdps != NULL)
+   ofono_modem_set_integer(modem, PDPS, atoi(pdps));
+
if (g_strcmp0(udev_device_get_subsystem(udev_device), net) != 0)
return;
 
-- 
1.7.0.4

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


[PATCH] TODO: Add owner to extend the voicecall interface with a property indicating emergency call

2010-11-10 Thread John Mathew
---
 TODO |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TODO b/TODO
index 84d5aa7..ed37c58 100644
--- a/TODO
+++ b/TODO
@@ -416,7 +416,7 @@ Emergency Calls
 
   Priority: High
   Complexity: C1
-
+  Owner: John Mathew john.mat...@elektrobit.com 
 
 Miscellaneous
 =
-- 
1.7.0.4

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


[PATCH 1/4] gisi: fix crash bug in g_isi_remove_subscription

2010-11-10 Thread Mika Liljeberg
---
 gisi/client.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gisi/client.c b/gisi/client.c
index 8ab3dc9..8e41331 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -744,16 +744,19 @@ int g_isi_subscribe(GIsiClient *client, uint8_t type,
  */
 void g_isi_remove_subscription(GIsiClient *client, uint8_t res, uint8_t type)
 {
+   void *ret;
GIsiIndication *ind;
unsigned int id = (res  8) | type;
 
if (!client)
return;
 
-   ind = tdelete(id, client-inds.subs, g_isi_cmp);
-   if (!ind)
+   ret = tfind(id, client-inds.subs, g_isi_cmp);
+   if (!ret)
return;
 
+   ind = *(GIsiIndication **)ret;
+   tdelete(ind, client-inds.subs, g_isi_cmp);
client-inds.count--;
g_free(ind);
 }
-- 
1.7.0.4

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


RE: Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled

2010-11-10 Thread Gu, Yang
Hi Haitao,


-Original Message-
From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of
Ding, HaitaoX
Sent: Wednesday, November 10, 2010 12:13 PM
To: ofono@ofono.org
Subject: RE: Can I modify CallingLineRestriction(the Property of CallSetting) 
value to
disabled or enabled

Hi, yang

Thanks a lot for your feedback.

According to your tip , I tried to set HideCallerId to default, disabled 
and
enabled, and I can verify by run list-modem script that HideCallerId had 
been
modified . but I still could find phone number on both called party and 
calling party ,
regardless the value of  HideCallerId is what.

How can I let phone number be withheld on incoming at called party , when I 
make a
voice call.

Could you give me some help .


I think the reason is your operator doesn't provide this supplementary service. 
Below is my log when enable the HideCallerId. I couldn't enable this feature 
either.

ofonod[17734]: PCUI:  AT+CLIR=1\r
ofonod[17734]: PCUI:  \r\nOK\r\n
ofonod[17734]: PCUI:  AT+CLIR?\r
ofonod[17734]: PCUI:  \r\n+CLIR: 1,0\r\n\r\nOK\r\n
ofonod[17734]: drivers/atmodem/call-settings.c:clir_query_cb() clir_query_cb: 
override: 1, network: 0

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


[PATCH] TODO: Check SIM pin status if sim_change_pin fails.

2010-11-10 Thread Marit Henriksen
From: Marit Henriksen marit.henrik...@stericsson.com

---
I'm sorry if I gave the impression that I don't want to contribute to 
the development of oFono core, I guess I'm just not that familiar with
how things work. 

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

diff --git a/TODO b/TODO
index 84d5aa7..eefa605 100644
--- a/TODO
+++ b/TODO
@@ -133,6 +133,12 @@ SIM / SIM File system
   Complexity: C2
   Owner: Pekka Pessi pekka.pe...@nokia.com
 
+- Check SIM pin status if sim_change_pin fails. If it is anything other than
+  READY, we must tear the state back to pre_sim state and set the modem 
offline.
+
+  Priority: Medium
+  Complexity: C1
+  Owner: Marit Henriksen marit.henrik...@stericsson.com
 
 Modem Emulator
 ==
-- 
1.7.0.4

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


[PATCH 2/4] gisi: return NULL instead of asserting

2010-11-10 Thread Mika Liljeberg
---
 gisi/pep.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gisi/pep.c b/gisi/pep.c
index f1ff589..bea1902 100644
--- a/gisi/pep.c
+++ b/gisi/pep.c
@@ -148,6 +148,8 @@ unsigned g_isi_pep_get_ifindex(const GIsiPEP *pep)
 
 char *g_isi_pep_get_ifname(const GIsiPEP *pep, char *ifname)
 {
-   unsigned ifi = g_isi_pep_get_ifindex(pep);
-   return if_indextoname(ifi, ifname);
+   if (pep-gprs_fd == -1)
+   return NULL;
+
+   return if_indextoname(g_isi_pep_get_ifindex(pep), ifname);
 }
-- 
1.7.0.4

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


[PATCH 0/4] bugfixes + revectored isimodem GPRS context driver

2010-11-10 Thread Mika Liljeberg
Hi All,

The first two patches are bugfixes. The rest adapts the isimodem
GPRS context driver to the current multiple PDP context support
in oFono core.

Br,

MikaL


[PATCH 1/4] gisi: fix crash bug in g_isi_remove_subscription
[PATCH 2/4] gisi: return NULL instead of asserting
[PATCH 3/4] isimodem: revector GPRS context driver
[PATCH 4/4] isigen: make number of PDP contexts configurable

 drivers/isimodem/gprs-context.c |  280 +--
 gisi/client.c   |7 +-
 gisi/pep.c  |6 +-
 plugins/isigen.c|   23 +++-
 plugins/udev.c  |6 +-
 5 files changed, 152 insertions(+), 170 deletions(-)
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 2/3] modem: add EmergencyMode property

2010-11-10 Thread Andras Domokos

Hi Denis,


On 11/09/2010 04:37 PM, ext Denis Kenzior wrote:

Hi Andras,

On 11/09/2010 02:59 AM, Andras Domokos wrote:
   

Signed-off-by: Andras Domokosandras.domo...@nokia.com
---
  src/modem.c |   53 +
  src/ofono.h |4 
  2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index f73cc1d..d7ad90e 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -72,6 +72,7 @@ struct ofono_modem {
ofono_bool_tpowered_pending;
guint   timeout;
ofono_bool_tonline;
+   unsigned intemergency_mode;
struct ofono_watchlist  *online_watches;
GHashTable  *properties;
struct ofono_sim*sim;
@@ -479,6 +480,50 @@ void __ofono_modem_remove_online_watch(struct ofono_modem 
*modem, unsigned id)
__ofono_watchlist_remove_item(modem-online_watches, id);
  }

+ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem)
+{
+   if (modem == NULL)
+   return FALSE;
+
+   return modem-emergency_mode != 0;
+}
+
+void ofono_modem_inc_emergency_mode(struct ofono_modem *modem)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = ofono_modem_get_path(modem);
+   ofono_bool_t emergency_mode = modem-emergency_mode;
 

I suggest getting rid of this variable

   

+   gboolean state = TRUE;
+
+   modem-emergency_mode++;
+   if (emergency_mode)
+   return;
+
 

And checking if modem-emergency_mode  1 here...

   

You are right, makes the code shorter with less variables.

+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_MODEM_INTERFACE,
+   EmergencyMode,
+   DBUS_TYPE_BOOLEAN,
+   state);
+   modem_change_state(modem, MODEM_STATE_ONLINE);
 

So we have to be a bit careful here.  You can't simply call
modem_change_state here.  This results in calling the post_online
method, which populates the atoms that function when the radio is on.
Instead you need to call the set_online driver method directly.

Also, you probably do not want to populate the online atoms in an
emergency call situation.  Each atom driver / atom will perform
initialization procedures when they're newly added.  This can
potentially interfere with the voice call setup time, and not desirable.
  Not to mention that if we're actually in an emergency situation with
the SIM removed or PIN locked, we do not want to populate the atoms in
the first place.

So the modem 'ONLINE_STATE' has to be slightly de-coupled from whether
the radio is 'online'.

   

Good point, thanks. I am going to call directly the modem driver
set_online function with my own callback.

Now the question is whether modem-online should be toggled
according to the radio state changes? I think yes, and have the
change signaled on D-Bus (modem Online poperty).

There is another question then, when to notify the modem online
watchers, supposedly whenever modem-online changes, including
the changes triggered by the emergency call case.


+}
+
+void ofono_modem_dec_emergency_mode(struct ofono_modem *modem)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = ofono_modem_get_path(modem);
+   gboolean state = FALSE;
+
+   modem-emergency_mode--;
+   if (modem-emergency_mode)
+   return;
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_MODEM_INTERFACE,
+   EmergencyMode,
+   DBUS_TYPE_BOOLEAN,
+   state);
 

Here you should turn the radio off if it was off before starting the
emergency call.

   


The rationale behind leaving the radio on after emergency calls
was to have the theoretical possibility the emergency call center
to call you back (when SIM card is present...). If this is an unrealistic
scenario, I'll disable the radio after emergency calls in case it was off
before the call.

   

+}
+
  static void online_cb(const struct ofono_error *error, void *data)
  {
struct ofono_modem *modem = data;
@@ -535,6 +580,9 @@ static DBusMessage *set_property_online(struct ofono_modem 
*modem,
if (modem-modem_state  MODEM_STATE_OFFLINE)
return __ofono_error_not_available(msg);

+   if (modem-emergency_mode  online == FALSE)
+   return __ofono_error_failed(msg);
+
if (modem-online == online)
return dbus_message_new_method_return(msg);

@@ -562,6 +610,7 @@ void __ofono_modem_append_properties(struct ofono_modem 
*modem,
int i;
GSList *l;
struct ofono_atom 

Re: [RFC PATCH 2/3] modem: add EmergencyMode property

2010-11-10 Thread Denis Kenzior
Hi Andras,

 So we have to be a bit careful here.  You can't simply call
 modem_change_state here.  This results in calling the post_online
 method, which populates the atoms that function when the radio is on.
 Instead you need to call the set_online driver method directly.

 Also, you probably do not want to populate the online atoms in an
 emergency call situation.  Each atom driver / atom will perform
 initialization procedures when they're newly added.  This can
 potentially interfere with the voice call setup time, and not desirable.
   Not to mention that if we're actually in an emergency situation with
 the SIM removed or PIN locked, we do not want to populate the atoms in
 the first place.

 So the modem 'ONLINE_STATE' has to be slightly de-coupled from whether
 the radio is 'online'.


 Good point, thanks. I am going to call directly the modem driver
 set_online function with my own callback.
 
 Now the question is whether modem-online should be toggled
 according to the radio state changes? I think yes, and have the
 change signaled on D-Bus (modem Online poperty).

That makes sense to me, yes.

 
 There is another question then, when to notify the modem online
 watchers, supposedly whenever modem-online changes, including
 the changes triggered by the emergency call case.

In the current structure this is just fine.  So let us run with it for
now and see what happens.  In the future we might find something a bit
more complicated is required, but we cross that bridge when we come to it.

 
 +}
 +
 +void ofono_modem_dec_emergency_mode(struct ofono_modem *modem)
 +{
 +DBusConnection *conn = ofono_dbus_get_connection();
 +const char *path = ofono_modem_get_path(modem);
 +gboolean state = FALSE;
 +
 +modem-emergency_mode--;
 +if (modem-emergency_mode)
 +return;
 +
 +ofono_dbus_signal_property_changed(conn, path,
 +OFONO_MODEM_INTERFACE,
 +EmergencyMode,
 +DBUS_TYPE_BOOLEAN,
 +state);
  
 Here you should turn the radio off if it was off before starting the
 emergency call.


 
 The rationale behind leaving the radio on after emergency calls
 was to have the theoretical possibility the emergency call center
 to call you back (when SIM card is present...). If this is an unrealistic
 scenario, I'll disable the radio after emergency calls in case it was off
 before the call.
 

That is a fair point, however, just silently leaving us Online might not
be a good idea.

I suggest finding out how exactly this is supposed to work.  E.g. can we
get away with starting an X minute timeout every time we leave emergency
mode and go offline automatically?  This timeout would obviously have to
be canceled if the user sets Online manually.

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


[PATCH 1/3] sim: Add sim_service_available() for querying EFsst or EFust.

2010-11-10 Thread Andrzej Zaborowski
The function is not public api because the service constants are in
src/simutil.h.
---
 src/ofono.h |5 +
 src/sim.c   |   15 +++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index e5b4acb..4d76d20 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -281,6 +281,11 @@ gboolean __ofono_sms_datagram_watch_remove(struct 
ofono_sms *sms,
 unsigned short __ofono_sms_get_next_ref(struct ofono_sms *sms);
 
 #include ofono/sim.h
+
+ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim,
+   int ust_service,
+   int sst_service);
+
 #include ofono/stk.h
 
 typedef void (*__ofono_sms_sim_download_cb_t)(ofono_bool_t ok,
diff --git a/src/sim.c b/src/sim.c
index e5e304c..f362565 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1928,6 +1928,21 @@ const unsigned char 
*ofono_sim_get_cphs_service_table(struct ofono_sim *sim)
return sim-cphs_service_table;
 }
 
+ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim,
+   int ust_service,
+   int sst_service)
+{
+   if (sim-efust)
+   return sim_ust_is_available(sim-efust, sim-efust_length,
+   ust_service);
+
+   if (sim-efsst)
+   return sim_sst_is_active(sim-efsst, sim-efsst_length,
+   sst_service);
+
+   return FALSE;
+}
+
 static void sim_inserted_update(struct ofono_sim *sim)
 {
DBusConnection *conn = ofono_dbus_get_connection();
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 2/3] sms: SMS-PP download must be enabled in SIM service tables.

2010-11-10 Thread Andrzej Zaborowski
---
 src/sms.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index eba4564..fe45ef3 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -37,6 +37,7 @@
 #include util.h
 #include smsutil.h
 #include storage.h
+#include simutil.h
 
 #define uninitialized_var(x) x = x
 
@@ -1417,6 +1418,7 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, 
unsigned char *pdu,
 {
struct ofono_modem *modem = __ofono_atom_get_modem(sms-atom);
struct ofono_atom *stk_atom;
+   struct ofono_atom *sim_atom;
struct sms s;
enum sms_class cls;
 
@@ -1485,6 +1487,17 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, 
unsigned char *pdu,
if (cls != SMS_CLASS_2)
break;
 
+   sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+
+   if (!sim_atom)
+   return;
+
+   if (!__ofono_sim_service_available(
+   __ofono_atom_get_data(sim_atom),
+   SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_PP,
+   SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_PP))
+   return;
+
stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
 
if (!stk_atom)
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 3/3] cbs: CB download must be enabled in SIM service tables.

2010-11-10 Thread Andrzej Zaborowski
---
 src/cbs.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/cbs.c b/src/cbs.c
index 6bd2f69..821985b 100644
--- a/src/cbs.c
+++ b/src/cbs.c
@@ -173,6 +173,7 @@ static void cbs_dispatch_text(struct ofono_cbs *cbs, enum 
sms_class cls,
 void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu,
int pdu_len)
 {
+   struct ofono_modem *modem = __ofono_atom_get_modem(cbs-atom);
struct cbs c;
enum sms_class cls;
gboolean udhi;
@@ -181,6 +182,7 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned 
char *pdu,
enum sms_charset charset;
char *message;
char iso639_lang[3];
+   struct ofono_atom *sim_atom;
 
if (cbs-assembly == NULL)
return;
@@ -191,6 +193,17 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const 
unsigned char *pdu,
}
 
if (cbs_topic_in_range(c.message_identifier, cbs-efcbmid_contents)) {
+   sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+
+   if (!sim_atom)
+   return;
+
+   if (!__ofono_sim_service_available(
+   __ofono_atom_get_data(sim_atom),
+   SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_CB,
+   SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_CB))
+   return;
+
if (cbs-stk)
__ofono_cbs_sim_download(cbs-stk, c);
return;
-- 
1.7.1.86.g0e460.dirty

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


Re: [PATCH] TODO: Add owner to extend the voicecall interface with a property indicating emergency call

2010-11-10 Thread Denis Kenzior
Hi John,

On 11/10/2010 06:25 AM, John Mathew wrote:
 ---
  TODO |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/TODO b/TODO
 index 84d5aa7..ed37c58 100644
 --- a/TODO
 +++ b/TODO
 @@ -416,7 +416,7 @@ Emergency Calls
  
Priority: High
Complexity: C1
 -
 +  Owner: John Mathew john.mat...@elektrobit.com 
  
  Miscellaneous
  =

We have pretty strict git apply settings in effect, so your patch does
not apply:

Applying: TODO: Add owner to extend the voicecall interface with a
property indicating emergency call
/home/denkenz/ofono-master/.git/rebase-apply/patch:14: trailing whitespace.
  Owner: John Mathew john.mat...@elektrobit.com
fatal: 1 line adds whitespace errors.
Patch failed at 0001 TODO: Add owner to extend the voicecall interface
with a property indicating emergency call

Also, please keep your commit header under 50 characters.  And yes, I
know the task description is rather 'long' in this case ;)  So sometimes
we have to be a bit 'creative'.  Something like:

TODO: Assign Voicecall emergency property task

would work in this case.

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


Re: [PATCH] TODO: Check SIM pin status if sim_change_pin fails.

2010-11-10 Thread Denis Kenzior
Hi Marit,

On 11/10/2010 05:35 AM, Marit Henriksen wrote:
 From: Marit Henriksen marit.henrik...@stericsson.com
 
 ---
 I'm sorry if I gave the impression that I don't want to contribute to 
 the development of oFono core, I guess I'm just not that familiar with
 how things work. 
 

No worries, patch has been applied. Thanks.

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


Re: [PATCH 1/3] sim: Add sim_service_available() for querying EFsst or EFust.

2010-11-10 Thread Denis Kenzior
Hi Andrew,

On 11/09/2010 09:27 PM, Andrzej Zaborowski wrote:
 The function is not public api because the service constants are in
 src/simutil.h.
 ---

Patch has been applied, thanks.

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


Re: [PATCH 2/3] sms: SMS-PP download must be enabled in SIM service tables.

2010-11-10 Thread Denis Kenzior
Hi Andrew,

On 11/09/2010 09:27 PM, Andrzej Zaborowski wrote:
 ---
  src/sms.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH 3/3] cbs: CB download must be enabled in SIM service tables.

2010-11-10 Thread Denis Kenzior
Hi Andrew,

On 11/09/2010 09:27 PM, Andrzej Zaborowski wrote:
 ---
  src/cbs.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

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


[PATCH] TODO: Assign Voicecall emergency property task

2010-11-10 Thread John Mathew
---
 TODO |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TODO b/TODO
index eefa605..bf2305b 100644
--- a/TODO
+++ b/TODO
@@ -422,7 +422,7 @@ Emergency Calls
 
   Priority: High
   Complexity: C1
-
+  Owner: John Mathew john.mat...@elektrobit.com
 
 Miscellaneous
 =
-- 
1.7.0.4

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


Re: [PATCH] TODO: Assign Voicecall emergency property task

2010-11-10 Thread Denis Kenzior
Hi John,

On 11/10/2010 10:09 AM, John Mathew wrote:
 ---
  TODO |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 

Applied, thanks for taking up this task.

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


[no subject]

2010-11-10 Thread John Mathew
Resending patch with  commit header under 50 characters.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 4/4] isigen: make number of PDP contexts configurable

2010-11-10 Thread Marcel Holtmann
Hi Mika,

  plugins/isigen.c |   23 +--
  plugins/udev.c   |6 +-
  2 files changed, 22 insertions(+), 7 deletions(-)

snip
 
 @@ -434,6 +434,10 @@ static void add_isi(struct ofono_modem *modem,
   if (addr != NULL)
   ofono_modem_set_integer(modem, Address, atoi(addr));
  
 + pdps = get_property(udev_device, OFONO_ISI_PDPS);
 + if (pdps != NULL)
 + ofono_modem_set_integer(modem, PDPS, atoi(pdps));
 +
   if (g_strcmp0(udev_device_get_subsystem(udev_device), net) != 0)
   return;

why to do you bother making this a configurable option? What isthe
benefit here?

Personally I think that always enabling 4 context if the hardware
supports it should be enough. If you do support more then just enable
more all the time. There are no real resources used in context of ISI
anyway. The AT command based modems have a different problem since for
most of them we need an extra TTY/DLC and an extra GAtChat object, but
ISI does not have that problem.

Regards

Marcel


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


Re: [RFC PATCH 2/3] modem: add EmergencyMode property

2010-11-10 Thread Marcel Holtmann
Hi Denis,

  Here you should turn the radio off if it was off before starting the
  emergency call.
 
 
  
  The rationale behind leaving the radio on after emergency calls
  was to have the theoretical possibility the emergency call center
  to call you back (when SIM card is present...). If this is an unrealistic
  scenario, I'll disable the radio after emergency calls in case it was off
  before the call.
  
 
 That is a fair point, however, just silently leaving us Online might not
 be a good idea.
 
 I suggest finding out how exactly this is supposed to work.  E.g. can we
 get away with starting an X minute timeout every time we leave emergency
 mode and go offline automatically?  This timeout would obviously have to
 be canceled if the user sets Online manually.

on one hand I see this making perfect sense. For example just leave the
modem in online state for lets say 15 minutes. But then on the other
hand I am worried about regulatory requirements where the modem is
suppose to be offline.

So what I would propose here to actually leave the modem online for a
really short period of time like 30 seconds or so. And then bring it
back down. Then we can tweak that value to our needs. And in addition
the user could switched it back online by himself and we avoid going
into offline mode and back to online mode.

Of course when switching to online mode by user we need to ensure that
all atoms are brought up properly.

Regards

Marcel


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


RFCs updated: Infineon modem support for agps

2010-11-10 Thread Robertino Benis

Hi all,

This is the second RFC set of patches, attempting to start
shaping aGPS support for Infenion modem in oFono.
I have included comments received both from Denis and Marcel
on the first RFC version.

This set of patches includes:
- basic API documentation,
- suggested core APIs and example implementation in modem driver,
- updated TODO file

Thank you very much for your comments.

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


[PATCH] todo: ifxmodem apgs support

2010-11-10 Thread Robertino Benis
---
 TODO |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index bf2305b..fe617af 100644
--- a/TODO
+++ b/TODO
@@ -496,3 +496,19 @@ Miscellaneous
 
   Priority: Low
   Complexity: C4
+
+
+Modem support
+=
+
+- Infineon modem:
+  Adding support for Assisted GPS in Infenion modem driver.
+  Enabling:
+
+  - postion requests from mobile networks
+  - position responses to mobile networks
+  - time injection
+
+  Priority: Low
+  Complexity: C1
+  Owner: Robertino Benis robertino.be...@intel.com
-- 
1.7.0.4

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


[RFC v2 1/3] doc: addidng documentation for basic assisted gps

2010-11-10 Thread Robertino Benis
---
 doc/assistedgps-manager-api.txt |  107 +++
 1 files changed, 107 insertions(+), 0 deletions(-)
 create mode 100644 doc/assistedgps-manager-api.txt

diff --git a/doc/assistedgps-manager-api.txt b/doc/assistedgps-manager-api.txt
new file mode 100644
index 000..da0696c
--- /dev/null
+++ b/doc/assistedgps-manager-api.txt
@@ -0,0 +1,107 @@
+AssistedPositioning Manager hierarchy
+=
+
+   The purpose of this interface is to support Control Plane Assisted GPS 
by transparently
+   relaying positioning related information between the mobile network and 
a positioning engine.
+   The positioning information is relayed in the form of raw RRLP or RRC 
PDUs as defined by
+   3GPP TS 04.31 and 3GPP TS 25.331.
+
+Serviceorg.ofono
+Interface  org.ofono.ModemIFX.AssistedPositioning
+Object path[variable prefix]/{modem0,modem1,...}
+
+Methodsdict GetProperties()
+
+   Returns properties for the modem object. See
+   the properties section for available properties.
+
+   Possible Errors: [service].Error.InvalidArguments
+
+   void SetProperty(string name, variant value)
+
+   Changes the value of the specified property. Only
+   properties that are listed as read-write are
+   changeable. On success a PropertyChanged signal
+   will be emitted.
+
+   Possible Errors: [service].Error.InvalidArguments
+[service].Error.DoesNotExist
+
+   void SendFrame(string frametype, array{byte} framedata)
+
+   Send a position protocol frame to the Mobile
+   Network. The frame typically represents a
+   Position Response.
+
+   Valid frametypes are:
+   rrlp_measure_position_response
+   rrc_measurement_report
+
+   dict RequestFineTimeInjection(string rat, uint16 pulselength)
+
+   Request modem to generate a fine time injection
+   pulse. pulselength is the duration of the pulse
+   expressed in radio frames.
+
+   rat specifies the access technology used to derive
+   the pulse from and can be gsm or umts.
+   If the requested access technology is not currently
+   in use an error is returned.
+
+   The radioframenumber dict is defined as follow:
+
+   string AccessTechnology
+   gsm or umts
+
+   uint32 TdmaFrameNumber (gsm only)
+   range 0 - 2715647 (2048*26*51)
+
+   uint16 TdmaTimeslot (gsm only)
+   range 0 - 7
+
+   uint16 TimeslotBit (gsm only)
+   range 0 - 156
+
+   uint16 TimingAdvance (gsm only)
+   range 0 - 63
+
+   uint16 BcchArfcn (gsm only)
+   range 0 - 1023
+
+   uint16 Bsic (gsm only)
+   range 0 - 64
+
+   uint16 Sfn (umts only)
+   range 0 - 4095
+
+   string RrcState (umts only)
+   cell_dch, cell_fach, cell_pch or
+   ura_pch
+
+   uint16 RoundTripTime (umts only)
+   range 0 - 32766
+
+SignalsPropertyChanged(string name, variant value)
+
+   This signal indicates a changed value of the given
+   property.
+
+   IncomingFrame(string frametypes, string framedata)
+
+   Positioning protocol frame received from the
+   Mobile Network.
+
+   Valid frametypes for the positioning frame are:
+   rrlp_assistance_data
+   rrlp_measure_position_request
+   rrc_assistance_data_delivery
+   rrc_measurement_control
+
+   Note that position/measurement requests can include
+   assistance data as well.
+
+Properties boolean Enabled [readwrite]
+
+   The AssistedPositioning service is disabled by default.
+   After a client registers to listen for the 
IncomingFrame signal it
+   must enable the service to receive positioning 
information.
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org

[RFC v2 2/3] agps: adding agps related functions

2010-11-10 Thread Robertino Benis
---
 include/agps.h |  157 
 1 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 include/agps.h

diff --git a/include/agps.h b/include/agps.h
new file mode 100644
index 000..783136b
--- /dev/null
+++ b/include/agps.h
@@ -0,0 +1,157 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2009-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_AGPS_H
+#define __OFONO_AGPS_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+enum ofono_lcs_frame_type {
+   RRLP_ASSISTANCE_DATA,   /* from modem */
+   /* Position request can include assistance data as well */
+   RRLP_MEASURE_POSITION_REQUEST,  /* from modem */
+   RRLP_MEASURE_POSITION_RESPONSE, /* from GPS */
+   RRC_ASSISTANCE_DATA_DELIVERY,   /* from modem */
+   /* Measurement control can include assistance data as well */
+   RRC_MEASUREMENT_CONTROL,/* from modem */
+   RRC_MEASUREMENT_REPORT, /* from GPS */
+};
+
+enum ofono_access_technology {
+   RADIO_ACCESS_TECHNOLOGY_GSM,/* GSM */
+   RADIO_ACCESS_TECHNOLOGY_UMTS,   /* UMTS */
+};
+
+enum ofono_rrc_state {
+   RRC_CELL_PCH,
+   RRC_CELL_FACH,
+   RRC_CELL_DCH,
+   RRC_URA_PCH,
+};
+
+struct ofono_lcs_frame {
+   enum ofono_lcs_frame_type lcs_frame_type;
+   int frame_length;   /* size of raw_frame in bytes */
+   unsigned char  *raw_frame;
+};
+
+struct ofono_lcs_gsm_fn {
+   int TDMA_frame_number;  /* range 0 - 2715647 (2048*26*51) */
+   int TDMA_timeslot;  /* range 0 - 7 */
+   int timeslot_bit;   /* range 0 - 156 */
+   int timing_advance; /* range 0 - 63 */
+   int bcch_arfcn; /* range 0 - 1023 */
+   int bsic;   /* range 0 - 64 */
+};
+
+struct ofono_lcs_utran_fn {
+   int sfn;/* range 0 - 4095 */
+   int rrc_state;  /* enum ofono_rrc_state */
+   int round_trip_time;/* range 0 - 32766 */
+};
+
+struct ofono_lcs_radio_fn {
+   enum ofono_access_technology radio_access_technology;
+   union {
+   struct ofono_lcs_gsm_fn gsm_frame_number;
+   struct ofono_lcs_utran_fn   utran_frame_number;
+   };
+};
+
+struct ofono_agps;
+
+typedef void (*ofono_agps_send_lcs_frame_cb_t)(const struct ofono_error *error,
+   void *data);
+typedef void (*ofono_agps_receive_lcs_frame_cb_t)(
+   const struct ofono_error *error,
+   void *data);
+typedef void (*ofono_agps_inject_time_cb_t)(const struct ofono_error *error,
+   struct ofono_lcs_radio_fn *radio_frame_number,
+   void *data);
+
+   /*
+   * AGPS related functions, including LCS frame forwarding and
+   * fine time injection
+   */
+struct ofono_agps_driver {
+   const char *name;
+   int (*probe)(struct ofono_agps *agps, unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_agps *agps);
+
+   /* The GPS manager can configure the modem to notify Assistance Data and
+* Position Requests from Mobile Network by enabling LcsEnabled status
+*/
+
+void (*receive_lcs_frames)(struct ofono_agps *agps, int enabled,
+   ofono_agps_receive_lcs_frame_cb_t cb, void *data);
+
+   /* Assistance Data and Position Requests from the Mobile Network are
+* signalled via the ofono_agps_lcs_frame_notify function and the
+* oFono core to an external GPS manager. This GPS manager can reply
+* to Position Requests with one or more Position Responses which
+* are then send back to the modem via the send_lcs_frame function.
+*/
+   void (*send_lcs_frame)(struct ofono_agps *agps,
+   struct ofono_lcs_frame *frame,
+   ofono_agps_send_lcs_frame_cb_t cb, void *data);
+
+   /* The GPS manager can ask the modem to generate a HW pulse (time
+* stamp) with a defined length and the modem replies indicates when
+* it generates the pulse. But as the modem has no precise idea of
+* Universal Time, 

[RFC v2 3/3] ifxmodem: adding modem API to support agps

2010-11-10 Thread Robertino Benis
---
 drivers/ifxmodem/agps.c |  413 +++
 1 files changed, 413 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ifxmodem/agps.c

diff --git a/drivers/ifxmodem/agps.c b/drivers/ifxmodem/agps.c
new file mode 100644
index 000..4e8d427
--- /dev/null
+++ b/drivers/ifxmodem/agps.c
@@ -0,0 +1,413 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/agps.h
+
+#include util.h
+#include ifxmodem.h
+
+struct agps_data {
+   GAtChat *chat;
+   unsigned int vendor;
+   enum ofono_access_technology rad_acc_tech;
+};
+
+struct ofono_agps;
+static const char *none_prefix[] = { NULL };
+
+static void pos_request_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_agps *agps = user_data;
+   int framelen;
+   int frametype;
+   GAtResultIter iter;
+   struct ofono_lcs_frame lcsframe;
+   const char *frame;
+
+   /* Assuming Pos Req format: %XPOSR: frametype,framelen,frame */
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, %%XPOSR:))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, frametype))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, framelen))
+   return;
+
+   frame = g_at_result_pdu(result);
+
+   DBG(AGPS POS Info: Type = %d Length = %d data = %s,
+   frametype, framelen, frame);
+
+   lcsframe.lcs_frame_type = frametype;
+   lcsframe.frame_length = framelen;
+   lcsframe.raw_frame = (unsigned char *)frame;
+
+   ofono_agps_lcs_frame_notify(agps, lcsframe);
+}
+
+static void inj_time_notify(GAtResult *result, gpointer user_data)
+{
+
+   struct cb_data *cbd = user_data;
+   struct agps_data *data = cbd-user;
+   ofono_agps_inject_time_cb_t cb = cbd-cb;
+   struct ofono_lcs_radio_fn rf;
+   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   GAtResultIter iter;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, %%XFTI:))
+   return;
+
+   if (data-rad_acc_tech == RADIO_ACCESS_TECHNOLOGY_GSM) {
+
+   int fn; /* range 0 - 2715647 (2048*26*51) */
+   int ts; /* range 0 - 7 */
+   int tsb;/* range 0 - 156 */
+   int ta; /* range 0 - 63 */
+   int ba; /* range 0 - 1023 */
+   int bc; /* range 0 - 64 */
+
+   /*   %XFTI:frameNum,TimeSlot,TimeSlotBit,TimeAdv,
+   *   ChannelNum,ChannelId
+   */
+   if (!g_at_result_iter_next_number(iter, fn))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ts))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, tsb))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ta))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ba))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, bc))
+   goto err;
+
+   DBG(GSM Inject Response: fn = %d ts = %d tsb = %d ta = %d
+   ba = %d bc = %d , fn, ts, tsb, ta, ba, bc);
+
+   rf.gsm_frame_number.TDMA_frame_number = fn;
+   rf.gsm_frame_number.TDMA_timeslot = ts;
+   rf.gsm_frame_number.timeslot_bit = tsb;
+   rf.gsm_frame_number.timing_advance = ta;
+   rf.gsm_frame_number.bcch_arfcn = ba;
+   rf.gsm_frame_number.bsic = bc;
+   rf.radio_access_technology = RADIO_ACCESS_TECHNOLOGY_GSM;
+
+   } else if (data-rad_acc_tech == RADIO_ACCESS_TECHNOLOGY_UMTS) {
+
+   int sfn;/* range 0 - 4095 */
+   int rs; /* enum ofono_rrc_state */
+   int rt; /* 

RE: [RFC v2 3/3] ifxmodem: adding modem API to support agps

2010-11-10 Thread Bastian, Waldo
The error handling in ifx_agps_inject_time_cb needs to have a call to 
CALLBACK_WITH_FAILURE.

Calling g_at_chat_register(agd-chat, %%XFTI:, ...) from 
ifx_agps_inject_time_cb seems wrong:
- It gets called multiple times
- Are you sure that %XFTI can't come before the OK response?
- agd-chat should be data-chat

#define BUF_LEN should be removed as it isn't used

In ifx_agps_send_lcs_frame the raw_frame isn't hex encoded before it gets 
inserted into the AT command.

Cheers,
Waldo

-Original Message-
From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of 
Robertino Benis
Sent: Wednesday, November 10, 2010 11:43 AM
To: ofono@ofono.org
Cc: Ahmed, Suhail
Subject: [RFC v2 3/3] ifxmodem: adding modem API to support agps

---
 drivers/ifxmodem/agps.c |  413 +++
 1 files changed, 413 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ifxmodem/agps.c

diff --git a/drivers/ifxmodem/agps.c b/drivers/ifxmodem/agps.c
new file mode 100644
index 000..4e8d427
--- /dev/null
+++ b/drivers/ifxmodem/agps.c
@@ -0,0 +1,413 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/agps.h
+
+#include util.h
+#include ifxmodem.h
+
+struct agps_data {
+   GAtChat *chat;
+   unsigned int vendor;
+   enum ofono_access_technology rad_acc_tech;
+};
+
+struct ofono_agps;
+static const char *none_prefix[] = { NULL };
+
+static void pos_request_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_agps *agps = user_data;
+   int framelen;
+   int frametype;
+   GAtResultIter iter;
+   struct ofono_lcs_frame lcsframe;
+   const char *frame;
+
+   /* Assuming Pos Req format: %XPOSR: frametype,framelen,frame */
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, %%XPOSR:))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, frametype))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, framelen))
+   return;
+
+   frame = g_at_result_pdu(result);
+
+   DBG(AGPS POS Info: Type = %d Length = %d data = %s,
+   frametype, framelen, frame);
+
+   lcsframe.lcs_frame_type = frametype;
+   lcsframe.frame_length = framelen;
+   lcsframe.raw_frame = (unsigned char *)frame;
+
+   ofono_agps_lcs_frame_notify(agps, lcsframe);
+}
+
+static void inj_time_notify(GAtResult *result, gpointer user_data)
+{
+
+   struct cb_data *cbd = user_data;
+   struct agps_data *data = cbd-user;
+   ofono_agps_inject_time_cb_t cb = cbd-cb;
+   struct ofono_lcs_radio_fn rf;
+   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   GAtResultIter iter;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, %%XFTI:))
+   return;
+
+   if (data-rad_acc_tech == RADIO_ACCESS_TECHNOLOGY_GSM) {
+
+   int fn; /* range 0 - 2715647 (2048*26*51) */
+   int ts; /* range 0 - 7 */
+   int tsb;/* range 0 - 156 */
+   int ta; /* range 0 - 63 */
+   int ba; /* range 0 - 1023 */
+   int bc; /* range 0 - 64 */
+
+   /*   %XFTI:frameNum,TimeSlot,TimeSlotBit,TimeAdv,
+   *   ChannelNum,ChannelId
+   */
+   if (!g_at_result_iter_next_number(iter, fn))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ts))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, tsb))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ta))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, ba))
+   goto err;
+
+   if (!g_at_result_iter_next_number(iter, bc))
+   goto err;
+
+   

RE: [RFC v2 3/3] ifxmodem: adding modem API to support agps

2010-11-10 Thread Marcel Holtmann
Hi Waldo,

 The error handling in ifx_agps_inject_time_cb needs to have a call to 
 CALLBACK_WITH_FAILURE.

 snip

 In ifx_agps_send_lcs_frame the raw_frame isn't hex encoded before it gets 
 inserted into the AT command.

this mailing list does NOT allow top posting and you know this. Still
you do it. I understand that this is hard to overcome with Outlook, but
please respect our rules here.

I will start ignoring top post emails now.

Regards

Marcel


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


RE: [RFC v2 3/3] ifxmodem: adding modem API to support agps

2010-11-10 Thread Bastian, Waldo
 this mailing list does NOT allow top posting and you know this.

I indeed realized this about a second after I pressed send. My initial response 
was to use Outlook's recall function to correct my mistake... luckily sanity 
prevailed.

I am very sorry about this transgression. I will now sulk in the corner for a 
while.

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


RE: Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled

2010-11-10 Thread Gu, Yang
Hi, 


-Original Message-
From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of
Pekka Pessi
Sent: Wednesday, November 10, 2010 8:33 PM
To: ofono@ofono.org
Subject: Re: Can I modify CallingLineRestriction(the Property of CallSetting) 
value to
disabled or enabled

Hi all,

2010/11/10 Gu, Yang yang...@intel.com:
According to your tip , I tried to set HideCallerId to default, 
disabled and
enabled, and I can verify by run list-modem script that HideCallerId had 
been
modified . but I still could find phone number on both called party and 
calling party ,
regardless the value of  HideCallerId is what.

How can I let phone number be withheld on incoming at called party , when I 
make
a
voice call.

 I think the reason is your operator doesn't provide this supplementary 
 service.
Below is my log when enable the HideCallerId. I couldn't enable this feature 
either.

 ofonod[17734]: PCUI:  AT+CLIR=1\r
 ofonod[17734]: PCUI:  \r\nOK\r\n
 ofonod[17734]: PCUI:  AT+CLIR?\r
 ofonod[17734]: PCUI:  \r\n+CLIR: 1,0\r\n\r\nOK\r\n
 ofonod[17734]: drivers/atmodem/call-settings.c:clir_query_cb() clir_query_cb:
override: 1, network: 0

What happens when you make a call? Does call get rejected or do you
get some CSSU indications?

Thank you for the comments!
After setting HideCallerId to enabled, and making an outgoing call, the call 
arrived at another phone as normal, and I didn't see any CSSU indication. The 
call settings are listed below, in which the CallingLineRestriction is always 
disabled. I think this means the network disables this feature. I also 
confirmed with our operator (CMCC), and they said they don't support CLIR.
[ org.ofono.CallSettings ]
CalledLineRestriction = unknown
HideCallerId = enabled
CallingLinePresentation = enabled
CalledLinePresentation = disabled
VoiceCallWaiting = enabled
CallingLineRestriction = disabled


Yang and Haitao, please set HideCallerId to disabled, try to make
call, then set HideCallerId to enabled, try to make a call, and
perhaps also try to make call with test/dial-number number enabled and
test/dial-number disabled and then post the results.

Below are the detailed logs. It looks all the same for different scenarios:

*
Set HideCallerId to disabled
./test-voicecall 13917758428
*

ofonod[8291]: PCUI:  ATD13917758428;\r
ofonod[8291]: PCUI:  \r\nOK\r\n\r\n^ORIG:1,0\r\n
ofonod[8291]: src/voicecall.c:dial_handle_result() Registering new call: 1
ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify() active 1
ofonod[8291]: Call origin: id 1 type 0
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, 
status: 2, id: 1, number: 
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
ofonod[8291]: PCUI:  AT^DDSETEX=2\r
ofonod[8291]: PCUI:  \r\nOK\r\n
ofonod[8291]: PCUI:  \r\n^CONF:1\r\n
ofonod[8291]: Call setup: id 1
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, 
status: 3, id: 1, number: 
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
ofonod[8291]: PCUI:  \r\n^RSSI:28\r\n
ofonod[8291]: PCUI:  \r\n^RSSI:31\r\n
ofonod[8291]: PCUI:  \r\n^BOOT:20294233,0,0,0,20\r\n
ofonod[8291]: PCUI:  \r\n^RSSI:29\r\n
ofonod[8291]: PCUI:  \r\n^CEND:1,0,104,31\r\n
ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify() active 0
ofonod[8291]: Call end: id 1 duration 0s status 104
ofonod[8291]: src/voicecall.c:ofono_voicecall_disconnected() Got disconnection 
event for id: 1, reason: 0
ofonod[8291]: Call Ended on modem: 0xa0a01a0
ofonod[8291]: Voice Call, Outgoing
ofonod[8291]: To: 13917758428
ofonod[8291]: StartTime: 2010-11-11T10:15:16+0800
ofonod[8291]: EndTime: 2010-11-11T10:15:57+0800
ofonod[8291]: PCUI:  \r\n^MODE:3,3\r\n
ofonod[8291]: PCUI:  \r\n^BOOT:20294233,0,0,0,20\r\n

*
Set HideCallerId to enabled 
./test-voicecall 13917758428
*

ofonod[8291]: PCUI:  ATD13917758428;\r
ofonod[8291]: PCUI:  \r\nOK\r\n\r\n^ORIG:1,0\r\n
ofonod[8291]: src/voicecall.c:dial_handle_result() Registering new call: 1
ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify() active 1
ofonod[8291]: Call origin: id 1 type 0
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, 
status: 2, id: 1, number: 
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
ofonod[8291]: PCUI:  AT^DDSETEX=2\r
ofonod[8291]: PCUI:  \r\nOK\r\n
ofonod[8291]: PCUI:  \r\n^CONF:1\r\n
ofonod[8291]: Call setup: id 1
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, 
status: 3, id: 1, number: 
ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
ofonod[8291]: PCUI:  \r\n^RSSI:26\r\n
ofonod[8291]: PCUI:  \r\n^RSSI:21\r\n
ofonod[8291]: PCUI:  \r\n^BOOT:20294233,0,0,0,20\r\n
ofonod[8291]: PCUI:  

RE: Can I modify CallingLineRestriction(the Property ofCallSetting) value to disabled or enabled

2010-11-10 Thread Zhang, Caiwen
Hi Yang,

 -Original Message-
 From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On
 Behalf Of Gu, Yang
 Sent: Thursday, November 11, 2010 10:37 AM
 To: ofono@ofono.org
 Subject: RE: Can I modify CallingLineRestriction(the Property
 ofCallSetting) value to disabled or enabled
 
 Hi,
 
 
 -Original Message-
 From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On
 Behalf Of
 Pekka Pessi
 Sent: Wednesday, November 10, 2010 8:33 PM
 To: ofono@ofono.org
 Subject: Re: Can I modify CallingLineRestriction(the Property of
 CallSetting) value to
 disabled or enabled
 
 Hi all,
 
 2010/11/10 Gu, Yang yang...@intel.com:
 According to your tip , I tried to set HideCallerId to default,
 disabled and
 enabled, and I can verify by run list-modem script that
 HideCallerId had been
 modified . but I still could find phone number on both called party
 and calling party ,
 regardless the value of  HideCallerId is what.
 
 How can I let phone number be withheld on incoming at called party ,
 when I make
 a
 voice call.
 
  I think the reason is your operator doesn't provide this
 supplementary service.
 Below is my log when enable the HideCallerId. I couldn't enable this
 feature either.
 
  ofonod[17734]: PCUI:  AT+CLIR=1\r
  ofonod[17734]: PCUI:  \r\nOK\r\n
  ofonod[17734]: PCUI:  AT+CLIR?\r
  ofonod[17734]: PCUI:  \r\n+CLIR: 1,0\r\n\r\nOK\r\n
  ofonod[17734]: drivers/atmodem/call-settings.c:clir_query_cb()
 clir_query_cb:
 override: 1, network: 0
 
 What happens when you make a call? Does call get rejected or do you
 get some CSSU indications?
 
 Thank you for the comments!
 After setting HideCallerId to enabled, and making an outgoing call,
 the call arrived at another phone as normal, and I didn't see any CSSU
 indication. The call settings are listed below, in which the
 CallingLineRestriction is always disabled. I think this means the
 network disables this feature. I also confirmed with our operator
 (CMCC), and they said they don't support CLIR.
 [ org.ofono.CallSettings ]
 CalledLineRestriction = unknown
 HideCallerId = enabled
 CallingLinePresentation = enabled
 CalledLinePresentation = disabled
 VoiceCallWaiting = enabled
 CallingLineRestriction = disabled
 

As I know only particular subscriber can subscribe Calling line 
restriction(CLIR)
service, Such as police. Normal subscriber can not use this service.

Similarly, CLIP is the same, it depends on whether subscriber subscribe the 
service.
The setting at modem side don't take effect.

 
 Yang and Haitao, please set HideCallerId to disabled, try to make
 call, then set HideCallerId to enabled, try to make a call, and
 perhaps also try to make call with test/dial-number number enabled and
 test/dial-number disabled and then post the results.
 
 Below are the detailed logs. It looks all the same for different
 scenarios:
 
 *
 Set HideCallerId to disabled
 ./test-voicecall 13917758428
 *
 
 ofonod[8291]: PCUI:  ATD13917758428;\r
 ofonod[8291]: PCUI:  \r\nOK\r\n\r\n^ORIG:1,0\r\n
 ofonod[8291]: src/voicecall.c:dial_handle_result() Registering new call:
 1
 ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify()
 active 1
 ofonod[8291]: Call origin: id 1 type 0
 ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall
 event, status: 2, id: 1, number:
 ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with
 id: 1
 ofonod[8291]: PCUI:  AT^DDSETEX=2\r
 ofonod[8291]: PCUI:  \r\nOK\r\n
 ofonod[8291]: PCUI:  \r\n^CONF:1\r\n
 ofonod[8291]: Call setup: id 1
 ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Got a voicecall
 event, status: 3, id: 1, number:
 ofonod[8291]: src/voicecall.c:ofono_voicecall_notify() Found call with
 id: 1
 ofonod[8291]: PCUI:  \r\n^RSSI:28\r\n
 ofonod[8291]: PCUI:  \r\n^RSSI:31\r\n
 ofonod[8291]: PCUI:  \r\n^BOOT:20294233,0,0,0,20\r\n
 ofonod[8291]: PCUI:  \r\n^RSSI:29\r\n
 ofonod[8291]: PCUI:  \r\n^CEND:1,0,104,31\r\n
 ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify()
 active 0
 ofonod[8291]: Call end: id 1 duration 0s status 104
 ofonod[8291]: src/voicecall.c:ofono_voicecall_disconnected() Got
 disconnection event for id: 1, reason: 0
 ofonod[8291]: Call Ended on modem: 0xa0a01a0
 ofonod[8291]: Voice Call, Outgoing
 ofonod[8291]: To: 13917758428
 ofonod[8291]: StartTime: 2010-11-11T10:15:16+0800
 ofonod[8291]: EndTime: 2010-11-11T10:15:57+0800
 ofonod[8291]: PCUI:  \r\n^MODE:3,3\r\n
 ofonod[8291]: PCUI:  \r\n^BOOT:20294233,0,0,0,20\r\n
 
 *
 Set HideCallerId to enabled
 ./test-voicecall 13917758428
 *
 
 ofonod[8291]: PCUI:  ATD13917758428;\r
 ofonod[8291]: PCUI:  \r\nOK\r\n\r\n^ORIG:1,0\r\n
 ofonod[8291]: src/voicecall.c:dial_handle_result() Registering new call:
 1
 ofonod[8291]: src/audio-settings.c:ofono_audio_settings_active_notify()
 active 1
 

Re: [PATCH v4 2/2] stemodem: Update gprs-context to use rtnl to create/remove interfaces.

2010-11-10 Thread Marcel Holtmann
Hi Sjur,

  drivers/stemodem/gprs-context.c |  207 
 +--
  1 files changed, 135 insertions(+), 72 deletions(-)
 
 diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
 index 9f59579..4260d31 100644
 --- a/drivers/stemodem/gprs-context.c
 +++ b/drivers/stemodem/gprs-context.c
 @@ -28,6 +28,7 @@
  #include string.h
  #include stdlib.h
  #include stdio.h
 +#include errno.h
  
  #include glib.h
  
 @@ -46,10 +47,11 @@
  #include stemodem.h
  #include caif_socket.h
  #include if_caif.h
 +#include caif_rtnl.h
  
 -#define MAX_CAIF_DEVICES 7
 +#define MAX_CAIF_DEVICES 4

Can you please not try to squeeze such change in the same patch. Just
have a separate one that does this change.

  #define MAX_DNS 2
 -#define MAX_ELEM 20
 +#define IP_ADDR_LEN 20
  
  #define AUTH_BUF_LENGTH (OFONO_GPRS_MAX_USERNAME_LENGTH + \
   OFONO_GPRS_MAX_PASSWORD_LENGTH + 128)
 @@ -65,21 +67,29 @@ struct gprs_context_data {
  };
  
  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;
 - unsigned int device;
 + /* Id used by CAIF and EPPSD to identify the CAIF channel*/
   unsigned int channel_id;
 - char interface[10];
 + /* Linux Interface Id */
 + unsigned int ifindex;

So I realized now that you are using ifindex as input for
caif_rtnl_delete_interface, now I am questioning why there is a result
parameter in the callback for caif_rtnl_create_interface.

 + /* Linux Interface name */
 + char interface[IF_NAMESIZE];
 + gboolean created;
  };
  
  struct eppsd_response {
   char *current;
 - char ip_address[MAX_ELEM];
 - char subnet_mask[MAX_ELEM];
 - char mtu[MAX_ELEM];
 - char default_gateway[MAX_ELEM];
 - char dns_server1[MAX_ELEM];
 - char dns_server2[MAX_ELEM];
 - char p_cscf_server[MAX_ELEM];
 + char ip_address[IP_ADDR_LEN];
 + char subnet_mask[IP_ADDR_LEN];
 + char mtu[IP_ADDR_LEN];
 + char default_gateway[IP_ADDR_LEN];

Why are we having this in the first place. CAIF network interfaces are
point-to-point, right? In that case you should just leave this NULL.

 + char dns_server1[IP_ADDR_LEN];
 + char dns_server2[IP_ADDR_LEN];
 + char p_cscf_server[IP_ADDR_LEN];
  };
  
  static void start_element_handler(GMarkupParseContext *context,
 @@ -122,8 +132,8 @@ static void text_handler(GMarkupParseContext *context,
   struct eppsd_response *rsp = user_data;
  
   if (rsp-current) {
 - strncpy(rsp-current, text, MAX_ELEM);
 - rsp-current[MAX_ELEM] = 0;
 + strncpy(rsp-current, text, IP_ADDR_LEN);
 + rsp-current[IP_ADDR_LEN] = 0;

Please use '\0' instead of just 0. You might need to fix this at other
places as well.

   }
  }
  
 @@ -153,8 +163,7 @@ static gint conn_compare_by_cid(gconstpointer a, 
 gconstpointer b)
   return 0;
  }
  
 -static struct conn_info *conn_info_create(unsigned int device,
 - unsigned int channel_id)
 +static struct conn_info *conn_info_create(unsigned int channel_id)
  {
   struct conn_info *connection = g_try_new0(struct conn_info, 1);
  
 @@ -162,26 +171,61 @@ static struct conn_info *conn_info_create(unsigned int 
 device,
   return NULL;
  
   connection-cid = 0;
 - connection-device = device;
   connection-channel_id = channel_id;
  
   return connection;
  }
  
 +static void rtnl_callback(int result, gpointer user_data,
 + char *ifname, int ifindex)
 +{
 + struct conn_info *conn = user_data;
 +
 + strncpy(conn-interface, ifname, sizeof(conn-interface));
 + conn-ifindex = ifindex;
 +
 + if (result == 0)
 + conn-created = TRUE;
 + else {
 + conn-created = FALSE;
 + DBG(Could not create CAIF Interface);
 + }
 +}

So here is the think. This makes no sense. Either you get an error and
ifname and index are not valid or you succeed.

So this should be something like

if (ifname  0) {
connman_error(...)
return;
}



 +
  /*
   * Creates a new IP interface for CAIF.
   */
 -static gboolean caif_if_create(const char *interface, unsigned int connid)
 +static gboolean caif_if_create(struct conn_info *conn)
  {
 - return FALSE;
 + int err;
 +
 + err = caif_rtnl_create_interface(conn, IFLA_CAIF_IPV4_CONNID,
 + conn-channel_id, FALSE, rtnl_callback);
 + if (err  0) {
 + DBG(Failed to create IP interface for CAIF);
 + return FALSE;
 + }
 +
 + return TRUE;
  }
  
  /*
   * Removes IP interface for CAIF.
   */
 -static gboolean caif_if_remove(const char *interface, unsigned int connid)
 +static void caif_if_remove(struct conn_info *conn)
  {
 - return