Re: [PATCH] call-forwarding: fix for showing call forwarding states

2011-03-11 Thread Denis Kenzior
Hi Jussi,

On 03/09/2011 04:27 AM, Jussi Kangas wrote:
> ---
> Hi,
> 
> Here is a fix for call forwarding issue Jarko found a while back. ( TODO
> issue "Call forwarding state handling change" and mailing list
> conversation "Ofono CF states not always correct" ).
> 
> Br,
> Jussi
> 
>  src/call-forwarding.c |   78 
> -
>  1 files changed, 70 insertions(+), 8 deletions(-)
> 
> diff --git a/src/call-forwarding.c b/src/call-forwarding.c
> index d13f990..6f81296 100644
> --- a/src/call-forwarding.c
> +++ b/src/call-forwarding.c
> @@ -514,10 +514,24 @@ static DBusMessage *cf_get_properties_reply(DBusMessage 
> *msg,
>   OFONO_PROPERTIES_ARRAY_SIGNATURE,
>   &dict);
>  
> - for (i = 0; i < 4; i++)
> - property_append_cf_conditions(&dict, cf->cf_conditions[i],
> + if (cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL] == 0) {

Please use a comparison to NULL here instead of 0

> + DBG("Append all");
> + for (i = 0; i < 4; i++)
> + property_append_cf_conditions(&dict,
> + cf->cf_conditions[i],
> + BEARER_CLASS_VOICE,
> + cf_type_lut[i]);

Please fix the indentation levels here, the lines following
property_append... should all be the same indentation level.

Also, we might want to skip the unconditional call forwarding settings here.

> + } else {
> + DBG("append only unconditional");
> + property_append_cf_conditions(&dict,
> + cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL],
> + BEARER_CLASS_VOICE,
> + cf_type_lut[0]);
> + for (i = 1; i < 4; i++)
> + property_append_cf_conditions(&dict, NULL,
>   BEARER_CLASS_VOICE,
>   cf_type_lut[i]);

So I'm confused, the TODO entry says we should not return conditional
entries if the unconditional call forwarding is set as they are now
quiescent.

Are you proposing we handle this a bit differently?

