Re: [PATCH] sim: showing lock state with call meter

2011-02-22 Thread Denis Kenzior
Hi Jussi,

>  include/sim.h|2 ++
>  src/call-meter.c |   27 +++
>  src/sim.c|8 
>  3 files changed, 33 insertions(+), 4 deletions(-)
> 
> diff --git a/include/sim.h b/include/sim.h
> index 412ae44..a56056e 100644
> --- a/include/sim.h
> +++ b/include/sim.h
> @@ -227,6 +227,8 @@ unsigned int ofono_sim_add_file_watch(struct 
> ofono_sim_context *context,
>  void ofono_sim_remove_file_watch(struct ofono_sim_context *context,
>   unsigned int id);
>  
> +void sim_pin_check(struct ofono_sim *sim);
> +

Please name this __ofono_sim_recheck_pin(struct ofono_sim *sim);

>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/src/call-meter.c b/src/call-meter.c
> index 0789935..61678d8 100644
> --- a/src/call-meter.c
> +++ b/src/call-meter.c
> @@ -335,11 +335,20 @@ static void set_acm_max_query_callback(const struct 
> ofono_error *error,
>  static void set_acm_max_callback(const struct ofono_error *error, void *data)
>  {
>   struct ofono_call_meter *cm = data;
> + struct ofono_atom *sim_atom;
> + struct ofono_sim *sim = NULL;
>  
>   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
>   DBG("Setting acm_max failed");
>   __ofono_dbus_pending_reply(&cm->pending,
>   __ofono_error_failed(cm->pending));
> + sim_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(cm->atom),
> + OFONO_ATOM_TYPE_SIM);
> + if (!sim_atom)

doc/coding-style.txt M1, and M13

> + return;
> + sim = __ofono_atom_get_data(sim_atom);

doc/coding-style.txt M1

> + sim_pin_check(sim);
>   return;
>   }
>

And please factor out this code into a separate function, you repeat it
three times.

> @@ -396,11 +405,20 @@ static void set_puct_query_callback(const struct 
> ofono_error *error,
>  static void set_puct_callback(const struct ofono_error *error, void *data)
>  {
>   struct ofono_call_meter *cm = data;
> + struct ofono_atom *sim_atom;
> + struct ofono_sim *sim = NULL;
>  
>   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
>   DBG("setting puct failed");
>   __ofono_dbus_pending_reply(&cm->pending,
>   __ofono_error_failed(cm->pending));
> + sim_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(cm->atom),
> + OFONO_ATOM_TYPE_SIM);
> + if (!sim_atom)
> + return;
> + sim = __ofono_atom_get_data(sim_atom);
> + sim_pin_check(sim);
>   return;
>   }
>  
> @@ -593,11 +611,20 @@ static void reset_acm_query_callback(const struct 
> ofono_error *error, int value,
>  static void acm_reset_callback(const struct ofono_error *error, void *data)
>  {
>   struct ofono_call_meter *cm = data;
> + struct ofono_atom *sim_atom;
> + struct ofono_sim *sim = NULL;
>  
>   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
>   DBG("reseting acm failed");
>   __ofono_dbus_pending_reply(&cm->pending,
>   __ofono_error_failed(cm->pending));
> + sim_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(cm->atom),
> + OFONO_ATOM_TYPE_SIM);
> + if (!sim_atom)
> + return;
> + sim = __ofono_atom_get_data(sim_atom);
> + sim_pin_check(sim);
>   return;
>   }
>  
> diff --git a/src/sim.c b/src/sim.c
> index c39269d..08236f2 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -49,7 +49,6 @@
>  static GSList *g_drivers = NULL;
>  
>  static void sim_own_numbers_update(struct ofono_sim *sim);
> -static void sim_pin_check(struct ofono_sim *sim);
>  
>  struct ofono_sim {
>   /* Contents of the SIM file system, in rough initialization order */
> @@ -2231,8 +2230,9 @@ static void sim_pin_query_cb(const struct ofono_error 
> *error,
>   &pin_name);
>   }
>  
> - if (pin_type != OFONO_SIM_PASSWORD_NONE &&
> - sim->state == OFONO_SIM_STATE_READY) {
> + if ((pin_type != OFONO_SIM_PASSWORD_NONE &&
> + sim->state == OFONO_SIM_STATE_READY) &&
> + (pin_type != OFONO_SIM_PASSWORD_SIM_PIN2)) {

I don't see how this can work.  You need to check for pin_type != NONE,
PIN2 and PUK2 AND state == READY here.  This also only covers the case
of the PIN2 or PUK2 being triggered when call-meter is active.  You do
not take care of the case where PIN2 or PUK2 are already required during
sim initialization.

>   /* Force the sim state out of READY */
>   sim_free_main_state(sim);
>  
> @@ -2247,7 +2247,7 @@ checkdone:
>   sim_initialize_af

Re: [PATCH] Add CNAP support (callerid name presentation) to isimodem

2011-02-22 Thread Antoine Reversat
On Tue, Feb 22, 2011 at 4:22 PM, Gustavo F. Padovan
 wrote:
> Hi Antoine,

Hi

>> +     if (!g_isi_sb_iter_get_byte(sb, &pres, 2) ||
>> +                     !g_isi_sb_iter_get_byte(sb, &id, 6) ||
>> +                     !g_isi_sb_iter_get_byte(sb, &len, 7) ||
>> +                     !g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8))
>> +             return;
>
>
> Isn't this better:
>
>        if (!g_isi_sb_iter_get_byte())
>                return;
>        if (!g_isi_sb_iter_get_byte())
>                return;
>        if (!g_isi_sb_iter_get_byte())
>                return;
>        if (!g_isi_sb_iter_get_alpha_tag())
>                return;

It is better, my code is based on isi_call_any_address_sb_proc which
has the same construct. I guess I'll fix both then.

>

I'll fix the rest and resend the patch, thanks.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] Add CNAP support (callerid name presentation) to isimodem

2011-02-22 Thread Gustavo F. Padovan
Hi Antoine,

* Antoine Reversat  [2011-02-22 14:31:24 -0500]:

> ---
>  drivers/isimodem/voicecall.c |   39 ++-
>  src/voicecall.c  |4 ++--
>  2 files changed, 40 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
> index 0a32f27..e778f23 100644
> --- a/drivers/isimodem/voicecall.c
> +++ b/drivers/isimodem/voicecall.c
> @@ -56,8 +56,10 @@ struct isi_call {
>   uint8_t cause;
>   uint8_t addr_type;
>   uint8_t presentation;
> + uint8_t name_presentation;
>   uint8_t reason;
>   char address[20];
> + char name[20];
>   char addr_pad[4];
>  };
>  
> @@ -231,6 +233,7 @@ static void isi_call_origin_address_sb_proc(struct 
> isi_voicecall *ivc,
>   isi_call_any_address_sb_proc(ivc, call, sb);
>  }
>  
> +

Unrelated change here. Please remove.

>  static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,
>   struct isi_call *call,
>   GIsiSubBlockIter *sb)
> @@ -239,6 +242,29 @@ static void isi_call_destination_address_sb_proc(struct 
> isi_voicecall *ivc,
>   isi_call_any_address_sb_proc(ivc, call, sb);
>  }
>  
> +static void isi_call_origin_info_sb_proc(struct isi_voicecall *ivc,
> + struct isi_call *call,
> + GIsiSubBlockIter *sb)
> +{
> + uint8_t pres;
> + uint8_t id;
> + uint8_t len;
> + char *name;
> +

Spaces here.

> + if (!g_isi_sb_iter_get_byte(sb, &pres, 2) ||
> + !g_isi_sb_iter_get_byte(sb, &id, 6) ||
> + !g_isi_sb_iter_get_byte(sb, &len, 7) ||
> + !g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8))
> + return;


Isn't this better:

if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_alpha_tag())
return;

> +

spaces here.

> +
> +DBG("Got name %s", name);

and here.

> + call->name_presentation = pres;
> + strncpy(call->name, name, sizeof(call->name));
> +
> + g_free(name);
> +}
> +
>  static void isi_call_mode_sb_proc(struct isi_voicecall *ivc,
>   struct isi_call *call,
>   GIsiSubBlockIter *sb)
> @@ -396,13 +422,19 @@ static struct ofono_call isi_call_as_ofono_call(const 
> struct isi_call *call)
>   ocall.status = isi_call_status_to_clcc(call);
>  
>   memcpy(number->number, call->address, sizeof(number->number));
> + memcpy(ocall.name, call->name, sizeof(ocall.name));
> +

Extra blank line here.

>  
>   number->type = 0x80 | call->addr_type;
>   ocall.clip_validity = call->presentation & 3;
> +ocall.cnap_validity = call->name_presentation & 3;

spaces here.

>  
>   if (ocall.clip_validity == 0 && strlen(number->number) == 0)
>   ocall.clip_validity = 2;
>  
> + if (ocall.cnap_validity == 0 && strlen(call->name) == 0)
> + ocall.cnap_validity = 2;
> +
>   return ocall;
>  }
>  
> @@ -513,11 +545,12 @@ static void isi_call_notify(struct ofono_voicecall 
> *ovc, struct isi_call *call)
>  
>   ocall = isi_call_as_ofono_call(call);
>  
> - DBG("id=%u,%s,%u,\"%s\",%u,%u",
> + DBG("id=%u,%s,%u,\"%s\",\"%s\",%u,%u",
>   ocall.id,
>   ocall.direction ? "terminated" : "originated",
>   ocall.status,
>   ocall.phone_number.number,
> +ocall.name,

Spaces here.

>   ocall.phone_number.type,
>   ocall.clip_validity);
>  
> @@ -622,6 +655,10 @@ static void isi_call_status_ind_cb(const GIsiMessage 
> *msg, void *data)
>   isi_call_origin_address_sb_proc(ivc, call, &iter);
>   break;
>  
> +case CALL_ORIGIN_INFO:

Extra spaces here.

> + isi_call_origin_info_sb_proc(ivc, call, &iter);
> + break;
> +
>   case CALL_GSM_DETAILED_CAUSE:
>   case CALL_DESTINATION_PRE_ADDRESS:
>   case CALL_DESTINATION_POST_ADDRESS:
> diff --git a/src/voicecall.c b/src/voicecall.c
> index 4606668..b608394 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -1951,8 +1951,8 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,
>   struct ofono_call *newcall;
>  
>   DBG("Got a voicecall event, status: %d, id: %u, number: %s"
> - " called_number: %s", call->status, call->id,
> - call->phone_number.number, call->called_number.number);
> + " called_number: %s, name: %s", call->status, call->id,
> + call->phone_number.number, call->ca

[PATCH] Add CNAP support (callerid name presentation) to isimodem

2011-02-22 Thread Antoine Reversat
---
 drivers/isimodem/voicecall.c |   39 ++-
 src/voicecall.c  |4 ++--
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 0a32f27..e778f23 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -56,8 +56,10 @@ struct isi_call {
uint8_t cause;
uint8_t addr_type;
uint8_t presentation;
+   uint8_t name_presentation;
uint8_t reason;
char address[20];
+   char name[20];
char addr_pad[4];
 };
 
@@ -231,6 +233,7 @@ static void isi_call_origin_address_sb_proc(struct 
isi_voicecall *ivc,
isi_call_any_address_sb_proc(ivc, call, sb);
 }
 
+
 static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,
struct isi_call *call,
GIsiSubBlockIter *sb)
@@ -239,6 +242,29 @@ static void isi_call_destination_address_sb_proc(struct 
isi_voicecall *ivc,
isi_call_any_address_sb_proc(ivc, call, sb);
 }
 
+static void isi_call_origin_info_sb_proc(struct isi_voicecall *ivc,
+   struct isi_call *call,
+   GIsiSubBlockIter *sb)
+{
+   uint8_t pres;
+   uint8_t id;
+   uint8_t len;
+   char *name;
+
+   if (!g_isi_sb_iter_get_byte(sb, &pres, 2) ||
+   !g_isi_sb_iter_get_byte(sb, &id, 6) ||
+   !g_isi_sb_iter_get_byte(sb, &len, 7) ||
+   !g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8))
+   return;
+
+
+DBG("Got name %s", name);
+   call->name_presentation = pres;
+   strncpy(call->name, name, sizeof(call->name));
+
+   g_free(name);
+}
+
 static void isi_call_mode_sb_proc(struct isi_voicecall *ivc,
struct isi_call *call,
GIsiSubBlockIter *sb)
@@ -396,13 +422,19 @@ static struct ofono_call isi_call_as_ofono_call(const 
struct isi_call *call)
ocall.status = isi_call_status_to_clcc(call);
 
memcpy(number->number, call->address, sizeof(number->number));
+   memcpy(ocall.name, call->name, sizeof(ocall.name));
+
 
number->type = 0x80 | call->addr_type;
ocall.clip_validity = call->presentation & 3;
+ocall.cnap_validity = call->name_presentation & 3;
 