> + }
>  
>   if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) ||
>   cf->cfis_record_id > 0)
> @@ -682,8 +696,23 @@ static void set_query_cf_callback(const struct 
> ofono_error *error, int total,
>  
>  static void set_query_next_cf_cond(struct ofono_call_forwarding *cf)
>  {
> - cf->driver->query(cf, cf->query_next, BEARER_CLASS_DEFAULT,
> - set_query_cf_callback, cf);
> + DBusMessage *reply;
> +
> + while (cf->query_next != CALL_FORWARDING_TYPE_NOT_REACHABLE) {
> + if (!cf->cf_conditions[cf->query_next]) {
> + cf->driver->query(cf, cf->query_next,
> + BEARER_CLASS_DEFAULT,
> + set_query_cf_callback, cf);
> + return;
> + } else {
> + cf->query_next++;
> + if (cf->query_next == cf->query_end)
> + break;
> + }
> + }
> +
> + reply = dbus_message_new_method_return(cf->pending);
> + __ofono_dbus_pending_reply(&cf->pending, reply);

Really lost here,

>  }
>  
>  static void set_property_callback(const struct ofono_error *error, void 
> *data)
> @@ -836,6 +865,7 @@ static void disable_conditional_callback(const struct 
> ofono_error *error,
>  static void disable_all_callback(const struct ofono_error *error, void *data)
>  {
>   struct ofono_call_forwarding *cf = data;
> + int i;
>  
>   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
>   DBG("Error occurred during erasure of all");
> @@ -848,6 +878,10 @@ static void disable_all_callback(const struct 
> ofono_error *error, void *data)
>   /* Query all cf types */
>   cf->query_next = CALL_FORWARDING_TYPE_UNCONDITIONAL;
>   cf->query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
> +
> + for (i = 0; i < CALL_FORWARDING_TYPE_ALL; i++)
> + cf->cf_conditions[i] = 0;
> +

For pointers please use NULL instead of 0.

Why are we setting them to NULL here in the first place? And shouldn't
you free the data?

>   set_query_next_cf_cond(cf);
>  }
>  
> @@ -1014,8 +1048,25 @@ static void ss_set_query_cf_callback(const struct 
> ofono_error *error, int total,
>  
>  static void ss_set_query_next_cf_cond(struct ofono_call_forwarding *cf)
>  {
> - cf->driver->query(cf, cf->query_next, BEARER_CLASS_DEFAULT,
> - ss_set_query_cf_callback, cf);
> + DBusMessage *reply;
> +
> + while (cf->query_next != CALL_FORWARDING_TYPE_NOT_REACHABLE) {
> + if (!cf->cf_conditions[cf->query_next]) {
> + cf->driver->query(cf, cf->query_next,
> +  

RE: [PATCH 1/3] ifx: integration of kernel mux (n_gsm) and its line discipline

2011-03-11 Thread Marcel Holtmann
Hi Guillaume,

> > > diff --git a/plugins/ifx.c b/plugins/ifx.c
> > > index 527a8c4..9c2a5c1 100644
> > > --- a/plugins/ifx.c
> > > +++ b/plugins/ifx.c
> > > @@ -26,8 +26,12 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > >  #include 
> > >  #include 
> > > +#include 
> > > +#include 
> > > +#include 
> > 
> > please move unistd.h up since as a rule of thumb, the system headers
> > should be included before the unix ones.
> > 
> > Also gsmmux.h is not acceptable. We have to carry a local copy for a
> > while since otherwise compilation would fail on older kernels.
> 
> Ok. It's what Robertino did in his first patch for the kernel mux integration.
> I've changed that thinking it was better to used the gsmmux.h of the kernel 
> tree. I'll redo that.
> 
> > 
> > Why do you need linux/types.h?
> > 
> 
> Do not really remember :(
> I think this is for the gsmmux.h file but if it's the case it to this file to 
> include this one. I'll review that.

in theory if gsmmux.h requires linux/types.h, then it should include it.

> > >  #include 
> > >  #include 
> > > @@ -75,9 +79,9 @@
> > >  static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "GPRS1:
> > ",
> > >   "GPRS2: ", "GPRS3: ", "Aux: " };
> > >
> > > -static const char *dlc_nodes[NUM_DLC] = { "/dev/ttyGSM1",
> > "/dev/ttyGSM2",
> > > - "/dev/ttyGSM3", "/dev/ttyGSM4",
> > > - "/dev/ttyGSM5", "/dev/ttyGSM6" };
> > > +static const char *dlc_nodes[NUM_DLC] = { "/dev/gsmtty1",
> > "/dev/gsmtty2",
> > > + "/dev/gsmtty3", "/dev/gsmtty4",
> > > + "/dev/gsmtty5", "/dev/gsmtty6" };
> > 
> > I am not a big fan of these hardcoded names. I was not a big fan for
> > the original MUX code and that has not changed.
> > 
> > So what happens if you have to multiplexer running at the same time?
> > 
> 
> No idea. I'll try to analyze this point.

This needs a bit more thinking here. Also in reality the names are not
guaranteed. It might have happened that udev renamed them.

The current code has exactly the same problem. I know that is an issue,
it just happens to be that the current code is not used anyway.

> > >  static const char *none_prefix[] = { NULL };
> > >  static const char *xdrv_prefix[] = { "+XDRV:", NULL };
> > > @@ -392,6 +396,7 @@ static gboolean dlc_ready_check(gpointer
> > user_data)
> > >   struct ifx_data *data = ofono_modem_get_data(modem);
> > >   struct stat st;
> > >   int i;
> > > + GHashTable *options;
> > >
> > >   DBG("");
> > >
> > > @@ -405,8 +410,14 @@ static gboolean dlc_ready_check(gpointer
> > user_data)
> > >   return TRUE;
> > >   }
> > >
> > > + options = g_hash_table_new(g_str_hash, g_str_equal);
> > > + if (options == NULL)
> > > + goto error;
> > > +
> > > + g_hash_table_insert(options, "Local", "on");
> > > +
> > 
> > Why is this needed?
> 
> This is needed for PDP context deactivation.
> If you don't set the local to on a tty close occurs when you do the PDP 
> context deactivation.

That sounds like a kernel bug to me as well. Why is the kernel closing
the TTY if you switch back to AT command mode. We are still holding an
open file descriptor to it.

> > > + ofono_info("Got default configuration...");
> > > + ofono_info("adaption = %d", cfg.adaption);
> > > + ofono_info("encapsulation = %d", cfg.encapsulation);
> > > + ofono_info("initiator = %d", cfg.initiator);
> > > + ofono_info("t1 = %d", cfg.t1);
> > > + ofono_info("t2 = %d", cfg.t2);
> > > + ofono_info("t3 = %d", cfg.t3);
> > > + ofono_info("n2 = %d", cfg.n2);
> > > + ofono_info("mru = %d", cfg.mru);
> > > + ofono_info("mtu = %d", cfg.mtu);
> > > + ofono_info("k = %d", cfg.k);
> > 
> > This pretty heavy debug information and not ofono_info material.
> > 
> 
> Agree. I kept them from the original patch of Robertino but I'll change that.
> 
> > > + cfg.encapsulation = 0; /* encoding - set to basic */
> > > + cfg.initiator = 1; /* we are starting side */
> > > + cfg.mru = 1500;
> > > + cfg.mtu = 1500;
> > > +
> > > + err = ioctl(fd, GSMIOC_SETCONF, &cfg);
> > > + if (err < 0) {
> > > + ofono_error("Failed to configure n_gsm multiplexer: %d",
> > err);
> > > + goto error;
> > > + }
> > > +
> > >   data->dlc_poll_count = 0;
> > >   data->dlc_poll_source = g_timeout_add_seconds(1, dlc_ready_check,
> > >   modem);
> > > @@ -511,6 +557,9 @@ static void mux_setup_cb(gboolean ok, GAtResult
> > *result, gpointer user_data)
> > >   return;
> > >
> > >  error:
> > > + if (ioctl(fd, TIOCSETD, &data->saved_ldisc) < 0)
> > > + ofono_warn("Failed to restore line discipline");
> > > +
> > 
> > This is not right. Even if you fail GSMIOC_GETCONF you try to restore
> > the line discipline. That makes no sense.
> > 
> 
> Agree that is not right but not for the GSMIOC_GETCONF failing.
> It's not right because I try to r

Re: [PATCH] atmodem: Enable network time for AT modem

2011-03-11 Thread Marcel Holtmann
Hi Antti,

> > >  drivers/atmodem/network-registration.c |2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/atmodem/network-registration.c 
> > > b/drivers/atmodem/network-registration.c
> > > index 4913611..2d589f0 100644
> > > --- a/drivers/atmodem/network-registration.c
> > > +++ b/drivers/atmodem/network-registration.c
> > > @@ -722,6 +722,8 @@ static void ifx_ctzv_notify(GAtResult *result, 
> > > gpointer user_data)
> > >   nd->time.mday = mday;
> > >   nd->time.mon = mon;
> > >   nd->time.year = 2000 + year;
> > > +
> > > + ofono_netreg_time_notify(netreg, &nd->time);
> > >  }
> > >  
> > >  static void ifx_ctzdst_notify(GAtResult *result, gpointer user_data)
> > 
> > actually this time notification is a bad idea since you will notify
> > twice now. With the firmware that I tested this with, it is guaranteed
> > to always get CTZV and CTZDST and in that order.
> 
> Of course there will be two notifications since there are two distinct
> event CTZV and CTDST. My ifx modem documentation doesn't say that these
> are always bound together so we should not make any implicit assumption.
> Anyway I believe that it is the next level i.e. time plug-in whose job
> it is to check whether it has all the bits and pieces needed to inform
> the Timed or some other client.

that is a clear no here. We are not making every single nettime plugin
responsible for handling this. This needs to be handled either in the
core or in the drivers.

If you are afraid of the IFX modem not sending CTZV + CTZDST all the
time, then you need to handle this with a timeout to trigger notifying
nettime core.

However, I have not seen that yet on any network I have tested this on.
Also asking IFX to confirm the current assumption would just work.

Regards

Marcel


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


Re: [PATCH] simfs: fix GLib-CRITICAL issue occuring when there is no SIM card.

2011-03-11 Thread Denis Kenzior
Hi Guillaume,

On 03/09/2011 06:32 AM, Lucas, GuillaumeX wrote:
> From: Guillaume Lucas 
> 
> During modem release, when there is no SIM card, a GLib-CRITICAL
> issue occurs during the free of the sim fs context.
> ---
>  src/simfs.c |   26 ++
>  1 files changed, 14 insertions(+), 12 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [PATCH] TODO: mark 'GPS power control atom' task as done

2011-03-11 Thread Denis Kenzior
Hi Lucas,

On 03/11/2011 02:29 PM, Lucas De Marchi wrote:
> ---
>  TODO |   11 ---
>  doc/features.txt |8 
>  2 files changed, 8 insertions(+), 11 deletions(-)

Patch has been applied, thanks.

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


Re: [PATCH] stk: fix issue with null data object

2011-03-11 Thread Denis Kenzior
Hi Andrew,

On 03/11/2011 03:39 AM, Andrzej Zaborowski wrote:
> This will let the caller correctly detect NULL alpha id.
> ---
>  src/stkutil.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

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


[PATCH] stk: fix issue with null data object

2011-03-11 Thread Andrzej Zaborowski
This will let the caller correctly detect NULL alpha id.
---
 src/stkutil.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index abd1c99..c64cb7a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -309,7 +309,7 @@ static gboolean parse_dataobj_alpha_id(struct 
comprehension_tlv_iter *iter,
 
len = comprehension_tlv_iter_get_length(iter);
if (len == 0) {
-   *alpha_id = g_try_malloc0(1);
+   *alpha_id = NULL;
return TRUE;
}
 
-- 
1.7.1.86.g0e460.dirty

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


[PATCH] TODO: mark 'GPS power control atom' task as done

2011-03-11 Thread Lucas De Marchi
---
 TODO |   11 ---
 doc/features.txt |8 
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/TODO b/TODO
index c432cba..9db9e0b 100644
--- a/TODO
+++ b/TODO
@@ -444,17 +444,6 @@ Miscellaneous
   Complexity: C8
   Owner: Jukka Saunamäki 
 
-- Add support for GPS power control atom.  Many modem manufacturers provide
-  a GPS unit with their modem hardware.  This unit can be turned on or off
-  and frequently takes over one of the tty ports that the modem provides.
-
-  This feature is not discussed in 27.007, thus manufacturer specific commands
-  are required.
-
-  Priority: Low
-  Complexity: C4
-  Owner: Rafael Ignacio Zurita 
-
 - Add Location Service API for providing basic E911 support.
   This will be based on the 27.007 defined AT commands using
   XML for transport of positioning request and responses.
diff --git a/doc/features.txt b/doc/features.txt
index ed4c058..ce36265 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -492,6 +492,14 @@ GPRS
   suspended while a circuit switched service such as voice call or SMS is
   active.
 
+Location Reporting
+==
+
+- GPS support. Many modem manufacturers provide a GPS unit with their modem
+  hardware.  Upon client request oFono can turn this unit on or off and pass a
+  file descriptor in which client may receive the desired location reporting
+  data.
+
 SIM
 ===
 
-- 
1.7.4.1

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


Re: [PATCH] dun_gw: Fix automatic GIOChannel closing when a bluetooth connection is attempted.

2011-03-11 Thread Denis Kenzior
Hi Guillaume,

On 03/11/2011 07:39 AM, Guillaume Zajac wrote:
> ---
>  plugins/dun_gw.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [PATCH v2] test/test-message-waiting: Add a new test file to validate org.ofono.MessageWaiting

2011-03-11 Thread Denis Kenzior
Hi Bertrand,

On 03/09/2011 07:31 AM, Bertrand Aygon wrote:
> ---
>  Makefile.am   |3 ++-
>  test/test-message-waiting |   40 
>  2 files changed, 42 insertions(+), 1 deletions(-)
>  create mode 100755 test/test-message-waiting
> 

Patch has been applied, thanks.

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


Re: [PATCH] Isimodem: Crash while setting SCA

2011-03-11 Thread Denis Kenzior
Hi Arun,

On 03/11/2011 06:49 AM, ext-arun.1.ravind...@nokia.com wrote:
> From: Arun Ravindran 
> 
> ---
>  drivers/isimodem/sms.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

I applied the patch, however...

> diff --git a/drivers/isimodem/sms.c b/drivers/isimodem/sms.c
> index 957b342..c90c06d 100644
> --- a/drivers/isimodem/sms.c
> +++ b/drivers/isimodem/sms.c
> @@ -292,7 +292,7 @@ static void isi_sca_set(struct ofono_sms *sms,
>   { &sd->params, sizeof(sd->params) },
>   };
>  
> - if (cbd == NULL || sd == NULL)
> + if (cbd == NULL || sd == NULL || sd->sim == NULL)

The check for sd == NULL is too late since sd->params is being used up
above for initialization of iov...

>   goto error;
>  
>   bcd = sd->params.sca;

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


Re: [PATCH] atmodem: fix PB reading when fields are omitted

2011-03-11 Thread Denis Kenzior
Hi Paavo,

On 03/11/2011 06:25 AM, Paavo Leinonen wrote:
> Fix SIM PB reading when numeric fields have been omitted.
> 
> ---
> 
> Hi,
> 
> Here is the fix for SIM PB reading as proposed.
> 
> BR,
> Paavo
> 
>  drivers/atmodem/phonebook.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [RFC PATCH 3/5] voicecall: implement SSN handling functions

2011-03-11 Thread Denis Kenzior
Hi Andras,

> +static struct voicecall *voicecall_select(struct ofono_voicecall *vc,
> + unsigned int id, int code)
> +{
> + struct voicecall *v = NULL;
> + GSList *l;
> +
> + if (id != 0) {
> + l = g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(id),
> + call_compare_by_id);
> +
> + if (l == NULL)
> + return NULL;
> +
> + v = l->data;
> + } else if (g_slist_length(vc->call_list) == 1) {
> + v = vc->call_list->data;
> +
> + switch (code) {
> + case SS_MT_VOICECALL_RETRIEVED:
> + if (v->remote_held != TRUE)
> + return NULL;
> + break;
> + case SS_MT_VOICECALL_ON_HOLD:
> + if (v->remote_held == TRUE)
> + return NULL;
> + break;
> + case SS_MT_MULTIPARTY_VOICECALL:
> + if (v->remote_multiparty == TRUE)
> + return NULL;
> + break;
> + default:
> + return NULL;
> + }

I was mostly fine with this patch, but didn't see the real need in these
checks, so I re-factored the patch slightly afterward.  Let me know if I
broke something.

> + }
> +
> + return v;
> +}
> +

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


Re: [PATCH 0/5] Voice call SS notifications (4th version)

2011-03-11 Thread Denis Kenzior
Hi Andras,

On 03/04/2011 11:12 AM, Andras Domokos wrote:
> Implementation proposal for handling some of the voice call
> related Supplementary Services (SS) notifications.
> 
> Implementation details:
> - removed SSN atom and all the dependencies
> - (re)implemented voice call SS notification handling framework
> - added voice call SS notification handling to AT modem driver
>   (+CSSU and +CSSI notifications) 
> - added voice call SS notification handling to ISI modem driver
> 
> Andras Domokos (5):
>   ssn: remove SSN atom completely
>   voicecall: add SSN function declarations
>   voicecall: implement SSN handling functions
>   atmodem: implement SSN handling
>   isimodem: implement SSN handling

I pushed all of these patches upstream, thanks.

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


Re: Setting PDP mode

2011-03-11 Thread Denis Kenzior
Hi claudio,

On 03/10/2011 02:33 AM, claudio wrote:
> 
> Hi,
> 
> It's possible to set the pdp mode through ofono ? I need to set the pdp
> mode to auto, ip and ppp,

I'm not sure what you mean by 'auto' pdp mode.

The protocol selection (IP, IPv6 or dual stack IPv4 & IPv6 combined) is
currently work in progress, but we support IP contexts already.  Refer
to the Protocol property of ConnectionContext interface in
doc/connman-api.txt

oFono does not allow you to select the actual protocol used to talk to
the modem (e.g. PPP, high-speed, or some vendor specific) for gprs
contexts.  In fact it does not even care itself.  It is up to the modem
driver to figure out the best protocol for that particular modem.

> 
> What are the dbus interface and properties to use ?
>

Refer to doc/connman-api.txt

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


Re: Request for info for issuing AT commands

2011-03-11 Thread Denis Kenzior
Hi Debanjan,

On 03/11/2011 12:08 AM, Debanjan Biswas (debiswas) wrote:
> Thanks for the info Bertrand. I will have a look.

A gentle reminder to not top-post on this mailing list.

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


RE: Setting PDP mode

2011-03-11 Thread Aygon, Bertrand
> Hi,
>
> It's possible to set the pdp mode through ofono ? I need to set the pdp
> mode to auto, ip and ppp,
>
> What are the dbus interface and properties to use ?

Hi,

You should have a look at doc/connman-api.txt.

In the org.ofono.ConnectionContext interface, there is a 'Protocol' properties.

But I am not so familiar with oFono yet, and it seems that only IP is 
supported. IPv6 works seems in progress.

And from what I could have seen in the sources, oFono only 'discuss' with modem 
making IP data call. For PPP, oFono use its own PPP stack.

So to conclude, I don't think that you can change the PDP mode, but I hope that 
someone with a biggest background, which should be very easy to found, will 
give us some more detailed info.

Regards,

Bertrand.
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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


RE: [HELP Required]Routing Of SCO data to BT Host Speaker

2011-03-11 Thread milan.satpathy
Hi Daniel,

Thanks for the quick assistance.

I tried the same approach as suggested by you.

Steps:
--
1.$pacmd
2.$list-sources
( got 2 sources )

  name: 

  (and)

  name: 
3.$list-sinks
( got 1 sink )

name: 

4.created a shell script "ofono.sh" with contents as below:
pactl load-module module-loopback 
source="alsa_input.pci-_00_05.0.analog-stereo" 
sink="bluez_sink.A8_7E_33_AF_23_A4"
pactl load-module module-loopback source="bluez_source.A8_7E_33_AF_23_A4" 
sink="alsa_output.pci-_00_05.0.analog-stereo"
(A8_7E_33_AF_23_A4 is the BT address of handset paired to the host)

5. Now I connect the host to the handset through HFP.
6.After SLC is established , I dial a number and establish a voice call.
7.As soon as the state is "Playing" ( SCO connected) , I run the "ofono.sh" ( 
as mentioned in step 4).

Result:
---
I am getting the following errors:

Failure: Module initalization failed
Failure: Module initalization failed


Requesting Clarification

1.I was wondering if any modification is required in pulseaudio configuration 
files to enable dynamic loading of module-loopback.( e.g "module-loading = yes" 
in /etc/pulse/daemon.conf ).Currently all settings are maintained as default.

2.Also, do I need to modify "SCORouting=PCM" in "audio.conf" file. (default is 
HCI)

It will be of great help to receive any further inputs regarding the above 
issue.

Best Regards,
Milan

-Original Message-
From: Daniel Wagner [mailto:w...@monom.org]
Sent: Friday, March 11, 2011 12:52 PM
To: Satpathy, Milan
Cc: ofono@ofono.org
Subject: Re: [HELP Required]Routing Of SCO data to BT Host Speaker

Hi Milan,

On Fri, Mar 11, 2011 at 10:56:34AM +0530, milan.satpa...@accenture.com wrote:
> Hi,
>
> Recently I have been trying to use Ofono to write a Handsfree based 
> application( Using C on Ubuntu 10.10).
> I am able to connect(SLC) to the AG using Ofono. After connection I am also 
> successful in dialing to another number.
> Bluetoothd indicates status as "Playing" ( SCO connection successful) once 
> the call is established.
>
> Problem Faced:
> --
> However, after accepting the call I am unable to hear any voice through the 
> speaker.

You might have to loop back the PulseAudio BT source and sink to your sound 
card, e.g.

pactl load-module module-loopback 
source="alsa_input.pci-_00_1b.0.analog-stereo" 
sink="bluez_sink.78_47_1D_44_34_10"
pactl load-module module-loopback source="bluez_source.78_47_1D_44_34_10" 
sink="alsa_output.pci-_00_1b.0.analog-stereo"

You have to do this within 5 seconds after the SCO connection has been
established otherwise PulseAudio will suspend (which leads to a BT
stream stop) the streams.

HTH,
daniel


This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] dun_gw: Fix automatic GIOChannel closing when a bluetooth connection is attempted.

2011-03-11 Thread Guillaume Zajac
---
 plugins/dun_gw.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/dun_gw.c b/plugins/dun_gw.c
index 53edc74..3bc4836 100644
--- a/plugins/dun_gw.c
+++ b/plugins/dun_gw.c
@@ -101,7 +101,7 @@ static void dun_gw_connect_cb(GIOChannel *io, GError *err, 
gpointer user_data)
}
 
fd = g_io_channel_unix_get_fd(io);
-   g_io_channel_set_close_on_unref(io, TRUE);
+   g_io_channel_set_close_on_unref(io, FALSE);
 
ofono_emulator_register(em, fd);
 }
-- 
1.7.1

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


[PATCH] Isimodem: Crash while setting SCA

2011-03-11 Thread ext-arun . 1 . ravindran
From: Arun Ravindran 

---
 drivers/isimodem/sms.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/isimodem/sms.c b/drivers/isimodem/sms.c
index 957b342..c90c06d 100644
--- a/drivers/isimodem/sms.c
+++ b/drivers/isimodem/sms.c
@@ -292,7 +292,7 @@ static void isi_sca_set(struct ofono_sms *sms,
{ &sd->params, sizeof(sd->params) },
};
 
-   if (cbd == NULL || sd == NULL)
+   if (cbd == NULL || sd == NULL || sd->sim == NULL)
goto error;
 
bcd = sd->params.sca;
-- 
1.7.0.4

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


Re: [PATCH] atmodem: Enable network time for AT modem

2011-03-11 Thread Antti Paila
Hi Marcel,

On Tue, 2011-03-08 at 09:12 -0800, ext Marcel Holtmann wrote:
> Hi Antti,
> 
> >  drivers/atmodem/network-registration.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/atmodem/network-registration.c 
> > b/drivers/atmodem/network-registration.c
> > index 4913611..2d589f0 100644
> > --- a/drivers/atmodem/network-registration.c
> > +++ b/drivers/atmodem/network-registration.c
> > @@ -722,6 +722,8 @@ static void ifx_ctzv_notify(GAtResult *result, gpointer 
> > user_data)
> > nd->time.mday = mday;
> > nd->time.mon = mon;
> > nd->time.year = 2000 + year;
> > +
> > +   ofono_netreg_time_notify(netreg, &nd->time);
> >  }
> >  
> >  static void ifx_ctzdst_notify(GAtResult *result, gpointer user_data)
> 
> actually this time notification is a bad idea since you will notify
> twice now. With the firmware that I tested this with, it is guaranteed
> to always get CTZV and CTZDST and in that order.

Of course there will be two notifications since there are two distinct
event CTZV and CTDST. My ifx modem documentation doesn't say that these
are always bound together so we should not make any implicit assumption.
Anyway I believe that it is the next level i.e. time plug-in whose job
it is to check whether it has all the bits and pieces needed to inform
the Timed or some other client.

BR,
  Antti 

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


[PATCH] atmodem: fix PB reading when fields are omitted

2011-03-11 Thread Paavo Leinonen
Fix SIM PB reading when numeric fields have been omitted.

---

Hi,

Here is the fix for SIM PB reading as proposed.

BR,
Paavo

 drivers/atmodem/phonebook.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index 97213db..ebac563 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -172,10 +172,10 @@ static void at_cpbr_notify(GAtResult *result, gpointer 
user_data)
continue;
}
 