if (ocall.clip_validity == 0 && strlen(number->number) == 0)
ocall.clip_validity = 2;
 
+   if (ocall.cnap_validity == 0 && strlen(call->name) == 0)
+   ocall.cnap_validity = 2;
+
return ocall;
 }
 
@@ -513,11 +545,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, 
struct isi_call *call)
 
ocall = isi_call_as_ofono_call(call);
 
-   DBG("id=%u,%s,%u,\"%s\",%u,%u",
+   DBG("id=%u,%s,%u,\"%s\",\"%s\",%u,%u",
ocall.id,
ocall.direction ? "terminated" : "originated",
ocall.status,
ocall.phone_number.number,
+ocall.name,
ocall.phone_number.type,
ocall.clip_validity);
 
@@ -622,6 +655,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, 
void *data)
isi_call_origin_address_sb_proc(ivc, call, &iter);
break;
 
+case CALL_ORIGIN_INFO:
+   isi_call_origin_info_sb_proc(ivc, call, &iter);
+   break;
+
case CALL_GSM_DETAILED_CAUSE:
case CALL_DESTINATION_PRE_ADDRESS:
case CALL_DESTINATION_POST_ADDRESS:
diff --git a/src/voicecall.c b/src/voicecall.c
index 4606668..b608394 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -1951,8 +1951,8 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,
struct ofono_call *newcall;
 
DBG("Got a voicecall event, status: %d, id: %u, number: %s"
-   " called_number: %s", call->status, call->id,
-   call->phone_number.number, call->called_number.number);
+   " called_number: %s, name: %s", call->status, call->id,
+   call->phone_number.number, call->called_number.number, 
call->name);
 
l = g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(call->id),
call_compare_by_id);
-- 
1.7.1

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


[PATCH v4 2/6] location-reporting: add atom implementation

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 Makefile.am  |2 +-
 src/location-reporting.c |  393 ++
 src/ofono.h  |2 +
 3 files changed, 396 insertions(+), 1 deletions(-)
 create mode 100644 src/location-reporting.c

diff --git a/Makefile.am b/Makefile.am
index f9a1bd9..48d84c8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -377,7 +377,7 @@ 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/emulator.c src/location-reporting.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
diff --git a/src/location-reporting.c b/src/location-reporting.c
new file mode 100644
index 000..6ab0914
--- /dev/null
+++ b/src/location-reporting.c
@@ -0,0 +1,393 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Nokia Corporation and/or its subsidiary(-ies).
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011  ProFUSION embedded systems.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "ofono.h"
+#include "common.h"
+
+#ifndef DBUS_TYPE_UNIX_FD
+#define DBUS_TYPE_UNIX_FD -1
+#endif
+
+static GSList *g_drivers = NULL;
+
+struct ofono_location_reporting {
+   DBusMessage *pending;
+   const struct ofono_location_reporting_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+   ofono_bool_t enabled;
+   char *client_owner;
+   guint disconnect_watch;
+};
+
+static const char *location_reporting_type_to_string(
+   enum ofono_location_reporting_type type)
+{
+   switch (type) {
+   case OFONO_LOCATION_REPORTING_TYPE_NMEA:
+   return "nmea";
+   };
+
+   return NULL;
+}
+
+static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+
+{
+   struct ofono_location_reporting *lr = data;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+   const char *type;
+   int value;
+
+   reply = dbus_message_new_method_return(msg);
+   if (reply == NULL)
+   return NULL;
+
+   dbus_message_iter_init_append(reply, &iter);
+   dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+   OFONO_PROPERTIES_ARRAY_SIGNATURE,
+   &dict);
+
+   value = lr->enabled;
+   ofono_dbus_dict_append(&dict, "Enabled", DBUS_TYPE_BOOLEAN, &value);
+
+   type = location_reporting_type_to_string(lr->driver->type);
+   ofono_dbus_dict_append(&dict, "Type", DBUS_TYPE_STRING, &type);
+
+   dbus_message_iter_close_container(&iter, &dict);
+
+   return reply;
+}
+
+static void client_remove(struct ofono_location_reporting *lr)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+
+   if (lr->disconnect_watch) {
+   g_dbus_remove_watch(conn, lr->disconnect_watch);
+   lr->disconnect_watch = 0;
+   }
+
+   g_free(lr->client_owner);
+}
+
+static void signal_enabled(const struct ofono_location_reporting *lr)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(lr->atom);
+   int value = lr->enabled;
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_LOCATION_REPORTING_INTERFACE,
+   "Enabled", DBUS_TYPE_BOOLEAN, &value);
+}
+
+static void client_exited_disable_cb(const struct ofono_error *error,
+   void *data)
+{
+   struct ofono_location_reporting *lr = data;
+
+   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+   ofono_error("Disabling location-reporting failed");
+
+   return;
+   }
+
+   client_remove(lr);
+   lr->enabled = F

Re: [PATCH 3/3] emulator: add CIND support

2011-02-22 Thread Denis Kenzior
Hi Frédéric,

On 02/22/2011 09:40 AM, Frédéric Danis wrote:
> ---
>  src/emulator.c |   56 
> 
>  1 files changed, 56 insertions(+), 0 deletions(-)
> 
> diff --git a/src/emulator.c b/src/emulator.c
> index 7a46d2a..ece38ab 100644
> --- a/src/emulator.c
> +++ b/src/emulator.c
> @@ -51,6 +51,7 @@ struct indicator {
>   int value;
>   int min;
>   int max;
> + char separator;
>  };
>  
>  
> @@ -173,6 +174,58 @@ error:
> g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
>  }
>  
> +static void cind_cb(GAtServer *server, GAtServerRequestType type,
> + GAtResult *result, gpointer user_data)
> +{
> + struct ofono_emulator *em = user_data;
> + GSList *l = em->indicators;
> + struct indicator *ind = l->data;
> + GString *gstr;
> + char *buf;

I prefer we do a simple pre-calculation of the space required.  If it
helps the implementation, limit the min and max values to something
reasonable, e.g. 0-999.

> +
> + switch (type) {
> + case G_AT_SERVER_REQUEST_TYPE_QUERY:
> + gstr = g_string_new("+CIND: ");
> + g_string_append_printf(gstr, "%d", ind->value);
> +
> + l = l->next;

doc/coding-style.txt M1.

> + while (l) {

These style loops look more compact using a for loop, e.g.:

for (l = em->indicators; l; l = l->next) {
...
}

> + ind = l->data;
> + g_string_append_printf(gstr, ",%d", ind->value);
> + l = l->next;
> + }
> + buf = g_string_free(gstr, FALSE);

doc/coding-style.txt M1

> +
> + g_at_server_send_info(em->server, buf, FALSE);
> + g_free(buf);
> + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
> + break;
> +
> + case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
> + gstr = g_string_new("+CIND: ");
> + g_string_append_printf(gstr, "(\"%s\",(%d%c%d))",
> + ind->name, ind->min, ind->separator, ind->max);

doc/coding-style.txt M4

> +
> + l = l->next;
> + while (l) {
> + ind = l->data;
> + g_string_append_printf(gstr, ",(\"%s\",(%d%c%d))",
> + ind->name, ind->min, ind->separator, ind->max);
> + l = l->next;
> + }
> + buf = g_string_free(gstr, FALSE);
> +
> + g_at_server_send_info(server, buf, FALSE);
> + g_free(buf);
> + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
> + break;
> +
> + default:
> + g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
> + break;
> + }
> +}
> +
>  static void emulator_add_indicator(struct ofono_emulator *em, const char* 
> name,
>   int min, int max, int dflt)
>  {
> @@ -188,6 +241,7 @@ static void emulator_add_indicator(struct ofono_emulator 
> *em, const char* name,
>   ind->min = min;
>   ind->max = max;
>   ind->value = dflt;
> + ind->separator = ((max - min) == 1) ? ',' : '-';

I prefer you do this magic inside cind_cb and avoid storing it inside
the indicator structure.

>  
>   em->indicators = g_slist_append(em->indicators, ind);
>  }
> @@ -237,6 +291,8 @@ void ofono_emulator_register(struct ofono_emulator *em, 
> int fd)
>   emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
>   emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
>   emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
> +
> + g_at_server_register(em->server, "+CIND", cind_cb, em, NULL);
>   }
>  
>   __ofono_atom_register(em->atom, emulator_unregister);

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


[PATCH v4 6/6] location-reporting: add documentation

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 Makefile.am|3 ++-
 doc/location-reporting-api.txt |   39 +++
 2 files changed, 41 insertions(+), 1 deletions(-)
 create mode 100644 doc/location-reporting-api.txt

diff --git a/Makefile.am b/Makefile.am
index 9b6edf4..ca558ea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -420,7 +420,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt 
doc/release-faq.txt \
doc/phonebook-api.txt doc/radio-settings-api.txt \
doc/sim-api.txt doc/stk-api.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
-   doc/calypso-modem.txt doc/message-api.txt
+   doc/calypso-modem.txt doc/message-api.txt \
+   doc/location-reporting-api.txt
 
 
 test_scripts = test/backtrace \
diff --git a/doc/location-reporting-api.txt b/doc/location-reporting-api.txt
new file mode 100644
index 000..b8ce840
--- /dev/null
+++ b/doc/location-reporting-api.txt
@@ -0,0 +1,39 @@
+Location Reporting Hierarchy [experimental]
+=
+
+Serviceorg.ofono
+Interface  org.ofono.LocationReporting
+Object path[variable prefix]/{modem0,modem1,...}
+
+Methodsdict GetProperties()
+
+   Returns all LocationReporting properties. See the
+   properties section for available properties.
+
+   byte Request()
+
+   Asks to turn ON the NMEA stream and supplies the
+   gps device file descriptor. The external cliend should
+   use the file descriptor to receive the NMEA data.
+
+   Possible Errors: [service].Error.InProgress
+[service].Error.InUse
+[service].Error.Failed
+
+   void Release()
+
+   Releases the gps device file descriptor and turns
+   OFF the NMEA stream.
+
+   Possible Errors: [service].Error.InProgress
+[service].Error.NotAvailable
+[service].Error.Failed
+
+Properties boolean Enabled [readonly]
+
+Boolean representing the state of the NMEA stream.
+
+   string Type [readonly]
+
+   Holds the type of the device. Currently only NMEA is
+   supported.
-- 
1.7.4.1

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