-   g_at_result_iter_next_number(&iter, &hidden);
+   g_at_result_iter_next_number_default(&iter, 0, &hidden);
parse_text(&iter, &group, current);
g_at_result_iter_next_string(&iter, &adnumber);
-   g_at_result_iter_next_number(&iter, &adtype);
+   g_at_result_iter_next_number_default(&iter, 0, &adtype);
parse_text(&iter, &secondtext, current);
parse_text(&iter, &email, current);
parse_text(&iter, &sip_uri, current);
-- 
1.7.1

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


[PATCH 08/12] gatchat: fix gatsyntax to support +CPOS

2011-03-11 Thread Jarko Poutiainen
---
 gatchat/gatsyntax.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatsyntax.c b/gatchat/gatsyntax.c
index 2fc70b8..f1d896b 100644
--- a/gatchat/gatsyntax.c
+++ b/gatchat/gatsyntax.c
@@ -64,6 +64,9 @@ static void gsmv1_hint(GAtSyntax *syntax, GAtSyntaxExpectHint 
hint)
case G_AT_SYNTAX_EXPECT_MULTILINE:
syntax->state = GSMV1_STATE_GUESS_MULTILINE_RESPONSE;
break;
+   case G_AT_SYNTAX_EXPECT_SHORT_PROMPT:
+   syntax->state = GSMV1_STATE_PROMPT;
+   break;
default:
break;
};
@@ -195,6 +198,13 @@ static GAtSyntaxResult gsmv1_feed(GAtSyntax *syntax,
i += 1;
res = G_AT_SYNTAX_RESULT_PROMPT;
goto out;
+   } else if (byte == '\r')
+   break;
+   else if (byte == '\n') {
+   syntax->state = GSMV1_STATE_IDLE;
+   i += 1;
+   res = G_AT_SYNTAX_RESULT_PROMPT;
+   goto out;
}
 