[PATCH v4 5/6] udev: add location-reporting device to mbm

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 plugins/udev.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 84478d7..aa5702e 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -105,7 +105,7 @@ static void add_mbm(struct ofono_modem *modem,
struct udev_device *udev_device)
 {
const char *desc, *devnode;
-   const char *device, *data, *network;
+   const char *device, *data, *network, *gps;
int registered;
 
desc = udev_device_get_sysattr_value(udev_device, "device/interface");
@@ -152,8 +152,9 @@ static void add_mbm(struct ofono_modem *modem,
device  = ofono_modem_get_string(modem, MODEM_DEVICE);
data = ofono_modem_get_string(modem, DATA_DEVICE);
network = ofono_modem_get_string(modem, NETWORK_INTERFACE);
+   gps = ofono_modem_get_string(modem, GPS_DEVICE);
 
-   if (device != NULL && data != NULL && network != NULL) {
+   if (device != NULL && data != NULL && network != NULL && gps != NULL) {
ofono_modem_set_integer(modem, "Registered", 1);
ofono_modem_register(modem);
}
-- 
1.7.4.1

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


[PATCH v4 4/6] mbm: add location-reporting atom

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 plugins/mbm.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index 2ab80b4..105843f 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,6 +68,7 @@ struct mbm_data {
gboolean have_sim;
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+   struct ofono_location_reporting *lr;
guint reopen_source;
enum mbm_variant variant;
 };
@@ -510,9 +512,15 @@ static void mbm_post_online(struct ofono_modem *modem)
 {
struct mbm_data *data = ofono_modem_get_data(modem);
struct ofono_gprs_context *gc;
+   const char *gps_dev;
 
DBG("%p", modem);
 
+   gps_dev = ofono_modem_get_string(modem, "GPSDevice");
+   if (gps_dev)
+   data->lr = ofono_location_reporting_create(modem, 0,
+   "mbmmodem", data->modem_port);
+
ofono_netreg_create(modem, OFONO_VENDOR_MBM,
"atmodem", data->modem_port);
 
-- 
1.7.4.1

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


[PATCH v4 3/6] mbmmodem: add location-reporting driver implementation

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 Makefile.am   |3 +-
 drivers/mbmmodem/location-reporting.c |  247 +
 drivers/mbmmodem/mbmmodem.c   |2 +
 drivers/mbmmodem/mbmmodem.h   |3 +
 4 files changed, 254 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mbmmodem/location-reporting.c

diff --git a/Makefile.am b/Makefile.am
index 48d84c8..9b6edf4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -212,7 +212,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/mbmmodem/mbmmodem.h \
drivers/mbmmodem/mbmmodem.c \
drivers/mbmmodem/gprs-context.c \
-   drivers/mbmmodem/stk.c
+   drivers/mbmmodem/stk.c \
+   drivers/mbmmodem/location-reporting.c
 
 builtin_modules += hsomodem
 builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/mbmmodem/location-reporting.c 
b/drivers/mbmmodem/location-reporting.c
new file mode 100644
index 000..7d3e212
--- /dev/null
+++ b/drivers/mbmmodem/location-reporting.c
@@ -0,0 +1,247 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2010 ProFUSION embedded systems.
+ *
+ *  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 
+
+#include "gatchat.h"
+#include "gatresult.h"
+#include "gattty.h"
+
+#include "mbmmodem.h"
+
+static const char *none_prefix[] = { NULL };
+static const char *e2gpsctl_prefix[] = { "*E2GPSCTL:", NULL };
+
+struct gps_data {
+   GAtChat *chat;
+   GAtChat *data_chat;
+};
+
+static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult *result,
+   gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   struct ofono_location_reporting *lr = cbd->user;
+   ofono_location_reporting_disable_cb_t cb = cbd->cb;
+   struct gps_data *gd = ofono_location_reporting_get_data(lr);
+
+   DBG("lr=%p, ok=%d", lr, ok);
+
+   if (!ok) {
+   struct ofono_error error;
+
+   decode_at_error(&error, g_at_result_final_response(result));
+   cb(&error, cbd->data);
+
+   return;
+   }
+
+   g_at_chat_unref(gd->data_chat);
+
+   CALLBACK_WITH_SUCCESS(cb, cbd->data);
+}
+
+static void mbm_location_reporting_disable(struct ofono_location_reporting *lr,
+   ofono_location_reporting_disable_cb_t cb,
+   void *data)
+{
+   struct gps_data *gd = ofono_location_reporting_get_data(lr);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   DBG("lr=%p", lr);
+
+   cbd->user = lr;
+
+   if (g_at_chat_send(gd->chat, "AT*E2GPSCTL=0,5,1", none_prefix,
+   mbm_e2gpsctl_disable_cb, cbd, g_free) > 0)
+   return;
+
+   CALLBACK_WITH_FAILURE(cb, data);
+   g_free(cbd);
+}
+
+static int mbm_create_data_chat(struct ofono_location_reporting *lr)
+{
+   struct gps_data *gd = ofono_location_reporting_get_data(lr);
+   struct ofono_modem *modem;
+   const char *gps_dev;
+   GAtSyntax *syntax;
+   GIOChannel *channel;
+   int fd;
+
+   modem = ofono_location_reporting_get_modem(lr);
+   gps_dev = ofono_modem_get_string(modem, "GPSDevice");
+
+   channel = g_at_tty_open(gps_dev, NULL);
+   if (channel == NULL)
+   return -1;
+
+   syntax = g_at_syntax_new_gsm_permissive();
+   gd->data_chat = g_at_chat_new(channel, syntax);
+   fd = g_io_channel_unix_get_fd(channel);
+
+   g_at_syntax_unref(syntax);
+   g_io_channel_unref(channel);
+
+   if (gd->data_chat == NULL)
+   return -1;
+
+   return fd;
+}
+
+static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult *result,
+gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_location_reporting_enable_cb_t cb = cbd->cb;
+   struct ofono_location_reporting *lr = cbd->user;
+   struct gps_data *gd = ofono_location_reporting_get_data

[PATCH v4 1/6] location-reporting: add public header

2011-02-22 Thread Lucas De Marchi
From: Rafael Ignacio Zurita 

---
 Makefile.am  |3 +-
 include/location-reporting.h |   81 ++
 2 files changed, 83 insertions(+), 1 deletions(-)
 create mode 100644 include/location-reporting.h

diff --git a/Makefile.am b/Makefile.am
index 7bd7f4f..f9a1bd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,8 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
include/cdma-sms.h include/sim-auth.h \
-   include/gprs-provision.h include/emulator.h
+   include/gprs-provision.h include/emulator.h \
+   include/location-reporting.h
 
 nodist_pkginclude_HEADERS = include/version.h
 
diff --git a/include/location-reporting.h b/include/location-reporting.h
new file mode 100644
index 000..d932d9d
--- /dev/null
+++ b/include/location-reporting.h
@@ -0,0 +1,81 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *  Copyright (C) 2010 ProFUSION embedded systems.
+ *
+ *  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_LOCATION_REPORTING_H
+#define __OFONO_LOCATION_REPORTING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+struct ofono_location_reporting;
+
+enum ofono_location_reporting_type {
+   OFONO_LOCATION_REPORTING_TYPE_NMEA = 0,
+};
+
+typedef void (*ofono_location_reporting_enable_cb_t)(
+   const struct ofono_error *error,
+   int fd, void *data);
+typedef void (*ofono_location_reporting_disable_cb_t)(
+   const struct ofono_error *error,
+   void *data);
+
+struct ofono_location_reporting_driver {
+   const char *name;
+   enum ofono_location_reporting_type type;
+   int (*probe)(struct ofono_location_reporting *lr, unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_location_reporting *lr);
+   void (*enable)(struct ofono_location_reporting *lr,
+   ofono_location_reporting_enable_cb_t cb, void *data);
+   void (*disable)(struct ofono_location_reporting *lr,
+   ofono_location_reporting_disable_cb_t cb, void *data);
+};
+
+int ofono_location_reporting_driver_register(
+   const struct ofono_location_reporting_driver *d);
+void ofono_location_reporting_driver_unregister(
+   const struct ofono_location_reporting_driver *d);
+
+struct ofono_location_reporting *ofono_location_reporting_create(
+   struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_location_reporting_register(struct ofono_location_reporting *lr);
+void ofono_location_reporting_remove(struct ofono_location_reporting *lr);
+
+void ofono_location_reporting_set_data(struct ofono_location_reporting *lr,
+   void *data);
+void *ofono_location_reporting_get_data(struct ofono_location_reporting *lr);
+
+struct ofono_modem *ofono_location_reporting_get_modem(
+   struct ofono_location_reporting *lr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_LOCATION_REPORTING_H */
-- 
1.7.4.1

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


[PATCH v4 0/6] Add location-reporting atom

2011-02-22 Thread Lucas De Marchi
From: Lucas De Marchi 

This is the 4th version of the location-reporting patches (previous title was
"Add GPS atom"). I worked with Rafael Ignacio Zurita to implement this last
version, making some changes in order to fit the new design as discussed on irc.

Now when a client calls 'Request()' we give it a file
descriptor in which the location reporting will be written. By checking the
'Type' property the client can decide what to do with such information. As of
now only NMEA is supported and it's implemented on mbm modem.

If client exits or calls 'Release()', the location reporting is disabled.

Rafael Ignacio Zurita (6):
  location-reporting: add public header
  location-reporting: add atom implementation
  mbmmodem: add location-reporting driver implementation
  mbm: add location-reporting atom
  udev: add location-reporting device to mbm
  location-reporting: add documentation

 Makefile.am   |   11 +-
 doc/location-reporting-api.txt|   39 
 drivers/mbmmodem/location-reporting.c |  247 +
 drivers/mbmmodem/mbmmodem.c   |2 +
 drivers/mbmmodem/mbmmodem.h   |3 +
 include/location-reporting.h  |   81 +++
 plugins/mbm.c |8 +
 plugins/udev.c|5 +-
 src/location-reporting.c  |  393 +
 src/ofono.h   |2 +
 10 files changed, 785 insertions(+), 6 deletions(-)
 create mode 100644 doc/location-reporting-api.txt
 create mode 100644 drivers/mbmmodem/location-reporting.c
 create mode 100644 include/location-reporting.h
 create mode 100644 src/location-reporting.c

-- 
1.7.4.1

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


Re: [PATCH 2/3] emulator: add support of indicators

2011-02-22 Thread Denis Kenzior
Hi Frédéric,

On 02/22/2011 09:40 AM, Frédéric Danis wrote:
> ---
>  src/emulator.c |   68 +++
>  src/network.c  |   74 
> +++-
>  2 files changed, 141 insertions(+), 1 deletions(-)
> 
> diff --git a/src/emulator.c b/src/emulator.c
> index b4a4c57..7a46d2a 100644
> --- a/src/emulator.c
> +++ b/src/emulator.c
> @@ -24,6 +24,7 @@
>  #endif
>  
>  #include 
> +#include 
>  
>  #include 
>  
> @@ -42,8 +43,17 @@ struct ofono_emulator {
>   GAtServer *server;
>   GAtPPP *ppp;
>   guint source;
> + GSList *indicators;

Let us use a GHashtable here

>  };
>  
> +struct indicator {
> + const char *name;

You can't actually do this safely, you should be strduping the string.

> + int value;
> + int min;
> + int max;
> +};
> +
> +

Why the double newline?

>  static void emulator_debug(const char *str, void *data)
>  {
>   ofono_info("%s: %s\n", (char *)data, str);
> @@ -163,6 +173,25 @@ error:
> g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
>  }
>  
> +static void emulator_add_indicator(struct ofono_emulator *em, const char* 
> name,
> + int min, int max, int dflt)
> +{
> + struct indicator *ind;
> +
> + ind = g_try_new0(struct indicator, 1);
> + if (ind == NULL) {
> + ofono_error("Unable to allocate indicator structure");
> + return;
> + }
> +
> + ind->name = name;
> + ind->min = min;
> + ind->max = max;
> + ind->value = dflt;
> +
> + em->indicators = g_slist_append(em->indicators, ind);
> +}
> +
>  static void emulator_unregister(struct ofono_atom *atom)
>  {
>   struct ofono_emulator *em = __ofono_atom_get_data(atom);
> @@ -174,6 +203,10 @@ static void emulator_unregister(struct ofono_atom *atom)
>   em->source = 0;
>   }
>  
> + g_slist_foreach(em->indicators, (GFunc) g_free, NULL);
> + g_slist_free(em->indicators);
> + em->indicators = NULL;
> +
>   g_at_server_unref(em->server);
>   em->server = NULL;
>  }
> @@ -199,6 +232,13 @@ void ofono_emulator_register(struct ofono_emulator *em, 
> int fd)
>   g_at_server_set_disconnect_function(em->server,
>   emulator_disconnect, em);
>  
> + if (em->type == OFONO_EMULATOR_TYPE_HFP) {
> + emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0);
> + emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
> + emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
> + emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
> + }
> +
>   __ofono_atom_register(em->atom, emulator_unregister);
>  
>   if (em->type == OFONO_EMULATOR_TYPE_DUN)
> @@ -397,3 +437,31 @@ enum ofono_emulator_request_type 
> ofono_emulator_request_get_type(
>  {
>   return req->type;
>  }
> +
> +void ofono_emulator_set_indicator(struct ofono_emulator *em,
> + const char *name, int value)
> +{
> + GSList *l;
> + int i;
> + char buf[20];
> +
> + i = 1;
> + for (l = em->indicators; l; l = l->next) {
> + struct indicator *ind = l->data;
> +
> + if (!strcmp(ind->name, name)) {
> + if ((ind->value == value) || (value < ind->min)
> + || (value > ind->max))
> + return;
> +
> + ind->value = value;
> +
> + sprintf(buf, "+CIEV: %d,%d", i, ind->value);
> + g_at_server_send_info(em->server, buf, TRUE);
> +
> + break;
> + }
> +
> + i++;
> + }
> +}
> diff --git a/src/network.c b/src/network.c
> index c059906..8124319 100644
> --- a/src/network.c
> +++ b/src/network.c
> @@ -36,6 +36,7 @@
>  #include "simutil.h"
>  #include "util.h"
>  #include "storage.h"
> +#include "emulator.h"
>  
>  #define NETWORK_REGISTRATION_FLAG_HOME_SHOW_PLMN 0x1
>  #define NETWORK_REGISTRATION_FLAG_ROAMING_SHOW_SPN 0x2
> @@ -82,6 +83,7 @@ struct ofono_netreg {
>   const struct ofono_netreg_driver *driver;
>   void *driver_data;
>   struct ofono_atom *atom;
> + unsigned int hfp_watch;
>  };
>  
>  struct network_operator_data {
> @@ -1287,15 +1289,42 @@ static void signal_strength_callback(const struct 
> ofono_error *error,
>   ofono_netreg_strength_notify(netreg, strength);
>  }
>  
> +static void notify_emulator_status(struct ofono_atom *atom, void *data)
> +{
> + struct ofono_emulator *em = __ofono_atom_get_data(atom);
> +
> + switch (GPOINTER_TO_INT(data)) {
> + case NETWORK_REGISTRATION_STATUS_REGISTERED:
> + ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_SERVICE, 1);
> + ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0);
> + break;
> + case

Re: [PATCH] ste: preparation for hotswap

2011-02-22 Thread Denis Kenzior
Hi Jussi,

>  plugins/ste.c |  117 +---
>  1 files changed, 85 insertions(+), 32 deletions(-)
> 

Patch has been applied, thanks.  I did have to fix some style issues in
a consequent commit.

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


Re: [RFC] doc: Add support for CMAS/EU-Alert

2011-02-22 Thread Denis Kenzior
Hi Jeeva,

On 02/21/2011 11:36 PM, jeevaka.badrap...@elektrobit.com wrote:
> Hi Rajesh,
> 
> ofono-boun...@ofono.org wrote:
>> Hi Jeeva,
>>
>> Is this WarningType really required on the App side ?
>> Irrespective of the warning type, the emergency broadcast
>> message handling won't change on the apps side (i.e, its
>> going to be displayed immediately to the user). This can be
>> achieved by the old boolean variable EmergencyAlert only ?
>>
> 
> Its Popup property which is used for displaying the
> messages immediately to the user. EmergencyAlert Property
> is used to hint whether an emergency indicator(Vibration, emergency
> tone)
> should be activated.
> 
> Yes, agree that the WarningType is not really required. 
> May be it was there for some reason. This RFC patch just extends
> the existing EmergencyType property.

Lets just get rid of it then and keep the name EmergencyAlert.  Do we
want to re-model this using an Agent style API by any chance?

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


Re: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Denis Kenzior
Hi,

On 02/22/2011 10:08 AM, Soum, RedouaneX wrote:
> Hi guys,
> 
> 
>>> I agree with you , both bearers are almost similar.Minor difference i
>>> see are context managment (especially default context creation) and some
>>> eps related spill over on other existing atoms (For ex SIM would not
>>> contain some ISIM (IMPU/IMPI)related stuff).My idea is seperate atoms
>>> solution would even work for legacy switch back(CSFB) too with a minimal
>>> impact on exiting architecture.Your comments on these ideas would also
>>> very valuable here as i assume you have real modem unlike me.
>>>
>> My main concern is about LTE only modems, these ones would not register gprs
>> atom so all stuff from gprs atom needs to be done in eps atom, plus CEREG
>> and initial PDN. Than if you have a mix modem with 3G and LTE than all this 
>> "stuff"
>> would be done twice without some additional logic. Sounds complicated to me.
>> About initial PDN, acually I think it can be placed in gprs atom
>> too, it won't influence 3G modems at all and we have +CGEV: handling there 
>> already
>> (maybe not the strongest argument but would make things easier).
> 
> I agree, the differences between 2G/3G and LTE are not so big so it'll be 
> better if we keep the logic in the existing atoms.
> A lot of LTE AT commands were extended from 2G/3G to support LTE.
> 
> A good approach would be to extend netreg and gprs atoms to handle lte 
> including initial default bearer (as part of attach procedure) and dedicated 
> bearers( secondary context in 2G/2G).
> 
> For the concepts that are not present in 2G and 3G, such as IMS related 
> concepts then we can use a dedicated atom.

One thing to keep in mind about LTE is that we're not only looking to
support GSM style networks.  There are hybrid networks such as Verizon
which have CDMA/LTE mix.  From an API point of view it might not make
sense to expose unneeded GSM details in such situations.

There are also plenty of implementation details inside gprs atom
specific to gprs.  So for ease of implementation it might be sensible to
have a separate LTE atom anyway, even if it still implements the exact
same API.  We can factor out common context / bearer management into a
separate utility / atom if needed.

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


RE: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Soum, RedouaneX
Hi guys,


>>I agree with you , both bearers are almost similar.Minor difference i
>>see are context managment (especially default context creation) and some
>>eps related spill over on other existing atoms (For ex SIM would not
>>contain some ISIM (IMPU/IMPI)related stuff).My idea is seperate atoms
>>solution would even work for legacy switch back(CSFB) too with a minimal
>>impact on exiting architecture.Your comments on these ideas would also
>>very valuable here as i assume you have real modem unlike me.
>>
>My main concern is about LTE only modems, these ones would not register gprs
>atom so all stuff from gprs atom needs to be done in eps atom, plus CEREG
>and initial PDN. Than if you have a mix modem with 3G and LTE than all this 
>"stuff"
>would be done twice without some additional logic. Sounds complicated to me.
>About initial PDN, acually I think it can be placed in gprs atom
>too, it won't influence 3G modems at all and we have +CGEV: handling there 
>already
>(maybe not the strongest argument but would make things easier).

I agree, the differences between 2G/3G and LTE are not so big so it'll be 
better if we keep the logic in the existing atoms.
A lot of LTE AT commands were extended from 2G/3G to support LTE.

A good approach would be to extend netreg and gprs atoms to handle lte 
including initial default bearer (as part of attach procedure) and dedicated 
bearers( secondary context in 2G/2G).

For the concepts that are not present in 2G and 3G, such as IMS related 
concepts then we can use a dedicated atom.

Regards,




-
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: [PATCH] gatserver: Add various ATSx handlers

2011-02-22 Thread Denis Kenzior
Hi Olivier,

On 02/22/2011 08:54 AM, Olivier Guiter wrote:
> ---
>  gatchat/gatserver.c |   36 
>  1 files changed, 36 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

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


Re: gatchat looses UR code if received while waiting a response

2011-02-22 Thread Denis Kenzior
Hi Lasse,

>> There's nothing you can do in GAtChat at this point.  Having the
>> unsolicited response handler fire and consume lines before the pending
>> AT command handler won't work either.  If you're not convinced, try
>> handling solicited / unsolicited CREG/CGREG and friends.
> Okay, good to know this, I was not aware. Perhaps I need to reconsider
> the way forward with this issue, we could change the startup sequence of
> different drivers and that way get around this issue. 
>

I suggest putting devinfo on separate multiplexer channel from the one
receiving the STKI notification.  Or we might have to consider extending
gatchat with 'blacklist' prefixes instead of 'whitelist'.

Regards,
-Denis

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


[PATCH 3/3] emulator: add CIND support

2011-02-22 Thread Frédéric Danis
---
 src/emulator.c |   56 
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 7a46d2a..ece38ab 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -51,6 +51,7 @@ struct indicator {
int value;
int min;
int max;
+   char separator;
 };
 
 
@@ -173,6 +174,58 @@ error:
g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
 }
 
+static void cind_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   struct ofono_emulator *em = user_data;
+   GSList *l = em->indicators;
+   struct indicator *ind = l->data;
+   GString *gstr;
+   char *buf;
+
+   switch (type) {
+   case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   gstr = g_string_new("+CIND: ");
+   g_string_append_printf(gstr, "%d", ind->value);
+
+   l = l->next;
+   while (l) {
+   ind = l->data;
+   g_string_append_printf(gstr, ",%d", ind->value);
+   l = l->next;
+   }
+   buf = g_string_free(gstr, FALSE);
+
+   g_at_server_send_info(em->server, buf, FALSE);
+   g_free(buf);
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+   break;
+
+   case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+   gstr = g_string_new("+CIND: ");
+   g_string_append_printf(gstr, "(\"%s\",(%d%c%d))",
+   ind->name, ind->min, ind->separator, ind->max);
+
+   l = l->next;
+   while (l) {
+   ind = l->data;
+   g_string_append_printf(gstr, ",(\"%s\",(%d%c%d))",
+   ind->name, ind->min, ind->separator, ind->max);
+   l = l->next;
+   }
+   buf = g_string_free(gstr, FALSE);
+
+   g_at_server_send_info(server, buf, FALSE);
+   g_free(buf);
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+   break;
+
+   default:
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+   break;
+   }
+}
+
 static void emulator_add_indicator(struct ofono_emulator *em, const char* name,
int min, int max, int dflt)
 {
@@ -188,6 +241,7 @@ static void emulator_add_indicator(struct ofono_emulator 
*em, const char* name,
ind->min = min;
ind->max = max;
ind->value = dflt;
+   ind->separator = ((max - min) == 1) ? ',' : '-';
 
em->indicators = g_slist_append(em->indicators, ind);
 }
@@ -237,6 +291,8 @@ void ofono_emulator_register(struct ofono_emulator *em, int 
fd)
emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
+
+   g_at_server_register(em->server, "+CIND", cind_cb, em, NULL);
}
 
__ofono_atom_register(em->atom, emulator_unregister);
-- 
1.7.1

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


[PATCH 1/3] emulator: add indicator support API

2011-02-22 Thread Frédéric Danis
---
 include/emulator.h |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/emulator.h b/include/emulator.h
index 12477f0..71b7c24 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -28,6 +28,14 @@ extern "C" {
 
 #include 
 
+#define OFONO_EMULATOR_IND_BATTERY "battchg"
+#define OFONO_EMULATOR_IND_CALL "call"
+#define OFONO_EMULATOR_IND_CALLHELD "callheld"
+#define OFONO_EMULATOR_IND_CALLSETUP "callsetup"
+#define OFONO_EMULATOR_IND_ROAMING "roam"
+#define OFONO_EMULATOR_IND_SERVICE "service"
+#define OFONO_EMULATOR_IND_SIGNAL "signal"
+
 struct ofono_emulator;
 struct ofono_emulator_request;
 
@@ -82,6 +90,9 @@ const char *ofono_emulator_request_get_raw(struct 
ofono_emulator_request *req);
 enum ofono_emulator_request_type ofono_emulator_request_get_type(
struct ofono_emulator_request *req);
 
+void ofono_emulator_set_indicator(struct ofono_emulator *em,
+   const char *name, int value);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.1

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


[PATCH 2/3] emulator: add support of indicators

2011-02-22 Thread Frédéric Danis
---
 src/emulator.c |   68 +++
 src/network.c  |   74 +++-
 2 files changed, 141 insertions(+), 1 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index b4a4c57..7a46d2a 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -24,6 +24,7 @@
 #endif
 
 #include 
+#include 
 
 #include 
 
@@ -42,8 +43,17 @@ struct ofono_emulator {
GAtServer *server;
GAtPPP *ppp;
guint source;
+   GSList *indicators;
 };
 
+struct indicator {
+   const char *name;
+   int value;
+   int min;
+   int max;
+};
+
+
 static void emulator_debug(const char *str, void *data)
 {
ofono_info("%s: %s\n", (char *)data, str);
@@ -163,6 +173,25 @@ error:
g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
 }
 
+static void emulator_add_indicator(struct ofono_emulator *em, const char* name,
+   int min, int max, int dflt)
+{
+   struct indicator *ind;
+
+   ind = g_try_new0(struct indicator, 1);
+   if (ind == NULL) {
+   ofono_error("Unable to allocate indicator structure");
+   return;
+   }
+
+   ind->name = name;
+   ind->min = min;
+   ind->max = max;
+   ind->value = dflt;
+
+   em->indicators = g_slist_append(em->indicators, ind);
+}
+
 static void emulator_unregister(struct ofono_atom *atom)
 {
struct ofono_emulator *em = __ofono_atom_get_data(atom);
@@ -174,6 +203,10 @@ static void emulator_unregister(struct ofono_atom *atom)
em->source = 0;
}
 
+   g_slist_foreach(em->indicators, (GFunc) g_free, NULL);
+   g_slist_free(em->indicators);
+   em->indicators = NULL;
+
g_at_server_unref(em->server);
em->server = NULL;
 }
@@ -199,6 +232,13 @@ void ofono_emulator_register(struct ofono_emulator *em, 
int fd)
g_at_server_set_disconnect_function(em->server,
emulator_disconnect, em);
 
+   if (em->type == OFONO_EMULATOR_TYPE_HFP) {
+   emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0);
+   emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
+   emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
+   emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
+   }
+
__ofono_atom_register(em->atom, emulator_unregister);
 
if (em->type == OFONO_EMULATOR_TYPE_DUN)
@@ -397,3 +437,31 @@ enum ofono_emulator_request_type 
ofono_emulator_request_get_type(
 {
return req->type;
 }
+
+void ofono_emulator_set_indicator(struct ofono_emulator *em,
+   const char *name, int value)
+{
+   GSList *l;
+   int i;
+   char buf[20];
+
+   i = 1;
+   for (l = em->indicators; l; l = l->next) {
+   struct indicator *ind = l->data;
+
+   if (!strcmp(ind->name, name)) {
+   if ((ind->value == value) || (value < ind->min)
+   || (value > ind->max))
+   return;
+
+   ind->value = value;
+
+   sprintf(buf, "+CIEV: %d,%d", i, ind->value);
+   g_at_server_send_info(em->server, buf, TRUE);
+
+   break;
+   }
+
+   i++;
+   }
+}
diff --git a/src/network.c b/src/network.c
index c059906..8124319 100644
--- a/src/network.c
+++ b/src/network.c
@@ -36,6 +36,7 @@
 #include "simutil.h"
 #include "util.h"
 #include "storage.h"
+#include "emulator.h"
 
 #define NETWORK_REGISTRATION_FLAG_HOME_SHOW_PLMN 0x1
 #define NETWORK_REGISTRATION_FLAG_ROAMING_SHOW_SPN 0x2
@@ -82,6 +83,7 @@ struct ofono_netreg {
const struct ofono_netreg_driver *driver;
void *driver_data;
struct ofono_atom *atom;
+   unsigned int hfp_watch;
 };
 
 struct network_operator_data {
@@ -1287,15 +1289,42 @@ static void signal_strength_callback(const struct 
ofono_error *error,
ofono_netreg_strength_notify(netreg, strength);
 }
 
+static void notify_emulator_status(struct ofono_atom *atom, void *data)
+{
+   struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+   switch (GPOINTER_TO_INT(data)) {
+   case NETWORK_REGISTRATION_STATUS_REGISTERED:
+   ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_SERVICE, 1);
+   ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0);
+   break;
+   case NETWORK_REGISTRATION_STATUS_ROAMING:
+   ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_SERVICE, 1);
+   ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_ROAMING, 1);
+   break;
+   default:
+   ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0);
+   ofono_emulator_set_indicator(

[PATCH v2 0/3] bluetooth: add CIND and CIEV support in HFP AG

2011-02-22 Thread Frédéric Danis
Add indicator support in emulator atom
Add CIND and CIEV support for HFP AG

Frédéric Danis (3):
  emulator: add indicator support API
  emulator: add support of indicators
  emulator: add CIND support

 include/emulator.h |   11 +
 src/emulator.c |  124 
 src/network.c  |   74 ++-
 3 files changed, 208 insertions(+), 1 deletions(-)

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


Re: [PATCH] ofono.rules - remove patch leftovers in linktop rule

2011-02-22 Thread Denis Kenzior
Hi Rolf,

On 02/22/2011 07:36 AM, Rolf Offermanns wrote:
> Trivial fix for rules file.
> 
> ---
>  plugins/ofono.rules |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: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Tomasz Gregorek
2011/2/22 

>
>
> > -Original Message-
> > From: Tomasz Gregorek [mailto:tomasz.grego...@gmail.com]
> > Sent: 22 February 2011 16:09
> > To: ofono@ofono.org
> > Cc: Nayani Vijay
> > Subject: Re: [PATCH] atmodem: CEREG support for LTE network
> > status reporting in AT modem
> >
> > Hi Vijay
> >
> >
> > 2011/2/22 
> >
> >
> >
> >
> >   > Subject: [PATCH] atmodem: CEREG support for LTE network
> >   > status reporting in AT modem
> >   >
> >   > [PATCH] atmodem: CEREG support for LTE network status
> >   > reporting in AT modem Tomasz Gregorek tomasz.gregorek at
> >   > gmail.com Thu Feb 17 19:52:45 PST 2011
> >   >
> >   > * Previous message: [PATCH 2/5] bluetooth: add a
> >   > bluetoothd connect watch
> >   > * Next message: Problem with SIM lock states not showing
> >   > correctly in Ofono API.
> >   > * Messages sorted by: [ date ] [ thread ] [
> > subject ] [ author ]
> >   >
> >   > From: Tomasz Gregorek 
> >
> >   >
> >   > This is a proposal for CEREG support based on the AT modem.
> >   > Support in driver should work, though I have an issue
> > with the core.
> >   >
> >   > The core has one gprs status currently. In case of having
> >   > second status for LTE, there is need of having two satuses,
> >   > one for each, 3G and LTE, or to combine those two into one.
> >   >
> >   > I took second approach as it leaves current oFono API, though
> >   > it is not perfect.
> >
> >
> >   I have been working on solution that comprises of
> > separate eps atom and
> >   corresponding driver. Code has been tested against
> > modified phonesim for
> >   eps.Will provide an RFC patch soon once I bring it to
> > certain logical
> >   end.
> >
> >   Regards,
> >   Vijay
> >
> >
> >
> > This is what I was thinking about too.
> > For me, from status point of view, both networks look very
> > similar, thats why I was thinking about using gprs atom /
> > driver for status handling and create separate atom for QoS / IMS.
> >
>
> I agree with you , both bearers are almost similar.Minor difference i
> see are context managment (especially default context creation) and some
> eps related spill over on other existing atoms (For ex SIM would not
> contain some ISIM (IMPU/IMPI)related stuff).My idea is seperate atoms
> solution would even work for legacy switch back(CSFB) too with a minimal
> impact on exiting architecture.Your comments on these ideas would also
> very valuable here as i assume you have real modem unlike me.
>
> My main concern is about LTE only modems, these ones would not register
gprs
atom so all stuff from gprs atom needs to be done in eps atom, plus CEREG
and initial PDN. Than if you have a mix modem with 3G and LTE than all this
"stuff"
would be done twice without some additional logic. Sounds complicated to me.
About initial PDN, acually I think it can be placed in gprs atom
too, it won't influence 3G modems at all and we have +CGEV: handling there
already
(maybe not the strongest argument but would make things easier).


> > I am at most interested in your solution. I know from Denis
> > that this is what was agreed.
> >
> > Br
> > Tomasz Gregorek
> >
>
> Will submit the rfc patch and short design write up once i have code
> ready.
>
Ok. More comments as soon as there will be some code.


>
> Br,
> Vijay
> ___
> ofono mailing list
> ofono@ofono.org
> http://lists.ofono.org/listinfo/ofono
>

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


RE: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Vijay.Nayani
 

> -Original Message-
> From: Tomasz Gregorek [mailto:tomasz.grego...@gmail.com] 
> Sent: 22 February 2011 16:09
> To: ofono@ofono.org
> Cc: Nayani Vijay
> Subject: Re: [PATCH] atmodem: CEREG support for LTE network 
> status reporting in AT modem
> 
> Hi Vijay
> 
> 
> 2011/2/22 
> 
> 
> 
> 
>   > Subject: [PATCH] atmodem: CEREG support for LTE network
>   > status reporting in AT modem
>   >
>   > [PATCH] atmodem: CEREG support for LTE network status
>   > reporting in AT modem Tomasz Gregorek tomasz.gregorek at
>   > gmail.com Thu Feb 17 19:52:45 PST 2011
>   >
>   > * Previous message: [PATCH 2/5] bluetooth: add a
>   > bluetoothd connect watch
>   > * Next message: Problem with SIM lock states not showing
>   > correctly in Ofono API.
>   > * Messages sorted by: [ date ] [ thread ] [ 
> subject ] [ author ]
>   >
>   > From: Tomasz Gregorek 
>   
>   >
>   > This is a proposal for CEREG support based on the AT modem.
>   > Support in driver should work, though I have an issue 
> with the core.
>   >
>   > The core has one gprs status currently. In case of having
>   > second status for LTE, there is need of having two satuses,
>   > one for each, 3G and LTE, or to combine those two into one.
>   >
>   > I took second approach as it leaves current oFono API, though
>   > it is not perfect.
>   
>   
>   I have been working on solution that comprises of 
> separate eps atom and
>   corresponding driver. Code has been tested against 
> modified phonesim for
>   eps.Will provide an RFC patch soon once I bring it to 
> certain logical
>   end.
>   
>   Regards,
>   Vijay
>   
> 
> 
> This is what I was thinking about too.
> For me, from status point of view, both networks look very 
> similar, thats why I was thinking about using gprs atom / 
> driver for status handling and create separate atom for QoS / IMS.
> 

I agree with you , both bearers are almost similar.Minor difference i
see are context managment (especially default context creation) and some
eps related spill over on other existing atoms (For ex SIM would not
contain some ISIM (IMPU/IMPI)related stuff).My idea is seperate atoms
solution would even work for legacy switch back(CSFB) too with a minimal
impact on exiting architecture.Your comments on these ideas would also
very valuable here as i assume you have real modem unlike me.

> I am at most interested in your solution. I know from Denis 
> that this is what was agreed.
> 
> Br
> Tomasz Gregorek
> 

Will submit the rfc patch and short design write up once i have code
ready.

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


[PATCH] gatserver: Add various ATSx handlers

2011-02-22 Thread Olivier Guiter
---
 gatchat/gatserver.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index b092a68..cd86781 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -80,10 +80,14 @@ static const char *server_result_to_string(GAtServerResult 
result)
 
 /* Basic command setting for V.250 */
 struct v250_settings {
+   char s0;/* set by S0= */
char s3;/* set by S3= */
char s4;/* set by S4= */
char s5;/* set by S5= */
int s6; /* set by S6= */
+   int s7; /* set by S7= */
+   int s8; /* set by S8= */
+   int s10;/* set by S10= */
gboolean echo;  /* set by E */
gboolean quiet; /* set by Q */
gboolean is_v1; /* set by V, v0 or v1 */
@@ -319,6 +323,12 @@ static void s_template_cb(GAtServerRequestType type, 
GAtResult *result,
}
 }
 
+static void at_s0_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   s_template_cb(type, result, server, &server->v250.s0, "S0", 0, 7);
+}
+
 static void at_s3_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data)
 {
@@ -412,6 +422,24 @@ static void at_s6_cb(GAtServer *server, 
GAtServerRequestType type,
at_template_cb(type, result, server, &server->v250.s6, "S6", 0, 1, 1);
 }
 
+static void at_s7_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   at_template_cb(type, result, server, &server->v250.s7, "S7", 1, 255, 
50);
+}
+
+static void at_s8_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   at_template_cb(type, result, server, &server->v250.s8, "S8", 1, 255, 2);
+}
+
+static void at_s10_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   at_template_cb(type, result, server, &server->v250.s10, "S10", 1, 254, 
2);
+}
+
 static void at_c109_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data)
 {
@@ -1044,10 +1072,14 @@ static void server_wakeup_writer(GAtServer *server)
 
 static void v250_settings_create(struct v250_settings *v250)
 {
+   v250->s0 = 0;
v250->s3 = '\r';
v250->s4 = '\n';
v250->s5 = '\b';
v250->s6 = 2;
+   v250->s7 = 50;
+   v250->s8 = 2;
+   v250->s10 = 2;
v250->echo = TRUE;
v250->quiet = FALSE;
v250->is_v1 = TRUE;
@@ -1068,6 +1100,7 @@ static void at_notify_node_destroy(gpointer data)
 
 static void basic_command_register(GAtServer *server)
 {
+   g_at_server_register(server, "S0", at_s0_cb, NULL, NULL);
g_at_server_register(server, "S3", at_s3_cb, NULL, NULL);
g_at_server_register(server, "S4", at_s4_cb, NULL, NULL);
g_at_server_register(server, "S5", at_s5_cb, NULL, NULL);
@@ -1076,6 +1109,9 @@ static void basic_command_register(GAtServer *server)
g_at_server_register(server, "V", at_v_cb, NULL, NULL);
g_at_server_register(server, "X", at_x_cb, NULL, NULL);
g_at_server_register(server, "S6", at_s6_cb, NULL, NULL);
+   g_at_server_register(server, "S7", at_s7_cb, NULL, NULL);
+   g_at_server_register(server, "S8", at_s8_cb, NULL, NULL);
+   g_at_server_register(server, "S10", at_s10_cb, NULL, NULL);
g_at_server_register(server, "&C", at_c109_cb, NULL, NULL);
g_at_server_register(server, "&D", at_c108_cb, NULL, NULL);
 }
-- 
1.7.1

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


Re: [PATCH] Add CNAP to isimodem driver

2011-02-22 Thread Antoine Reversat
Has anyone have time to review this patch ?

On Sat, Feb 19, 2011 at 6:58 PM, Antoine Reversat  wrote:
> This patch adds CNAP support to the isimodem driver. Sorry if it's
> ugly or wrong, it's my first patch to this project. I have tested it
> and it works though (I get the callerid name as the Name property of
> an incoming voicecall).
>
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Tomasz Gregorek
Hi Vijay

2011/2/22 

>
>
> > Subject: [PATCH] atmodem: CEREG support for LTE network
> > status reporting in AT modem
> >
> > [PATCH] atmodem: CEREG support for LTE network status
> > reporting in AT modem Tomasz Gregorek tomasz.gregorek at
> > gmail.com Thu Feb 17 19:52:45 PST 2011
> >
> > * Previous message: [PATCH 2/5] bluetooth: add a
> > bluetoothd connect watch
> > * Next message: Problem with SIM lock states not showing
> > correctly in Ofono API.
> > * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> >
> > From: Tomasz Gregorek 
> >
> > This is a proposal for CEREG support based on the AT modem.
> > Support in driver should work, though I have an issue with the core.
> >
> > The core has one gprs status currently. In case of having
> > second status for LTE, there is need of having two satuses,
> > one for each, 3G and LTE, or to combine those two into one.
> >
> > I took second approach as it leaves current oFono API, though
> > it is not perfect.
>
> I have been working on solution that comprises of separate eps atom and
> corresponding driver. Code has been tested against modified phonesim for
> eps.Will provide an RFC patch soon once I bring it to certain logical
> end.
>
> Regards,
> Vijay
>

This is what I was thinking about too.
For me, from status point of view, both networks look very similar,
thats why I was thinking about using gprs atom / driver for
status handling and create separate atom for QoS / IMS.

I am at most interested in your solution. I know from Denis that
this is what was agreed.

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


RE: [PATCH] atmodem: CEREG support for LTE network status reporting in AT modem

2011-02-22 Thread Vijay.Nayani
 

> Subject: [PATCH] atmodem: CEREG support for LTE network 
> status reporting in AT modem
> 
> [PATCH] atmodem: CEREG support for LTE network status 
> reporting in AT modem Tomasz Gregorek tomasz.gregorek at 
> gmail.com Thu Feb 17 19:52:45 PST 2011
> 
> * Previous message: [PATCH 2/5] bluetooth: add a 
> bluetoothd connect watch
> * Next message: Problem with SIM lock states not showing 
> correctly in Ofono API.
> * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 
> From: Tomasz Gregorek 
> 
> This is a proposal for CEREG support based on the AT modem.
> Support in driver should work, though I have an issue with the core.
> 
> The core has one gprs status currently. In case of having 
> second status for LTE, there is need of having two satuses, 
> one for each, 3G and LTE, or to combine those two into one.
> 
> I took second approach as it leaves current oFono API, though 
> it is not perfect.

I have been working on solution that comprises of separate eps atom and
corresponding driver. Code has been tested against modified phonesim for
eps.Will provide an RFC patch soon once I bring it to certain logical
end.

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


[PATCH] ofono.rules - remove patch leftovers in linktop rule

2011-02-22 Thread Rolf Offermanns
Trivial fix for rules file.

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

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 121825e..a327923 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -452,7 +452,7 @@ ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0623", 
ENV{OFONO_DRIVER}="nokia"
 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="023e", 
ENV{OFONO_DRIVER}="nokiacdma"
 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="00b6", 
ENV{OFONO_DRIVER}="nokiacdma"
 
-+# Teracom (Linktop/LW27x) 3G Data Card
-+ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
+# Teracom (Linktop/LW27x) 3G Data Card
+ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
 
 LABEL="ofono_end"
-- 
1.7.4

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


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

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

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 48ae476..98abeec 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -176,7 +176,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult 
*result,
 static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd->cb;
+   ofono_gprs_context_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
GAtResultIter iter;
@@ -192,7 +192,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
gcd->active_context = 0;
decode_at_error(&error, g_at_result_final_response(result));
-   cb(&error, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   cb(&error, cbd->data);
return;
}
 
@@ -221,9 +221,13 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
dns[1] = rsp.dns_server2;
dns[2] = NULL;
 
-   CALLBACK_WITH_SUCCESS(cb, gcd->interface, TRUE, rsp.ip_address,
-   rsp.subnet_mask, NULL,
-   dns, cbd->data);
+   ofono_gprs_context_set_interface(gc, gcd->interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, rsp.ip_address);
+   ofono_gprs_context_set_ip_netmask(gc, rsp.subnet_mask);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+
+   CALLBACK_WITH_SUCCESS(cb, cbd->data);
return;
 
 error:
@@ -233,13 +237,13 @@ error:
g_markup_parse_context_free(context);
 
gcd->active_context = 0;
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   CALLBACK_WITH_FAILURE(cb, cbd->data);
 }
 
 static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd->cb;
+   ofono_gprs_context_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *ncbd;
@@ -250,7 +254,7 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
gcd->active_context = 0;
decode_at_error(&error, g_at_result_final_response(result));
-   cb(&error, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   cb(&error, cbd->data);
return;
}
 
@@ -265,18 +269,22 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
 
g_free(ncbd);
gcd->active_context = 0;
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   CALLBACK_WITH_FAILURE(cb, cbd->data);
 }
 
 static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[AUTH_BUF_LENGTH];
int len;
 
+   /* IPv6 support not implemented */
+   if (ctx->proto != OFONO_GPRS_PROTO_IP)
+   goto error;
+
gcd->active_context = ctx->cid;
cbd->user = gc;
 
@@ -311,7 +319,7 @@ error:
gcd->active_context = 0;
g_free(cbd);
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
-- 
1.7.1

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


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

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

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

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


[RESEND 2 PATCH 13/13] phonesim: add IPv6 support

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

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

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


[RESEND 2 PATCH 10/13] hsomodem: update to new gprs context interface

2011-02-22 Thread Mika Liljeberg
---
 drivers/hsomodem/gprs-context.c |   48 ++-
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c
index c132846..f9f1696 100644
--- a/drivers/hsomodem/gprs-context.c
+++ b/drivers/hsomodem/gprs-context.c
@@ -62,10 +62,7 @@ struct gprs_context_data {
GAtChat *chat;
unsigned int active_context;/* Currently active */
enum hso_state hso_state;   /* Are we in req ? */
-   union {
-   ofono_gprs_context_cb_t down_cb;/* Down callback */
-   ofono_gprs_context_up_cb_t up_cb;   /* Up callback */
-   };
+   ofono_gprs_context_cb_t cb;
void *cb_data;  /* Callback data */
int owancall;   /* State of the call */
 };