syntax->state = GSMV1_STATE_RESPONSE;
@@ -239,6 +249,8 @@ static void gsm_permissive_hint(GAtSyntax *syntax, 
GAtSyntaxExpectHint hint)
 {
if (hint == G_AT_SYNTAX_EXPECT_PDU)
syntax->state = GSM_PERMISSIVE_STATE_GUESS_PDU;
+   else if (hint == G_AT_SYNTAX_EXPECT_SHORT_PROMPT)
+   syntax->state = GSM_PERMISSIVE_STATE_PROMPT;
 }
 
 static GAtSyntaxResult gsm_permissive_feed(GAtSyntax *syntax,
@@ -298,6 +310,13 @@ static GAtSyntaxResult gsm_permissive_feed(GAtSyntax 
*syntax,
i += 1;
res = G_AT_SYNTAX_RESULT_PROMPT;
goto out;
+   } else if (byte == '\r')
+   break;
+   else if (byte == '\n') {
+   syntax->state = GSM_PERMISSIVE_STATE_IDLE;
+   i += 1;
+   res = G_AT_SYNTAX_RESULT_PROMPT;
+   goto out;
}
 
syntax->state = GSM_PERMISSIVE_STATE_RESPONSE;
-- 
1.7.0.4

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


[PATCH 12/12] test: add test-gnss

2011-03-11 Thread Jarko Poutiainen
---
 Makefile.am|3 +-
 test/test-gnss |   91 
 2 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100755 test/test-gnss

diff --git a/Makefile.am b/Makefile.am
index 3dae7f4..daa5dd0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -503,7 +503,8 @@ test_scripts = test/backtrace \
test/cdma-hangup \
test/disable-call-forwarding \
test/list-messages \
-   test/test-sms
+   test/test-sms \
+   test/test-gnss
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/test-gnss b/test/test-gnss
new file mode 100755
index 000..d7d9027
--- /dev/null
+++ b/test/test-gnss
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+
+import gobject
+import sys
+import os
+
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+
+class PositioningAgent(dbus.service.Object):
+   @dbus.service.method("org.ofono.PositioningRequestAgent",
+   in_signature="", out_signature="")
+   def Release(self):
+   print "Release"
+   mainloop.quit()
+
+   @dbus.service.method("org.ofono.PositioningRequestAgent",
+   in_signature="s", out_signature="")
+   def Request(self, xml):
+   print "positioning data: %s" % (xml)
+
+   @dbus.service.method("org.ofono.PositioningRequestAgent",
+   in_signature="", out_signature="")
+   def ResetAssistanceData(self):
+   print "Reset Assistance Data request received"
+
+def print_menu():
+   print "Select test case"
+   print "---"
+   print "[0] SendPositioningElement"
+   print "[1] RegisterPositioningRequestAgent"
+   print "[2] UnregisterPositioningRequestAgent"
+   print "[x] Exit"
+   print "---"
+
+def stdin_handler(fd, condition, positioning, path):
+
+   in_key = os.read(fd.fileno(), 8).rstrip()
+   if in_key == '0':
+   xml = raw_input('type the element and press enter: ')
+   try:
+   positioning.SendPositioningElement(dbus.String(xml))
+   print "ok"
+   except dbus.DBusException, e:
+   print "Unable to send positioning element"
+
+   elif in_key == '1':
+   try:
+   
positioning.RegisterPositioningRequestAgent("/test/posagent")
+   print "ok"
+   except dbus.DBusException, e:
+   print "Unable to register positioning agent"
+
+   elif in_key == '2':
+   try:
+   positioning.UnregisterPositioningRequestAgent(path)
+   print "ok"
+   except dbus.DBusException, e:
+   print "Unable to unregister positioning agent"
+   elif in_key == 'x':
+   sys.exit(1)
+
+   return True
+
+if __name__ == "__main__":
+
+   if len(sys.argv) < 1:
+   sys.exit(1)
+
+   dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+   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.AssistedSatelliteNavigation" not in 
properties["Interfaces"]:
+   continue
+
+   positioning = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.AssistedSatelliteNavigation')
+
+   path = "/test/posagent"
+   agent = PositioningAgent(bus, path)
+
+   print_menu()
+
+   gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler, 
positioning, path)
+   mainloop = gobject.MainLoop()
+   mainloop.run()
-- 
1.7.0.4

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