@@ -82,7 +79,7 @@ static void at_owancall_down_cb(gboolean ok, GAtResult 
*result,
/* Now we have to wait for the unsolicited notification to arrive */
if (ok && gcd->owancall != 0) {
gcd->hso_state = HSO_DISABLING;
-   gcd->down_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = cbd->data;
return;
}
@@ -95,14 +92,14 @@ static void at_owancall_up_cb(gboolean ok, GAtResult 
*result,
gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd->cb;
+   ofono_gprs_context_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct ofono_error error;
 
if (ok) {
gcd->hso_state = HSO_ENABLING;
-   gcd->up_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = cbd->data;
return;
}
@@ -110,13 +107,13 @@ static void at_owancall_up_cb(gboolean ok, GAtResult 
*result,
gcd->active_context = 0;
 
decode_at_error(&error, g_at_result_final_response(result));
-   cb(&error, NULL, FALSE, NULL, NULL, NULL, NULL, cbd->data);
+   cb(&error, cbd->data);
 }
 
 static void hso_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd->cb;
+   ofono_gprs_context_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *ncbd;
@@ -128,7 +125,7 @@ static void hso_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
gcd->active_context = 0;
 
decode_at_error(&error, g_at_result_final_response(result));
-   cb(&error, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   cb(&error, cbd->data);
return;
}
 
@@ -144,18 +141,22 @@ static void hso_cgdcont_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
 
gcd->active_context = 0;
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
+   CALLBACK_WITH_FAILURE(cb, cbd->data);
 }
 
 static void hso_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[AUTH_BUF_LENGTH];
int len;
 
+   /* IPv6 support not implemented */
+   if (ctx->proto != OFONO_GPRS_PROTO_IP)
+   goto error;
+
gcd->active_context = ctx->cid;
 
cbd->user = gc;
@@ -186,7 +187,7 @@ static void hso_gprs_activate_primary(struct 
ofono_gprs_context *gc,
 error:
g_free(cbd);
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void hso_gprs_deactivate_primary(struct ofono_gprs_context *gc,
@@ -265,11 +266,17 @@ static void owandata_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
ofono_info("IP: %s, Gateway: %s", ip, gateway);
ofono_info("DNS: %s, %s", dns1, dns2);
 
-   CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, ip,
-   STATIC_IP_NETMASK, gateway, dns, gcd->cb_data);
+   ofono_gprs_context_set_interface(gc, interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, ip);
+   ofono_gprs_context_set_ip_netmask(gc, STATIC_IP_NETMASK);
+   ofono_gprs_context_set_ip_gateway(gc, gateway);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
 

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

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

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

[RESEND 2 PATCH 09/13] mbmmodem: update to new gprs context interface

2011-02-22 Thread Mika Liljeberg
---
 drivers/mbmmodem/gprs-context.c |   65 ---
 1 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index 322f96d..972b35e 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -70,10 +70,7 @@ struct gprs_context_data {
gboolean have_e2ipcfg;
unsigned int enap_source;
enum mbm_state mbm_state;
-   union {
-   ofono_gprs_context_cb_t down_cb;/* Down callback */
-   ofono_gprs_context_up_cb_t up_cb;   /* Up callback */
-   };
+   ofono_gprs_context_cb_t cb;
void *cb_data;  /* Callback data */
int enap;   /* State of the call */
 };
@@ -141,11 +138,23 @@ out:
ofono_info("IP: %s  Gateway: %s", ip, gateway);
ofono_info("DNS: %s, %s", dns[0], dns[1]);
 
-   CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, success, ip,
-   STATIC_IP_NETMASK, gateway,
-   success ? dns : NULL, gcd->cb_data);
+   ofono_gprs_context_set_interface(gc, interface);
+
+   if (success) {
+   ofono_gprs_context_set_ip_addrconf(gc,
+   OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, ip);
+   ofono_gprs_context_set_ip_netmask(gc, STATIC_IP_NETMASK);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+   } else {
+   ofono_gprs_context_set_ip_addrconf(gc,
+   OFONO_GPRS_ADDRCONF_DHCP);
+   }
+
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+
gcd->mbm_state = MBM_NONE;
-   gcd->up_cb = NULL;
+   gcd->cb = NULL;
gcd->cb_data = NULL;
 }
 
@@ -169,11 +178,14 @@ static void mbm_get_ip_details(struct ofono_gprs_context 
*gc)
 
modem = ofono_gprs_context_get_modem(gc);
interface = ofono_modem_get_string(modem, "NetworkInterface");
-   CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, FALSE, NULL, NULL,
-   NULL, NULL, gcd->cb_data);
+
+   ofono_gprs_context_set_interface(gc, interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_DHCP);
+
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
 
gcd->mbm_state = MBM_NONE;
-   gcd->up_cb = NULL;
+   gcd->cb = NULL;
gcd->cb_data = NULL;
 }
 
@@ -191,12 +203,11 @@ static void mbm_state_changed(struct ofono_gprs_context 
*gc, int state)
DBG("disconnected");
 
if (gcd->mbm_state == MBM_DISABLING) {
-   CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
-   gcd->down_cb = NULL;
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+   gcd->cb = NULL;
} else if (gcd->mbm_state == MBM_ENABLING) {
-   CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL,
-   NULL, NULL, gcd->cb_data);
-   gcd->up_cb = NULL;
+   CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
+   gcd->cb = NULL;
} else {
ofono_gprs_context_deactivated(gc, gcd->active_context);
}
@@ -275,7 +286,7 @@ static void at_enap_down_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
/* Now we have to wait for the unsolicited notification to arrive */
if (ok && gcd->enap != 0) {
gcd->mbm_state = MBM_DISABLING;
-   gcd->down_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = cbd->data;
 
if (gcd->have_e2nap == FALSE)
@@ -292,7 +303,7 @@ static void at_enap_down_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 static void mbm_enap_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   ofono_gprs_context_up_cb_t cb = cbd->cb;
+   ofono_gprs_context_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct ofono_error error;
@@ -301,7 +312,7 @@ static void mbm_enap_up_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
if (ok) {
gcd->mbm_state = MBM_ENABLING;
-   gcd->up_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = cbd->data;
 
if (gcd->have_e2nap == FALSE)
@@ -314,13 +325,13 @@ static void mbm_enap_up_cb(gboolean ok, GAtResult 
*result, gpointer user_data)
gcd->active_context = 0;
 
decode_at_error(&error, g_at_result_final_response(result));
-   cb(&error, NULL, FALSE, NULL, NULL, NULL, NULL, cbd->data);
+   cb(&error, cbd->data);

[RESEND 2 PATCH 07/13] atmodem: update to new gprs context interface

2011-02-22 Thread Mika Liljeberg
---
 drivers/atmodem/gprs-context.c |   41 ---
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 56d65d4..2c4797b 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -62,10 +62,7 @@ struct gprs_context_data {
char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
GAtPPP *ppp;
enum state state;
-   union {
-   ofono_gprs_context_cb_t down_cb;/* Down callback */
-   ofono_gprs_context_up_cb_t up_cb;   /* Up callback */
-   };
+   ofono_gprs_context_cb_t cb;
void *cb_data;  /* Callback data */
 };
 
@@ -93,9 +90,12 @@ static void ppp_connect(const char *interface, const char 
*local,
ofono_info("DNS: %s, %s", dns1, dns2);
 
gcd->state = STATE_ACTIVE;
-   CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, local,
-   STATIC_IP_NETMASK, NULL,
-   dns, gcd->cb_data);
+   ofono_gprs_context_set_interface(gc, interface);
+   ofono_gprs_context_set_ip_addrconf(gc, OFONO_GPRS_ADDRCONF_STATIC);
+   ofono_gprs_context_set_ip_address(gc, local);
+   ofono_gprs_context_set_ip_netmask(gc, STATIC_IP_NETMASK);
+   ofono_gprs_context_set_dns_servers(gc, dns);
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
 }
 
 static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
@@ -110,11 +110,10 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, 
gpointer user_data)
 