[PATCH 07/12] gatchat: implementation for +CPOS send

2011-03-11 Thread Jarko Poutiainen
---
 gatchat/gatchat.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 3fd564d..64f131d 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -1468,6 +1468,19 @@ guint g_at_chat_send_pdu_listing(GAtChat *chat, const 
char *cmd,
listing, func, user_data, notify);
 }
 
+guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd,
+   const char **prefix_list, GAtResultFunc func,
+   gpointer user_data, GDestroyNotify notify)
+{
+   if(chat != NULL)
+   chat->parent->syntax->set_hint(chat->parent->syntax,
+   G_AT_SYNTAX_EXPECT_SHORT_PROMPT);
+
+   return at_chat_send_common(chat->parent, chat->group,
+   cmd, prefix_list, FALSE, NULL,
+   func, user_data, notify);
+}
+
 gboolean g_at_chat_cancel(GAtChat *chat, guint id)
 {
/* We use id 0 for wakeup commands */
-- 
1.7.0.4

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


[PATCH 06/12] gatchat:new hint to handle +CPOS

2011-03-11 Thread Jarko Poutiainen
---
 gatchat/gatsyntax.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gatchat/gatsyntax.h b/gatchat/gatsyntax.h
index afc0bd3..2580ec6 100644
--- a/gatchat/gatsyntax.h
+++ b/gatchat/gatsyntax.h
@@ -29,7 +29,8 @@ extern "C" {
 enum _GAtSyntaxExpectHint {
G_AT_SYNTAX_EXPECT_PDU,
G_AT_SYNTAX_EXPECT_MULTILINE,
-   G_AT_SYNTAX_EXPECT_PROMPT
+   G_AT_SYNTAX_EXPECT_PROMPT,
+   G_AT_SYNTAX_EXPECT_SHORT_PROMPT
 };
 
 typedef enum _GAtSyntaxExpectHint GAtSyntaxExpectHint;
-- 
1.7.0.4

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


[PATCH 11/12] ofono.conf: add positioning agent interface

2011-03-11 Thread Jarko Poutiainen
---
 src/ofono.conf |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/ofono.conf b/src/ofono.conf
index 0dfa038..8a83cd0 100644
--- a/src/ofono.conf
+++ b/src/ofono.conf
@@ -13,6 +13,7 @@
 
 
 
+
   
 
   
-- 
1.7.0.4

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


[PATCH 05/12] gatchat:introduce send for +CPOS

2011-03-11 Thread Jarko Poutiainen
---
 gatchat/gatchat.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h
index 8cbb559..eb82daa 100644
--- a/gatchat/gatchat.h
+++ b/gatchat/gatchat.h
@@ -124,6 +124,14 @@ guint g_at_chat_send_pdu_listing(GAtChat *chat, const char 
*cmd,
GAtNotifyFunc listing, GAtResultFunc func,
gpointer user_data, GDestroyNotify notify);
 
+/*!
+ * Same as g_at_chat_send except parser will know to expect short prompt syntax
+ * used with +CPOS.
+ */
+guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd,
+   const char **valid_resp, GAtResultFunc func,
+   gpointer user_data, GDestroyNotify notify);
+
 gboolean g_at_chat_cancel(GAtChat *chat, guint id);
 gboolean g_at_chat_cancel_all(GAtChat *chat);
 
-- 
1.7.0.4

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


[PATCH 09/12] atmodem: add gnss driver

2011-03-11 Thread Jarko Poutiainen
---
 Makefile.am   |3 +-
 drivers/atmodem/atmodem.c |2 +
 drivers/atmodem/atmodem.h |3 +
 drivers/atmodem/gnss.c|  279 +
 4 files changed, 286 insertions(+), 1 deletions(-)
 create mode 100644 drivers/atmodem/gnss.c

diff --git a/Makefile.am b/Makefile.am
index 24742bb..3dae7f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ builtin_sources += $(gatchat_sources) \
drivers/atmodem/atutil.c \
drivers/atmodem/gprs.c \
drivers/atmodem/gprs-context.c \
-   drivers/atmodem/sim-auth.c
+   drivers/atmodem/sim-auth.c \
+   drivers/atmodem/gnss.c
 
 builtin_modules += nwmodem
 builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c
index e140281..3093c23 100644
--- a/drivers/atmodem/atmodem.c
+++ b/drivers/atmodem/atmodem.c
@@ -52,6 +52,7 @@ static int atmodem_init(void)
at_gprs_init();
at_gprs_context_init();
at_sim_auth_init();
+   at_gnss_init();
 
return 0;
 }
@@ -76,6 +77,7 @@ static void atmodem_exit(void)
at_call_volume_exit();
at_gprs_exit();
at_gprs_context_exit();
+   at_gnss_exit();
 }
 
 OFONO_PLUGIN_DEFINE(atmodem, "AT modem driver", VERSION,
diff --git a/drivers/atmodem/atmodem.h b/drivers/atmodem/atmodem.h
index 1b7cf67..1a73b84 100644
--- a/drivers/atmodem/atmodem.h
+++ b/drivers/atmodem/atmodem.h
@@ -74,3 +74,6 @@ extern void at_gprs_context_exit(void);
 
 extern void at_sim_auth_init(void);
 extern void at_sim_auth_exit(void);
+
+extern void at_gnss_init(void);
+extern void at_gnss_exit(void);
diff --git a/drivers/atmodem/gnss.c b/drivers/atmodem/gnss.c
new file mode 100644
index 000..c1b1de3
--- /dev/null
+++ b/drivers/atmodem/gnss.c
@@ -0,0 +1,279 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011 ST-Ericsson AB.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+#define _GNU_SOURCE
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "atmodem.h"
+#include "vendor.h"
+
+struct gnss_data {
+   GAtChat *chat;
+   unsigned int vendor;
+};
+
+static const char *none_prefix[] = { NULL };
+static const char *cpos_prefix[] = { "+CPOS:", NULL };
+static const char *cposr_prefix[] = { "+CPOSR:", NULL };
+
+static void gnsspr_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_gnss_position_report_cb_t cb = cbd->cb;
+
+   DBG("");
+
+   if (ok)
+   CALLBACK_WITH_SUCCESS(cb, cbd->data);
+   else
+   CALLBACK_WITH_FAILURE(cb, cbd->data);
+}
+
+static void at_gnss_position_reporting(struct ofono_gnss *gnss,
+   ofono_bool_t enable,
+   ofono_gnss_position_report_cb_t cb,
+   void *data)
+{
+   struct gnss_data *ad = ofono_gnss_get_data(gnss);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   DBG("");
+
+   if (enable) {
+   g_at_chat_send(ad->chat, "AT+CPOSR=1",
+   cposr_prefix, gnsspr_cb, cbd, g_free);
+
+   if (ad->vendor == OFONO_VENDOR_STE)
+   g_at_chat_send(ad->chat, "AT*EPOSADRR=1",
+   NULL, NULL, NULL, NULL);
+   } else {
+   g_at_chat_send(ad->chat, "AT+CPOSR=0",
+   cposr_prefix, gnsspr_cb, cbd, g_free);
+
+   if (ad->vendor == OFONO_VENDOR_STE)
+   g_at_chat_send(ad->chat, "AT*EPOSADRR=0",
+   NULL, NULL, NULL, NULL);
+   }
+}
+
+static void gnssse_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_gnss_send_element_cb_t cb = cbd->cb;
+
+   DBG("");
+
+   if (ok)
+   CALLBACK_WITH_SUCCESS(cb, cbd->data);
+   else
+  