switch (gcd->state) {
case STATE_ENABLING:
-   CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, FALSE, NULL,
-   NULL, NULL, NULL, gcd->cb_data);
+   CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
break;
case STATE_DISABLING:
-   CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
+   CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
break;
default:
ofono_gprs_context_deactivated(gc, gcd->active_context);
@@ -181,8 +180,7 @@ static void at_cgdata_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
gcd->state = STATE_IDLE;
 
decode_at_error(&error, g_at_result_final_response(result));
-   gcd->up_cb(&error, NULL, 0, NULL, NULL, NULL, NULL,
-   gcd->cb_data);
+   gcd->cb(&error, gcd->cb_data);
return;
}
 
@@ -204,8 +202,7 @@ static void at_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
gcd->state = STATE_IDLE;
 
decode_at_error(&error, g_at_result_final_response(result));
-   gcd->up_cb(&error, NULL, 0, NULL, NULL, NULL, NULL,
-   gcd->cb_data);
+   gcd->cb(&error, gcd->cb_data);
return;
}
 
@@ -217,22 +214,25 @@ static void at_cgdcont_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
gcd->active_context = 0;
gcd->state = STATE_IDLE;
 
-   CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL, NULL, NULL,
-   gcd->cb_data);
+   CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
 }
 
 static void at_gprs_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
-   ofono_gprs_context_up_cb_t cb, void *data)
+   ofono_gprs_context_cb_t cb, void *data)
 {
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
char buf[OFONO_GPRS_MAX_APN_LENGTH + 128];
int len;
 
+   /* IPv6 support not implemented */
+   if (ctx->proto != OFONO_GPRS_PROTO_IP)
+   goto error;
+
DBG("cid %u", ctx->cid);
 
gcd->active_context = ctx->cid;
-   gcd->up_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = data;
memcpy(gcd->username, ctx->username, sizeof(ctx->username));
memcpy(gcd->password, ctx->password, sizeof(ctx->password));
@@ -249,7 +249,8 @@ static void at_gprs_activate_primary(struct 
ofono_gprs_context *gc,
at_cgdcont_cb, gc, NULL) > 0)
return;
 
-   CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
+error:
+   CALLBACK_WITH_FAILURE(cb, data);
 }
 
 static void at_gprs_deactivate_primary(struct ofono_gprs_context *gc,
@@ -261,7 +262,7 @@ static void at_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
DBG("cid %u", cid);
 
gcd->state = STATE_DISABLING;
-   gcd->down_cb = cb;
+   gcd->cb = cb;
gcd->cb_data = data;
 
g_at_ppp_shutdown(gcd->ppp);
-- 
1.7.1

___
ofono mailing list
ofono@o

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

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

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

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


[RESEND 2 PATCH 06/13] isimodem: IPv6 support

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

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

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

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

diff --git a/src/gprs.c b/src/gprs.c
index b478f88..e19c5ca 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -34,6 +34,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -100,10 +102,12 @@ struct ofono_gprs {
struct ofono_sim_context *sim_context;
 };
 
+struct pri_context;
+
 struct ofono_gprs_context {
struct ofono_gprs *gprs;
+   struct pri_context *pri;
enum ofono_gprs_context_type type;
-   ofono_bool_t inuse;
const struct ofono_gprs_context_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -112,10 +116,11 @@ struct ofono_gprs_context {
 struct context_settings {
enum ofono_gprs_context_type type;
char *interface;
-   gboolean static_ip;
+   enum ofono_gprs_addrconf method;
char *ip;
char *netmask;
char *gateway;
+   char *ipv6;
char **dns;
char *proxy;
 };
@@ -227,6 +232,8 @@ static const char *gprs_proto_to_string(enum 
ofono_gprs_proto proto)
return "ip";
case OFONO_GPRS_PROTO_IPV6:
return "ipv6";
+   case OFONO_GPRS_PROTO_IPV4V6:
+   return "ipv4v6";
};
 
return NULL;
@@ -241,11 +248,28 @@ static gboolean gprs_proto_from_string(const char *str,
} else if (g_str_equal(str, "ipv6")) {
*proto = OFONO_GPRS_PROTO_IPV6;
return TRUE;
+   } else if (g_str_equal(str, "ipv4v6")) {
+   *proto = OFONO_GPRS_PROTO_IPV4V6;
+   return TRUE;
}
 
return FALSE;
 }
 
+static const char *gprs_addrconf_to_string(enum ofono_gprs_addrconf method)
+{
+   switch (method) {
+   case OFONO_GPRS_ADDRCONF_NONE:
+   return NULL;
+   case OFONO_GPRS_ADDRCONF_STATIC:
+   return "static";
+   case OFONO_GPRS_ADDRCONF_DHCP:
+   return "dhcp";
+   }
+
+   return NULL;
+}
+
 static unsigned int gprs_cid_alloc(struct ofono_gprs *gprs)
 {
return idmap_alloc(gprs->cid_map);
@@ -274,13 +298,13 @@ static gboolean assign_context(struct pri_context *ctx)
for (l = ctx->gprs->context_drivers; l; l = l->next) {
struct ofono_gprs_context *gc = l->data;
 
-   if (gc->inuse == TRUE)
+   if (gc->pri != NULL)
continue;
 
if (gc->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
gc->type == ctx->type) {
ctx->context_driver = gc;
-   ctx->context_driver->inuse = TRUE;
+   gc->pri = ctx;
return TRUE;
}
}
@@ -295,7 +319,7 @@ static void release_context(struct pri_context *ctx)
 
gprs_cid_release(ctx->gprs, ctx->context.cid);
ctx->context.cid = 0;
-   ctx->context_driver->inuse = FALSE;
+   ctx->context_driver->pri = NULL;
ctx->context_driver = NULL;
 }
 
@@ -314,14 +338,22 @@ static struct pri_context *gprs_context_by_path(struct 
ofono_gprs *gprs,
return NULL;
 }
 
-static void context_settings_free(struct context_settings *settings)
+static void pri_context_settings_free(struct pri_context *ctx)
 {
+   struct context_settings *settings = ctx->settings;
+
+   if (settings == NULL)
+   return;
+
+   ctx->settings = NULL;
+
g_free(settings->interface);
g_free(settings->ip);
g_free(settings->netmask);
g_free(settings->gateway);
g_strfreev(settings->dns);
g_free(settings->proxy);
+   g_free(settings->ipv6);
 
g_free(settings);
 }
@@ -360,12 +392,10 @@ static void context_settings_append_variant(struct 
context_settings *settings,
goto done;
}
 
-   if (settings->static_ip == TRUE)
-   method = "static";
-   else
-   method = "dhcp";
-
-   ofono_dbus_dict_append(&array, "Method", DBUS_TYPE_STRING, &method);
+   method = gprs_addrconf_to_string(settings->method);
+   if (method != NULL)
+   ofono_dbus_dict_append(&array, "Method", DBUS_TYPE_STRING,
+   &method);
 
if (settings->ip)
ofono_dbus_dict_append(&array, "Address", DBUS_TYPE_STRING,
@@ -379,6 +409,10 @@ static void context_settings_append_variant(struct 
context_settings *settings,
ofono_dbus_dict_append(&array, "Gateway", DBUS_TYPE_STRING,
&settings->gateway);
 
+   if (settings->ipv6 != NULL)
+   ofono_dbus_dict_append(&array, "IPv6Address", DBUS_TYPE_STRING,
+   &settings->ipv6);
+
if (settings->dns)
ofono_dbus_dict_append_array(&array, "DomainNameServers"

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

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

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

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


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

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

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

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


[RESEND 2 PATCH 00/13] IPv6 Support

2011-02-22 Thread Mika Liljeberg
*thump* *thump*

Is this microphone on?

Rebased to current master.

Regards,

MikaL

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

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


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

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

diff --git a/src/gprs.c b/src/gprs.c
index 33711dc..b478f88 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -256,6 +256,49 @@ static void gprs_cid_release(struct ofono_gprs *gprs, 
unsigned int id)
idmap_put(gprs->cid_map, id);
 }
 
+static gboolean assign_context(struct pri_context *ctx)
+{
+   struct idmap *cidmap = ctx->gprs->cid_map;
+   unsigned int cid_min;
+   GSList *l;
+
+   if (cidmap == NULL)
+   return FALSE;
+
+   cid_min = idmap_get_min(cidmap);
+
+   ctx->context.cid = gprs_cid_alloc(ctx->gprs);
+   if (ctx->context.cid == 0)
+   return FALSE;
+
+   for (l = ctx->gprs->context_drivers; l; l = l->next) {
+   struct ofono_gprs_context *gc = l->data;
+
+   if (gc->inuse == TRUE)
+   continue;
+
+   if (gc->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
+   gc->type == ctx->type) {
+   ctx->context_driver = gc;
+   ctx->context_driver->inuse = TRUE;
+   return TRUE;
+   }
+   }
+
+   return FALSE;
+}
+
+static void release_context(struct pri_context *ctx)
+{
+   if (ctx == NULL || ctx->gprs == NULL || ctx->context_driver == NULL)
+   return;
+
+   gprs_cid_release(ctx->gprs, ctx->context.cid);
+   ctx->context.cid = 0;
+   ctx->context_driver->inuse = FALSE;
+   ctx->context_driver = NULL;
+}
+
 static struct pri_context *gprs_context_by_path(struct ofono_gprs *gprs,
const char *ctx_path)
 {
@@ -704,12 +747,7 @@ static void pri_activate_callback(const struct ofono_error 
*error,
telephony_error_to_str(error));
__ofono_dbus_pending_reply(&ctx->pending,
__ofono_error_failed(ctx->pending));
-
-   gprs_cid_release(ctx->gprs, ctx->context.cid);
-   ctx->context.cid = 0;
-   ctx->context_driver->inuse = FALSE;
-   ctx->context_driver = NULL;
-
+   release_context(ctx);
return;
}
 
@@ -745,11 +783,8 @@ static void pri_deactivate_callback(const struct 
ofono_error *error, void *data)
return;
}
 
-   gprs_cid_release(ctx->gprs, ctx->context.cid);
-   ctx->context.cid = 0;
+   release_context(ctx);
ctx->active = FALSE;
-   ctx->context_driver->inuse = FALSE;
-   ctx->context_driver = NULL;
 
__ofono_dbus_pending_reply(&ctx->pending,
dbus_message_new_method_return(ctx->pending));
@@ -996,38 +1031,6 @@ static DBusMessage *pri_set_message_center(struct 
pri_context *ctx,
return NULL;
 }
 
-static gboolean assign_context(struct pri_context *ctx)
-{
-   struct idmap *cidmap = ctx->gprs->cid_map;
-   unsigned int cid_min;
-   GSList *l;
-
-   if (cidmap == NULL)
-   return FALSE;
-
-   cid_min = idmap_get_min(cidmap);
-
-   ctx->context.cid = gprs_cid_alloc(ctx->gprs);
-   if (ctx->context.cid == 0)
-   return FALSE;
-
-   for (l = ctx->gprs->context_drivers; l; l = l->next) {
-   struct ofono_gprs_context *gc = l->data;
-
-   if (gc->inuse == TRUE)
-   continue;
-
-   if (gc->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
-   gc->type == ctx->type) {
-   ctx->context_driver = gc;
-   ctx->context_driver->inuse = TRUE;
-   return TRUE;
-   }
-   }
-
-   return FALSE;
-}
-
 static DBusMessage *pri_set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
 {
@@ -1345,14 +1348,9 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
if (ctx->active == FALSE)
continue;
 
-   gprs_cid_release(gprs, ctx->context.cid);
-   ctx->context.cid = 0;
+   release_context(ctx);
ctx->active = FALSE;
-   ctx->context_driver->inuse = FALSE;
-   ctx->context_driver = NULL;
-
pri_reset_context_settings(ctx);
-
value = FALSE;
ofono_dbus_signal_property_changed(conn, ctx->path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
@@ -1737,10 +1735,7 @@ static void gprs_deactivate_for_remove(const struct 
ofono_error *error,
return;
}
 
-   gprs_cid_release(gprs, ctx->context.cid);
-   ctx->context.cid = 0;
-   ctx->context_driver->inuse = FALSE;

Re: gatchat looses UR code if received while waiting a response

2011-02-22 Thread Lasse Kunnasluoto
Hi Denis,

On Mon, 2011-02-21 at 17:14 +0200, Denis Kenzior wrote:
> Hi Lasse,
> 
> On 02/21/2011 05:01 AM, Lasse Kunnasluoto wrote:
> > Hi Marcel,
> > 
> > On Mon, 2011-02-21 at 12:04 +0200, Marcel Holtmann wrote:
> >> Hi Lasse,
> >>
> >>> I've seen an issue in Unsolicited Result code handling in gatchat. If
> >>> ofono has sent an AT command and is waiting for a response, but modem
> >>> has sent an UR code just before the AT command reached the modem,
> >>> gatchat does not handle that UR code correctly (it drops it). 
> >>>
> >>> 27.007 does not restrict UR-sending in the time between AT command and
> >>> sending final response.
> >>>
> >>> Even modem would not send an UR while an active AT command, this may
> >>> happen as a command may be on its way to ofono (e.g. in kernel).
> >>
> >> actually GAtChat handles this correctly. Important is what you give as
> >> valid_resp to g_at_chat_send. If this is NULL, then all lines between
> >> the command and OK are consumed by the callback of the send command.
> >>
> > agree, but it would require a quite effort to change all the NULLs to
> > something meaningful + test with various modems.
> > 
> 
> You should not be passing NULL in the first place.  The reason CGMM does
> so is that it has no prefix in the spec (a hold over from V.250).  So if
> you have not been using proper prefixes, I'm afraid you have to fix them
> properly.  The spec mandates the prefixes to expect, so this shouldn't
> be so hard anyway.
> 
STE modems mainly use the code in the atmodem driver. If the prefixes
are correct there we shouldn't have an issue with prefixes. 

> >>> Real example of this happening:
> >>> ofonod[1388]: Default: > AT+CGMM\r  
> >>> ofonod[1388]: Default: < \r
> >>> \n*STKI:"D027810301258082028182850A5361756E616C616874698F09013E507265706169641801241F020103"\r\n
> >>>  
> >>> ofonod[1388]: Default: < \r\nST-Ericsson Mobile Broadband\r\n\r\nOK\r
> >>> \n  
> >>>
> >>> In this case the call back of *STKI was never called.
> >>>
> >>> This is not a modem issue as it has been verified the modem has sent
> >>> *STKI before AT+CGMM was received.
> >>
> >> I consider this a modem issue. It should not send *STKI during a AT+CGMM
> >> command to avoid any kind of confusion of the parser.
> >>
> > This specific case is not a modem issue. Modem has not received AT+CGMM
> > when it sent *STKI (This was verified from modem logs). Modem cannot
> > predict that there is AT+CGMM coming. Command was sent exactly same time
> > on modem and ofono side. 
> > 
> > This is timing depend issue and in my opinion may occur with any AT
> > modem. Ofono and Modem states are not always the same as there is
> > certain delay when commands are exchanged between ofono and modem. These
> > issues may be hidden most of the time but may cause some nasty errors
> > some day.
> > 
> 
> Sounds like the read watch priority should be higher than the write
> watch priority to avoid this specific example.  Care to send a patch?
> 
I tried this. I put G_PRIORITY_HIGH to the read watch and
G_PRIORITY_DEFAULT/LOW to write watch. No improvement on my environment.

Changing the priorities may break other use cases, e.g. the one with IFX
modems: "gatchat: improve large file downlink data transfer"
This patch changed the priority of write watch to HIGH. 

> >>> One way to solve this is to change the sequence in gatchat.c/have_line()
> >>> a bit and check first if this is UR code and then proceeding to response
> >>> handling. Would this be acceptable solution for this issue or would it
> >>> cause some drawbacks? If it is okay I can submit a patch
> >>
> >> See my command above. GAtChat is operating just fine.
> >>
> > More robust solution would be to change GAtChat than defining and
> > finding valid_resps for tens or hundreds of AT commands. I want to point
> > out that this is not only an issue with CGMM but may occur with any AT
> > command when the timing matches.
> > 
> 
> There's nothing you can do in GAtChat at this point.  Having the
> unsolicited response handler fire and consume lines before the pending
> AT command handler won't work either.  If you're not convinced, try
> handling solicited / unsolicited CREG/CGREG and friends.
Okay, good to know this, I was not aware. Perhaps I need to reconsider
the way forward with this issue, we could change the startup sequence of
different drivers and that way get around this issue. 

BR,
-Lasse
> 
> Regards,
> -Denis


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


rs.sysinit ofono problem

2011-02-22 Thread Konrad.Slowinski
http://comments.gmane.org/gmane.comp.handhelds.meego.devel/5601

it seems like it's not only small problem
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 2/3] ssn: add code and call id to notifications

2011-02-22 Thread Sankar
Hi Denis/Andras,

Is this patch applied and available in the GIT?

Regards,
Sankar.

On Thu, Feb 10, 2011 at 2:42 PM, Andras Domokos wrote:

> Hi Denis,
>
>
> On 02/10/2011 05:08 AM, ext Denis Kenzior wrote:
>
>> Hi Andras,
>>
>>  diff --git a/include/ssn.h b/include/ssn.h
>>> index d640cad..ba3701b 100644
>>> --- a/include/ssn.h
>>> +++ b/include/ssn.h
>>> @@ -37,9 +37,10 @@ struct ofono_ssn_driver {
>>>  };
>>>
>>>  /* SSN notifications (CSSI and CSSU).  */
>>> -void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code, int index);
>>> -void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code, int index,
>>> -   const struct ofono_phone_number *number);
>>> +void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
>>> +   int code1, int index);
>>> +void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int
>>> code2,
>>> +   int index, const struct ofono_phone_number
>>> *number);
>>>
>>>  int ofono_ssn_driver_register(const struct ofono_ssn_driver *d);
>>>  void ofono_ssn_driver_unregister(const struct ofono_ssn_driver *d);
>>>
>> Right now I'm not seeing any users (or even potential ones) of the SSN
>> atom besides voicecall.  What do you think of removing the SSN atom and
>> moving these to the voicecall atom?
>>
> Yes, we talked about removing the SSN atom, but I thought I would
> keep it for now, it can be removed any time later, anyways, doesn't
> save much removing it.
>
>
>  The only one I'm not sure about is  from 27.007:
>> 6   forward check SS message received (can be received whenever)
>>
>> Any idea what this one is about?
>>
>>  Never encountered this message, and I am not sure what is it for.
> A patch for handling this message can be submitted later, if a real
> life case is found for it.
>
>  Regards,
>> -Denis
>>
> Regards,
> Andras
>
> ___
> ofono mailing list
> ofono@ofono.org
> http://lists.ofono.org/listinfo/ofono
>
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] sim: showing lock state with call meter