[PATCH 10/12] ste: add support for gnss

2011-03-11 Thread Jarko Poutiainen
---
 plugins/ste.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/ste.c b/plugins/ste.c
index efae573..749f673 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -65,17 +66,18 @@
 #include 
 #include 
 
-#define NUM_CHAT   5
+#define NUM_CHAT   6
 #define AT_DEFAULT 0
 #define AT_NET 1
 #define AT_VOICE   2
 #define AT_GPRS3
 #define AT_SIM 4
+#define AT_GNSS5
 
 #define MAX_PDP_CONTEXTS   4
 
 static char *chat_prefixes[NUM_CHAT] = { "Default: ", "Net: ", "Voice: ",
-   "GPRS: ", "SIM: " };
+"GPRS: ", "SIM: ", "GNSS:" };
 
 struct ste_data {
GAtChat *chat[NUM_CHAT];
@@ -473,6 +475,8 @@ static void ste_post_online(struct ofono_modem *modem)
ofono_ssn_create(modem, 0, "atmodem", data->chat[AT_DEFAULT]);
ofono_call_volume_create(modem, 0, "atmodem", data->chat[AT_DEFAULT]);
ofono_cbs_create(modem, 0, "atmodem", data->chat[AT_DEFAULT]);
+   ofono_gnss_create(modem, OFONO_VENDOR_STE, "atmodem",
+   data->chat[AT_GNSS]);
 
gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
"atmodem", data->chat[AT_GPRS]);
-- 
1.7.0.4

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


[PATCH 04/12] src: add gnss atom and agent implementation

2011-03-11 Thread Jarko Poutiainen
---
 Makefile.am |3 +-
 src/gnss.c  |  357 +++
 src/gnssagent.c |  152 +++
 src/gnssagent.h |   40 ++
 4 files changed, 551 insertions(+), 1 deletions(-)
 create mode 100644 src/gnss.c
 create mode 100644 src/gnssagent.c
 create mode 100644 src/gnssagent.h