2011-02-22 Thread Jussi Kangas
---
Hi,

On Mon, 2011-02-21 at 17:21 +0200, Denis Kenzior wrote:

> It seems to be showing the states correctly except in case when you make
> > PIN2 blocked using call meter API. If PIN2 goes blocked when using
> > callmeter nothing is shown in API. (My patch did not do that either.
> > Plan was to fix it in separate patch)
> > 
> 
> Please do.  Most modems do not support PIN2 entry via CPIN, and
> implement this using a vendor extension.  PIN2 / PUK2 support seems to
> be a rather recent addition to the specs.
> 
Here it is. Also after this patch having PUK2 blocked does not prevent
going online anymore in start up and it does not hide the interfaces if
PIN2 goes blocked during usage.

> There seems to be also some problem when API shows PUK2 required and PIN
> > and PIN2 locked. Reset-pin opens the PUK2 but API does not get the
> > response it's looking for and oFono needs to be booted before states are
> > showed correctly again. I suspect that's a separate issue however and
> > not caused by this patch. 
> > 
> 
> I'm having trouble visualizing this one.  Can you provide an AT debug
> log to illustrate?
> 
I found the problem already. Looks like modem problem which has nothing to
do with having multiple locks on/blocked or with your change. Reseting
the PIN2 does not seem to trigger expected event in startup.

Br,
Jussi

 include/sim.h|2 ++
 src/call-meter.c |   27 +++
 src/sim.c|8 
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 412ae44..a56056e 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -227,6 +227,8 @@ unsigned int ofono_sim_add_file_watch(struct 
ofono_sim_context *context,
 void ofono_sim_remove_file_watch(struct ofono_sim_context *context,
unsigned int id);
 
+void sim_pin_check(struct ofono_sim *sim);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/call-meter.c b/src/call-meter.c
index 0789935..61678d8 100644
--- a/src/call-meter.c
+++ b/src/call-meter.c
@@ -335,11 +335,20 @@ static void set_acm_max_query_callback(const struct 
ofono_error *error,
 static void set_acm_max_callback(const struct ofono_error *error, void *data)
 {
struct ofono_call_meter *cm = data;
+   struct ofono_atom *sim_atom;
+   struct ofono_sim *sim = NULL;
 
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("Setting acm_max failed");
__ofono_dbus_pending_reply(&cm->pending,
__ofono_error_failed(cm->pending));
+   sim_atom = __ofono_modem_find_atom(
+   __ofono_atom_get_modem(cm->atom),
+   OFONO_ATOM_TYPE_SIM);
+   if (!sim_atom)
+   return;
+   sim = __ofono_atom_get_data(sim_atom);
+   sim_pin_check(sim);
return;
}
 
@@ -396,11 +405,20 @@ static void set_puct_query_callback(const struct 
ofono_error *error,
 static void set_puct_callback(const struct ofono_error *error, void *data)
 {
struct ofono_call_meter *cm = data;
+   struct ofono_atom *sim_atom;
+   struct ofono_sim *sim = NULL;
 
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("setting puct failed");
__ofono_dbus_pending_reply(&cm->pending,
__ofono_error_failed(cm->pending));
+   sim_atom = __ofono_modem_find_atom(
+   __ofono_atom_get_modem(cm->atom),
+   OFONO_ATOM_TYPE_SIM);
+   if (!sim_atom)
+   return;
+   sim = __ofono_atom_get_data(sim_atom);
+   sim_pin_check(sim);
return;
}
 
@@ -593,11 +611,20 @@ static void reset_acm_query_callback(const struct 
ofono_error *error, int value,
 static void acm_reset_callback(const struct ofono_error *error, void *data)
 {
struct ofono_call_meter *cm = data;
+   struct ofono_atom *sim_atom;
+   struct ofono_sim *sim = NULL;
 
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("reseting acm failed");
__ofono_dbus_pending_reply(&cm->pending,
__ofono_error_failed(cm->pending));
+   sim_atom = __ofono_modem_find_atom(
+   __ofono_atom_get_modem(cm->atom),
+   OFONO_ATOM_TYPE_SIM);
+   if (!sim_atom)
+   return;
+   sim = __ofono_atom_get_data(sim_atom);
+   sim_pin_check(sim);
return;
}
 
diff --git a/src/sim.c b/src/sim.c
index c39269d..08236f2 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -49,7 +49,6 @@
 static GSList *g_drivers = NULL;
 
 static void sim_own_numbers_update(struct ofono_sim *sim);
-static void sim_pin_check(struct ofono_sim *sim);
 
 struct ofono_sim {
   

Supported USB modems?

2011-02-22 Thread Rolf Offermanns
Hi All,

I am trying to get ofono to work with several usb modems from Vodofone
(ZTE and Huawei inside) and so far not a single one works.

I don't have the time to fix this myself, but I can provide logs, do
tests, etc. if there is somebody who is interested in fixing this.

Which devices do you use for testing?

List of my devices:
Huawei E172 [12d1:1003] (connector loose, don't know how long it will work)
Huawei K3715 [12d1:1001]
ZTE K4505-Z [19d2:2000]
ZTE K3765-Z [19d2:2002]

The only modem that actually shows up in the list-modems output is the
Huawei K3715. But "online-modem" fails.

I am on current git.

If anyone can help and spare some time, please tell me what you need
from me.
If you need logs, is "OFONO_AT_DEBUG=1 ./src/ofonod -d '*' -n" OK and
shall I sent them to this list (will be a long mail)?

Thanks,
Rolf
-- 
Rolf Offermanns 
SYSGO AG Tel.: +49-6136-9948-0
Am Pfaffenstein 14   Fax: +49-6136-9948-10
55270 Klein-Winternheim  http://www.sysgo.com

Handelsregister: HRB Mainz 90 HRB 8066
Vorstand: Michael Tiedemann
Aufsichtsratsvorsitzender: Juergen Bullacher
USt(VAT)-Id-Nr.: DE 149062328
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [RFC PATCH v3] gprs: add function to handle activated context

2011-02-22 Thread Soum, RedouaneX
Hi,

> -Original Message-
> From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of
> Soum, RedouaneX
> Sent: Wednesday, February 09, 2011 7:32 PM
> To: ofono@ofono.org
> Subject: [RFC PATCH v3] gprs: add function to handle activated context
> 

This RFC patch includes all the modifications according to the comments I got 
on previous version.
I didn't get any comment on this one, what are the next steps for acceptance ?

Should I send a patch in two parts (gprs/idmap) ?

Regards,
-
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