diff --git a/Makefile.am b/Makefile.am
index 7d6acce..24742bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -383,7 +383,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
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/emulator.c src/location-reporting.c
+   src/emulator.c src/location-reporting.c \
+   src/gnss.c src/gnssagent.c src/gnssagent.h
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/gnss.c b/src/gnss.c
new file mode 100644
index 000..02f9057
--- /dev/null
+++ b/src/gnss.c
@@ -0,0 +1,357 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011 ST-Ericsson AB.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+#define _GNU_SOURCE
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "ofono.h"
+
+#include "common.h"
+#include "gnssagent.h"
+
+static GSList *g_drivers = NULL;
+
+struct ofono_gnss {
+   const struct ofono_gnss_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+   DBusMessage *pending;
+   struct gnss_agent *default_agent;
+};
+
+static void gnss_register_agent_cb(const struct ofono_error *error,
+   void *data)
+{
+   DBusMessage *reply;
+   struct ofono_gnss *gnss = data;
+
+   DBG("");
+
+   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+   ofono_error("Enabling Location Reporting Failed");
+   reply = __ofono_error_failed(gnss->pending);
+   gnss_agent_free(gnss->default_agent);
+   __ofono_dbus_pending_reply(&gnss->pending, reply);
+   return;
+   }
+
+   reply = dbus_message_new_method_return(gnss->pending);
+   __ofono_dbus_pending_reply(&gnss->pending, reply);
+}
+
+static void default_agent_notify(gpointer user_data)
+{
+   struct ofono_gnss *gnss = user_data;
+
+   gnss->default_agent = NULL;
+}
+
+static DBusMessage *gnss_register_agent(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   struct ofono_gnss *gnss = data;
+   const char *agent_path;
+
+   if (gnss->pending)
+   return __ofono_error_busy(msg);
+
+   if (gnss->default_agent)
+   return __ofono_error_busy(msg);
+
+   if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH,
+ &agent_path, DBUS_TYPE_INVALID) == FALSE)
+   return __ofono_error_invalid_args(msg);
+
+   if (!__ofono_dbus_valid_object_path(agent_path))
+   return __ofono_error_invalid_format(msg);
+
+   gnss->driver->position_reporting(gnss, 1, gnss_register_agent_cb, gnss);
+
+   gnss->default_agent = gnss_agent_new(agent_path,
+   dbus_message_get_sender(msg),
+   FALSE);
+
+   if (gnss->default_agent == NULL)
+   return __ofono_error_failed(msg);
+
+   gnss_agent_set_removed_notify(gnss->default_agent,
+   default_agent_notify, gnss);
+
+   gnss->pending = dbus_message_ref(msg);
+
+   return NULL;
+}
+
+static void gnss_unregister_agent_cb(const struct ofono_error *error,
+   void *data)
+{
+   DBusMessage *reply;
+   struct ofono_gnss *gnss = data;
+
+   DBG("");
+
+   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+   ofono_error("Disabling Location Reporting Failed");
+   reply = __ofono_error_failed(gnss->pending);
+   goto out;
+   }
+
+   gnss_agent_free(gnss-

[PATCH 02/12] include: add gnss.h file

2011-03-11 Thread Jarko Poutiainen
---
 Makefile.am|2 +-
 include/gnss.h |   76 
 2 files changed, 77 insertions(+), 1 deletions(-)
 create mode 100644 include/gnss.h

diff --git a/Makefile.am b/Makefile.am
index 3f20717..7d6acce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/ctm.h include/cdma-voicecall.h \
include/cdma-sms.h include/sim-auth.h \
include/gprs-provision.h include/emulator.h \
-   include/location-reporting.h
+   include/location-reporting.h include/gnss.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
diff --git a/include/gnss.h b/include/gnss.h
new file mode 100644
index 000..d10ab11
--- /dev/null
+++ b/include/gnss.h
@@ -0,0 +1,76 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011 ST-Ericsson AB.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_GNSS_H
+#define __OFONO_GNSS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+struct ofono_gnss;
+
+typedef void (*ofono_gnss_position_report_cb_t)(const struct ofono_error 
*error,
+   void *data);
+
+typedef void (*ofono_gnss_send_element_cb_t)(const struct ofono_error *error,
+   void *data);
+
+typedef void (*ofono_gnss_report_reset_cb_t)(const struct ofono_error *error,
+   void *data);
+
+struct ofono_gnss_driver {
+   const char *name;
+   int (*probe)(struct ofono_gnss *gnss, unsigned int vendor, void *data);
+   void (*remove)(struct ofono_gnss *gnss);
+   void (*send_element)(struct ofono_gnss *gnss,
+   const char *xml,
+   ofono_gnss_send_element_cb_t cb, void *data);
+   void (*position_reporting)(struct ofono_gnss *gnss,
+   ofono_bool_t enable,
+   ofono_gnss_position_report_cb_t cb,
+   void *data);
+};
+
+void ofono_gnss_receive_request(struct ofono_gnss *gnss, const char *xml);
+void ofono_gnss_receive_reset(struct ofono_gnss *gnss);
+int ofono_gnss_driver_register(const struct ofono_gnss_driver *d);
+void ofono_gnss_driver_unregister(const struct ofono_gnss_driver *d);
+
+struct ofono_gnss *ofono_gnss_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_gnss_register(struct ofono_gnss *gnss);
+void ofono_gnss_remove(struct ofono_gnss *gnss);
+
+void ofono_gnss_set_data(struct ofono_gnss *gnss, void *data);
+void *ofono_gnss_get_data(struct ofono_gnss *gnss);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_GNSS_H */
-- 
1.7.0.4

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


[PATCH 03/12] src: add atom type for gnss

2011-03-11 Thread Jarko Poutiainen
---
 src/ofono.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index 995a1a5..2c6899e 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -131,6 +131,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_EMULATOR_DUN,
OFONO_ATOM_TYPE_EMULATOR_HFP,
OFONO_ATOM_TYPE_LOCATION_REPORTING,
+   OFONO_ATOM_TYPE_GNSS,
 };
 
 enum ofono_atom_watch_condition {
@@ -466,3 +467,4 @@ void __ofono_gprs_provision_free_settings(
int count);
 
 #include 
+#include 
-- 
1.7.0.4

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


[PATCH 01/12] dbus: add gnss interface definition

2011-03-11 Thread Jarko Poutiainen
---
 include/dbus.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/dbus.h b/include/dbus.h
index 19a138a..bf3e8a4 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -56,6 +56,8 @@ extern "C" {
 #define OFONO_STK_INTERFACE OFONO_SERVICE ".SimToolkit"
 #define OFONO_SIM_APP_INTERFACE OFONO_SERVICE ".SimToolkitAgent"
 #define OFONO_LOCATION_REPORTING_INTERFACE OFONO_SERVICE ".LocationReporting"
+#define OFONO_AS_NAVIGATION_INTERFACE "org.ofono.AssistedSatelliteNavigation"
+#define OFONO_POSITIONING_REQUEST_INTERFACE "org.ofono.PositioningRequestAgent"
 
 /* CDMA Interfaces */
 #define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE 
"org.ofono.cdma.VoiceCallManager"
-- 
1.7.0.4

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


[PATCH 00/12] basic E911 support

2011-03-11 Thread Jarko Poutiainen
Hi,

This is second attempt to provide implementation for basic E911 support.

Br,
Jarko

Jarko Poutiainen (12):
  dbus: add gnss interface definition
  include: add gnss.h file
  src: add atom type for gnss
  src: add gnss atom and agent implementation
  gatchat:introduce send for +CPOS
  gatchat:new hint to handle +CPOS
  gatchat: implementation for +CPOS send
  gatchat: fix gatsyntax to support +CPOS
  atmodem: add gnss driver
  ste: add support for gnss
  ofono.conf: add positioning agent interface
  test: add test-gnss

 Makefile.am   |   11 +-
 drivers/atmodem/atmodem.c |2 +
 drivers/atmodem/atmodem.h |3 +
 drivers/atmodem/gnss.c|  279 +++
 gatchat/gatchat.c |   13 ++
 gatchat/gatchat.h |8 +
 gatchat/gatsyntax.c   |   19 +++
 gatchat/gatsyntax.h   |3 +-
 include/dbus.h|2 +
 include/gnss.h|   76 ++
 plugins/ste.c |8 +-
 src/gnss.c|  357 +
 src/gnssagent.c   |  152 +++
 src/gnssagent.h   |   40 +
 src/ofono.conf|1 +
 src/ofono.h   |2 +
 test/test-gnss|   91 
 17 files changed, 1060 insertions(+), 7 deletions(-)
 create mode 100644 drivers/atmodem/gnss.c
 create mode 100644 include/gnss.h
 create mode 100644 src/gnss.c
 create mode 100644 src/gnssagent.c
 create mode 100644 src/gnssagent.h
 create mode 100755 test/test-gnss

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


RE: [PATCH 1/2] stk: fix issue with null data object

2011-03-11 Thread Jeevaka.Badrappan
Hi Andrew,

Andrzej Zaborowski wrote:
> Hi Jeevaka
> 
> On 7 March 2011 16:35, Jeevaka Badrappan
>  wrote:
>> As per the specification, if alphad identifier is provided and is a
>> null data object, no information should be given to the user.
> 
> What do do you think of the following change?
> 
> diff --git a/src/stkutil.c b/src/stkutil.c index
> abd1c99..c64cb7a 100644
> --- a/src/stkutil.c
> +++ b/src/stkutil.c
> @@ -309,7 +309,7 @@ static gboolean
> parse_dataobj_alpha_id(struct comprehension_tlv_iter *iter,
> 
> len = comprehension_tlv_iter_get_length(iter); if
> (len == 0) { -   *alpha_id = g_try_malloc0(1);
> +   *alpha_id = NULL;
> return TRUE;
> }
> 
> 
> This actually lets the caller detect a NULL alpha identifier
> and then, as far as I can see, the stk.c code will not give
> any information to the user if either the alpha_id is NULL or not
> provided. 

Change is fine with me.

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


Re: [PATCH 6/9] gatchat: fix gatsyntax to support +CPOS

2011-03-11 Thread Jarko Poutiainen
Hi Denis,

On Fri, 2011-03-11 at 01:11 +0200, Denis Kenzior wrote:
> Hi Jarko,
> 
> Fair enough, sorry for 'shooting the messenger' so to speak ;)
> 
Non taken. :)

> Essentially.  You might have to define a new syntax hint for this
> prompt, namely EXPECT_BROKEN_PROMPT or something like that.
> 
Ok I'll do that... but maybe with less sarcastic naming :D

> I'd suggest inventing a new g_at_chat_send variant that would set this
> hint for you.  Something like g_at_chat_send_and_expect_broken_prompt ;)
> 
That's a great idea, thanks... not referring to naming in anyway of
course ;)

> You will have a very long road trying to implement this feature reliably
> as well.  Lets face it, the spec is broken and the sooner STE modems
> (and the spec) are fixed the better it will be for everyone.
> 
Ok I'll do what little I can.

> Regards,
> -Denis

Br,
Jarko

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