[PATCH] Fix huawei_disconnect function issue

2011-03-03 Thread martin . xu
From: Martin Xu 

huawei_disconnect is used to recovery the io and gprs context when
io error happends, see commit 39382730d7758b093ca6271f4e9dea875fa04b3a
However, io error not only happends at PPP disconnect, in theory it
can happends at any situation. I also observed that it happens when modem
go into offline mode at my Huawei EM770W modem. in this case, gprs should
not be reopened.
---
 plugins/huawei.c |   49 +++--
 1 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/plugins/huawei.c b/plugins/huawei.c
index 6f05677..939509f 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -78,6 +78,7 @@ struct huawei_data {
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
gboolean voice;
+   gboolean online;
gboolean ndis;
guint sim_poll_timeout;
guint sim_poll_count;
@@ -97,6 +98,7 @@ static int huawei_probe(struct ofono_modem *modem)
if (data == NULL)
return -ENOMEM;
 
+   data->online = FALSE;
ofono_modem_set_data(modem, data);
 
return 0;
@@ -470,10 +472,7 @@ static void huawei_disconnect(gpointer user_data)
struct ofono_modem *modem = user_data;
struct huawei_data *data = ofono_modem_get_data(modem);
 
-   DBG("");
-
-   if (data->gc)
-   ofono_gprs_context_remove(data->gc);
+   DBG("data->online %d", data->online);
 
g_at_chat_unref(data->modem);
data->modem = NULL;
@@ -485,6 +484,13 @@ static void huawei_disconnect(gpointer user_data)
g_at_chat_set_disconnect_function(data->modem,
huawei_disconnect, modem);
 
+   /* reopen GPRS context channel only at online state */
+   if (data->online == FALSE)
+   return;
+
+   if (data->gc)
+   ofono_gprs_context_remove(data->gc);
+
if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
ofono_info("Reopened GPRS context channel");
@@ -579,15 +585,25 @@ static int huawei_disable(struct ofono_modem *modem)
return -EINPROGRESS;
 }
 
+struct huawei_cb_data {
+   struct cb_data *cbd;
+   ofono_bool_t online;
+   struct ofono_modem *modem;
+};
+
 static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
-   struct cb_data *cbd = user_data;
-   ofono_modem_online_cb_t cb = cbd->cb;
+   struct huawei_cb_data *online_cbd = user_data;
+   ofono_modem_online_cb_t cb = online_cbd->cbd->cb;
+   struct huawei_data *data = ofono_modem_get_data(online_cbd->modem);
 
-   if (ok)
-   CALLBACK_WITH_SUCCESS(cb, cbd->data);
+   if (ok) {
+   data->online = online_cbd->online;
+
+   CALLBACK_WITH_SUCCESS(cb, online_cbd->cbd->data);
+   }
else
-   CALLBACK_WITH_FAILURE(cb, cbd->data);
+   CALLBACK_WITH_FAILURE(cb, online_cbd->cbd->data);
 }
 
 static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
@@ -595,21 +611,26 @@ static void huawei_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 {
struct huawei_data *data = ofono_modem_get_data(modem);
GAtChat *chat = data->pcui;
-   struct cb_data *cbd = cb_data_new(cb, user_data);
+   struct huawei_cb_data *online_cbd;
char const *command = online ? "AT+CFUN=1" : "AT+CFUN=5";
 
DBG("modem %p %s", modem, online ? "online" : "offline");
 
-   if (cbd == NULL)
+   online_cbd = g_try_new0(struct huawei_cb_data, 1);
+   online_cbd->cbd = cb_data_new(cb, user_data);
+   if (online_cbd->cbd == NULL)
goto error;
+   online_cbd->online = online;
+   online_cbd->modem = modem;
 
-   if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
+   if (g_at_chat_send(chat, command, NULL, set_online_cb,
+   online_cbd, g_free))
return;
 
 error:
-   g_free(cbd);
+   g_free(online_cbd);
 
-   CALLBACK_WITH_FAILURE(cb, cbd->data);
+   CALLBACK_WITH_FAILURE(cb, user_data);
 }
 
 static void huawei_pre_sim(struct ofono_modem *modem)
-- 
1.6.1.3

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


RE: patch to fix BMC #13679 Huawei EM770: ofonod crash when disable/enable 3G technology

2011-03-03 Thread Xu, Martin
Hi Denis:

> > struct ofono_gprs *gprs;
> > struct ofono_gprs_context *gc;
> > gboolean voice;
> > +   gboolean online;
> 
> I don't think you really need this one, you can use the presence of gprs
> atom instead.
Gprs atom is not reliable here. Because gprs will be flushed when entering 
offline mode
> 
> > gboolean ndis;
> > guint sim_poll_timeout;
> > guint sim_poll_count;
> > @@ -97,6 +98,7 @@ static int huawei_probe(struct ofono_modem *modem)
> > if (data == NULL)
> > return -ENOMEM;
> >
> > +   data->online = FALSE;
> > ofono_modem_set_data(modem, data);
> >
> > return 0;
> > @@ -111,6 +113,11 @@ static void huawei_remove(struct ofono_modem
> *modem)
> > ofono_modem_set_data(modem, NULL);
> >
> > if (data->modem)
> > +   /*
> > +* huawei_disconnect should not be called when the chat
> > +* is closed initiatively
> > +*/
> > +   g_at_chat_set_disconnect_function(data->modem, NULL, NULL);
> > g_at_chat_unref(data->modem);
> 
> Are you missing some parentheses around the if statement now?
> 
> Setting the disconnect function here seems fishy.  We automatically set
> it to NULL when GAtIO is unref-ed.  Seems to me g_at_chat_unref should
> be enough.
You are quite right. 
> 
> >
> > g_at_chat_unref(data->pcui);
> > @@ -470,10 +477,7 @@ static void huawei_disconnect(gpointer user_data)
> > struct ofono_modem *modem = user_data;
> > struct huawei_data *data = ofono_modem_get_data(modem);
> >
> > -   DBG("");
> > -
> > -   if (data->gc)
> > -   ofono_gprs_context_remove(data->gc);
> > +   DBG("data->online %d", data->online);
> >
> > g_at_chat_unref(data->modem);
> > data->modem = NULL;
> > @@ -485,6 +489,13 @@ static void huawei_disconnect(gpointer user_data)
> > g_at_chat_set_disconnect_function(data->modem,
> > huawei_disconnect, modem);
> >
> > +   /* reopen GPRS context channel only at online state */
> > +   if (data->online == FALSE)
> > +   return;
> > +
> > +   if (data->gc)
> > +   ofono_gprs_context_remove(data->gc);
> > +
> > if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
> > data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
> > ofono_info("Reopened GPRS context channel");
> > @@ -515,6 +526,11 @@ static int huawei_enable(struct ofono_modem
> *modem)
> >
> > data->pcui = open_device(modem, "Pcui", "PCUI: ");
> > if (data->pcui == NULL) {
> > +   /*
> > +* huawei_disconnect should not be called when the chat
> > +* is closed initiatively
> > +*/
> > +   g_at_chat_set_disconnect_function(data->modem, NULL, NULL);
> > g_at_chat_unref(data->modem);
> > data->modem = NULL;
> > return -EIO;
> > @@ -564,6 +580,11 @@ static int huawei_disable(struct ofono_modem
> *modem)
> > if (data->modem) {
> > g_at_chat_cancel_all(data->modem);
> > g_at_chat_unregister_all(data->modem);
> > +   /*
> > +* huawei_disconnect should not be called when the chat
> > +* is closed initiatively
> > +*/
> > +   g_at_chat_set_disconnect_function(data->modem, NULL, NULL);
> > g_at_chat_unref(data->modem);
> > data->modem = NULL;
> > }
> > @@ -579,15 +600,27 @@ static int huawei_disable(struct ofono_modem
> *modem)
> > return -EINPROGRESS;
> >  }
> >
> > +struct huawei_cb_data {
> > +   struct cb_data *cbd;
> > +   ofono_bool_t online;
> > +   struct ofono_modem *modem;
> > +};
> > +
> >  static void set_online_cb(gboolean ok, GAtResult *result, gpointer
> user_data)
> >  {
> > -   struct cb_data *cbd = user_data;
> > -   ofono_modem_online_cb_t cb = cbd->cb;
> > +   struct huawei_cb_data *online_cbd = user_data;
> > +   ofono_modem_online_cb_t cb = online_cbd->cbd->cb;
> > +   struct huawei_data *data =
> ofono_modem_get_data(online_cbd->modem);
> >
> > -   if (ok)
> > -   CALLBACK_WITH_SUCCESS(cb, cbd->data);
> > +   if (ok) {
> > +   data->online = online_cbd->online;
> > +
> > +   CALLBACK_WITH_SUCCESS(cb, online_cbd->cbd->data);
> > +
> > +   g_free(online_cbd);
> > +   }
> > else
> > -   CALLBACK_WITH_FAILURE(cb, cbd->data);
> > +   CALLBACK_WITH_FAILURE(cb, online_cbd->cbd->data);
> >  }
> 
> All of this can be better accomplished by using two separate callbacks.
>  One for online and one for offline.
agree

> 
> I suspect all you need to do is unref data->modem, set data->gc and
> data->gprs to NULL in the offline callback prior to calling back into
> the core.
Logically, call back only needs to set offline states
It is Huawei_disconnect's duty to decide the operation. 
In theory, Huawei_disconnect may be called at any situation when io error 
happens.
(I observed two place, one is at ppp_disconnect the other is at offlin

Re: [PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Denis Kenzior
Hi Lucas,

On 03/03/2011 04:23 PM, Lucas De Marchi wrote:
> Instead of using a GAtChat, just use a GIOChannel and close it as soon
> as its fd is sent to core.
> ---
>  drivers/mbmmodem/location-reporting.c |   32 +++-
>  1 files changed, 15 insertions(+), 17 deletions(-)
> 

Patch has been applied, thanks.

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


[PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Lucas De Marchi
Instead of using a GAtChat, just use a GIOChannel and close it as soon
as its fd is sent to core.
---
 drivers/mbmmodem/location-reporting.c |   32 +++-
 1 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/mbmmodem/location-reporting.c 
b/drivers/mbmmodem/location-reporting.c
index 941fac4..b76a5c2 100644
--- a/drivers/mbmmodem/location-reporting.c
+++ b/drivers/mbmmodem/location-reporting.c
@@ -94,13 +94,13 @@ static void mbm_location_reporting_disable(struct 
ofono_location_reporting *lr,
g_free(cbd);
 }
 
-static int mbm_create_data_chat(struct ofono_location_reporting *lr)
+static int enable_data_stream(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;
+   GIOStatus status;
+   gsize written;
int fd;
 
modem = ofono_location_reporting_get_modem(lr);
@@ -110,15 +110,18 @@ static int mbm_create_data_chat(struct 
ofono_location_reporting *lr)
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);
+   status = g_io_channel_write_chars(channel, "AT*E2GPSNPD\r\n", -1,
+   &written, NULL);
 
-   g_at_syntax_unref(syntax);
+   g_io_channel_set_close_on_unref(channel, FALSE);
g_io_channel_unref(channel);
 
-   if (gd->data_chat == NULL)
+   if (status != G_IO_STATUS_NORMAL || written != 13) {
+   close(fd);
+
return -1;
+   }
 
return fd;
 }
@@ -129,7 +132,6 @@ static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult 
*result,
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(lr);
struct ofono_error error;
int fd;
 
@@ -143,20 +145,16 @@ static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult 
*result,
return;
}
 
-   fd = mbm_create_data_chat(lr);
+   fd = enable_data_stream(lr);
 
-   if (fd < 0)
-   goto out;
-
-   if (g_at_chat_send(gd->data_chat, "AT*E2GPSNPD", NULL, NULL, NULL,
-   NULL) > 0) {
-   cb(&error, fd, cbd->data);
+   if (fd < 0) {
+   CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
 
return;
}
 
-out:
-   CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+   cb(&error, fd, cbd->data);
+   close(fd);
 }
 
 static void mbm_location_reporting_enable(struct ofono_location_reporting *lr,
-- 
1.7.4.1

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


Re: [PATCH 3/5] cell-info: Atom for neighbor cell info

2011-03-03 Thread Aki Niemi
Hi Antti,

2011/2/14 Antti Paila :
> ---
>  src/cell-info.c |  475 
> +++
>  1 files changed, 475 insertions(+), 0 deletions(-)
>  create mode 100644 src/cell-info.c
>
> diff --git a/src/cell-info.c b/src/cell-info.c
> new file mode 100644
> index 000..6e70202
> --- /dev/null
> +++ b/src/cell-info.c
> @@ -0,0 +1,475 @@
> +/*
> + *
> + *  oFono - Open Source Telephony
> + *
> + *  Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
> + *
> + *  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 "ofono.h"
> +
> +#include "common.h"
> +#include "ofono/cell-info.h"

This doesn't belong here; you need to add an include statement for
cell-info.h into src/ofono.h.

> +
> +

Extra empty line here.

> +struct ofono_cell_info {
> +       DBusMessage *pending;
> +       struct ofono_atom *atom;
> +       const struct ofono_cell_info_driver *driver;
> +       void *driver_data;
> +};
> +
> +

Extra empty line here.

> +static DBusMessage *ci_get_cells(DBusConnection *, DBusMessage *, void *);

Can this forward declaration be avoided?

> +
> +static GSList *g_drivers = NULL;
> +
> +static GDBusMethodTable ci_methods[] = {
> +       { "AquireMeasurement",  "",     "aa{sv}",       ci_get_cells,
> +                                       G_DBUS_METHOD_FLAG_ASYNC },
> +       { }
> +};
> +
> +static GDBusSignalTable ci_signals[] = {
> +       { }
> +};
> +
> +int ofono_cell_info_driver_register(struct ofono_cell_info_driver *driver)
> +{
> +       DBG("driver: %p, name: %s", driver, driver->name);
> +
> +       if (driver->probe == NULL)
> +               return -EINVAL;
> +
> +       g_drivers = g_slist_prepend(g_drivers, (void *) driver);
> +
> +       return 0;
> +}
> +
> +void ofono_cell_info_driver_unregister(struct ofono_cell_info_driver *driver)
> +{
> +       DBG("driver: %p, name: %s", driver, driver->name);
> +
> +       g_drivers = g_slist_remove(g_drivers, (void *) driver);
> +}
> +
> +void ofono_cell_info_remove(struct ofono_cell_info *ci)
> +{
> +       __ofono_atom_free(ci->atom);
> +}
> +
> +static void cell_info_unregister(struct ofono_atom *atom)
> +{
> +       struct ofono_cell_info *ci = __ofono_atom_get_data(atom);
> +       const char *path = __ofono_atom_get_path(ci->atom);
> +       DBusConnection *conn = ofono_dbus_get_connection();
> +       struct ofono_modem *modem = __ofono_atom_get_modem(ci->atom);
> +
> +       ofono_modem_remove_interface(modem, OFONO_CELL_INFO_INTERFACE);
> +
> +       if (!g_dbus_unregister_interface(conn, path, 
> OFONO_CELL_INFO_INTERFACE))
> +               ofono_error("Failed to unregister interface %s",
> +                               OFONO_CELL_INFO_INTERFACE);
> +}
> +
> +static void cell_info_remove(struct ofono_atom *atom)
> +{
> +       struct ofono_cell_info *ci = __ofono_atom_get_data(atom);
> +       DBG("atom: %p", atom);
> +
> +       if (ci == NULL)
> +               return;
> +
> +       if (ci->driver && ci->driver->remove)
> +               ci->driver->remove(ci);
> +
> +       g_free(ci);
> +}
> +
> +void ofono_cell_info_register(struct ofono_cell_info *ci)
> +{
> +       DBusConnection *conn = ofono_dbus_get_connection();
> +       struct ofono_modem *modem = __ofono_atom_get_modem(ci->atom);
> +       const char *path = __ofono_atom_get_path(ci->atom);
> +
> +       DBG("Modem: %p", modem);
> +
> +       if (!g_dbus_register_interface(conn, path,
> +                                       OFONO_CELL_INFO_INTERFACE,
> +                                       ci_methods, ci_signals, NULL,
> +                                       ci, NULL)) {
> +               ofono_error("Could not create %s interface",
> +                                       OFONO_CELL_INFO_INTERFACE);

One too many tabs here.

> +
> +               return;
> +       }
> +
> +       ofono_modem_add_interface(modem, OFONO_CELL_INFO_INTERFACE);
> +
> +       __ofono_atom_register(ci->atom, cell_info_unregister);
> +}
> +
> +struct ofono_cell_info *ofono_cell_info_create(struct ofono_modem *modem,
> +                                       unsigned int vendor,
> +                                       const char *driver,
> +                                      

Re: [RFC PATCH 2/3] voicecall: add SSN handling functions

2011-03-03 Thread Denis Kenzior
Hi Andras,

On 03/03/2011 10:48 AM, Andras Domokos wrote:
> ---
>  include/types.h |2 +
>  include/voicecall.h |6 ++
>  src/voicecall.c |  156 
> +++
>  3 files changed, 164 insertions(+), 0 deletions(-)
> 

Please make sure to split this patch into several in accordance to our
patch submission guidelines.  See HACKING document, specifically the
'Submitting Patches' section.

> diff --git a/include/types.h b/include/types.h
> index d25f409..b639c8a 100644
> --- a/include/types.h
> +++ b/include/types.h
> @@ -96,6 +96,8 @@ struct ofono_call {
>   char name[OFONO_MAX_CALLER_NAME_LENGTH + 1];
>   int clip_validity;
>   int cnap_validity;
> + ofono_bool_t remote_held;
> + ofono_bool_t remote_multiparty;

I really don't like these being here.  Lets put them onto the struct
voicecall object in src/voicecall.c.  The logic for setting remote_held
and remote_multiparty is something that belongs in the core and should
not be exposed to the driver.

>  };
>  
>  struct ofono_network_time {
> diff --git a/include/voicecall.h b/include/voicecall.h
> index f00eb08..5e6da02 100644
> --- a/include/voicecall.h
> +++ b/include/voicecall.h
> @@ -160,6 +160,12 @@ void ofono_voicecall_set_data(struct ofono_voicecall 
> *vc, void *data);
>  void *ofono_voicecall_get_data(struct ofono_voicecall *vc);
>  int ofono_voicecall_get_next_callid(struct ofono_voicecall *vc);
>  
> +void ofono_voicecall_ssn_mo_notify(struct ofono_voicecall *vc, unsigned int 
> id,
> + int code, int index);
> +void ofono_voicecall_ssn_mt_notify(struct ofono_voicecall *vc, unsigned int 
> id,
> + int code, int index,
> + const struct ofono_phone_number *ph);
> +

Looks good, but as I mentioned this should be a separate patch.

>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/src/voicecall.c b/src/voicecall.c
> index ec001c0..e5936f5 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -400,6 +400,12 @@ static void append_voicecall_properties(struct voicecall 
> *v,
>  
>   ofono_dbus_dict_append(dict, "Multiparty", DBUS_TYPE_BOOLEAN, &mpty);
>  
> + ofono_dbus_dict_append(dict, "RemoteHeld", DBUS_TYPE_BOOLEAN,
> + &call->remote_held);
> +
> + ofono_dbus_dict_append(dict, "RemoteMultiparty", DBUS_TYPE_BOOLEAN,
> + &call->remote_multiparty);
> +
>   if (v->message)
>   ofono_dbus_dict_append(dict, "Information",
>   DBUS_TYPE_STRING, &v->message);
> @@ -1869,6 +1875,8 @@ static GDBusMethodTable manager_methods[] = {
>  };
>  
>  static GDBusSignalTable manager_signals[] = {
> + { "Forwarded",   "s" },
> + { "BarringActive",   "s" },
>   { "PropertyChanged","sv" },
>   { "CallAdded",  "oa{sv}" },
>   { "CallRemoved","o" },
> @@ -2684,3 +2692,151 @@ void __ofono_voicecall_tone_cancel(struct 
> ofono_voicecall *vc, int id)
>   tone_request_run(vc);
>   }
>  }
> +
> +static void ssn_mt_forwarded_notify(struct ofono_voicecall *vc,
> + unsigned int id, int code,
> + const struct ofono_phone_number *ph)
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = __ofono_atom_get_path(vc->atom);
> + char *info = "incoming";
> +
> + g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
> + "Forwarded",
> + DBUS_TYPE_STRING, &info,
> + DBUS_TYPE_INVALID);
> +}
> +
> +static struct voicecall *voicecall_select(struct ofono_voicecall *vc,
> + unsigned int id, int code)
> +{
> + struct voicecall *v = NULL;
> + GSList *l;
> +
> + for (l = vc->call_list; l; l = l->next) {
> + struct voicecall *v1 = l->data;
> +
> + if (id == 0 && g_slist_length(vc->call_list) == 1) {
> + if (code == SS_MT_VOICECALL_RETRIEVED &&
> + v1->call->remote_held == TRUE) {
> + v = v1;
> + break;
> + } else if (code == SS_MT_VOICECALL_ON_HOLD &&
> + v1->call->remote_held == FALSE) {
> + v = v1;
> + break;
> + } else if (code == SS_MT_MULTIPARTY_VOICECALL &&
> + v1->call->remote_multiparty == FALSE) {
> + v = v1;
> + break;
> + }
> + } else if (v1->call->id == id) {
> + v = v1;
> + break;
> + }
> + }
> +
> + 

Re: [PATCH v2] isimodem: removed unused NETWORK_TIMEOUT

2011-03-03 Thread Aki Niemi
Hi George,

2011/3/1 George Matveev :
> ---
>  drivers/isimodem/network.h |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)

Patch has been applied. Thanks.

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


Re: [RFC PATCH 1/3] ssn: remove SSN atom completely

2011-03-03 Thread Denis Kenzior
Hi Andras,

On 03/03/2011 10:48 AM, Andras Domokos wrote:
> ---
>  Makefile.am |6 +-
>  drivers/atmodem/atmodem.c   |2 -
>  drivers/atmodem/atmodem.h   |3 -
>  drivers/atmodem/ssn.c   |  147 -
>  drivers/isimodem/isimodem.c |2 -
>  drivers/isimodem/isimodem.h |3 -
>  drivers/isimodem/ssn.c  |   95 -
>  include/ssn.h   |   61 ---
>  plugins/calypso.c   |2 -
>  plugins/g1.c|2 -
>  plugins/huawei.c|2 -
>  plugins/ifx.c   |2 -
>  plugins/isiusb.c|2 -
>  plugins/linktop.c   |2 -
>  plugins/n900.c  |2 -
>  plugins/phonesim.c  |2 -
>  plugins/ste.c   |2 -
>  plugins/tc65.c  |2 -
>  plugins/u8500.c |2 -
>  plugins/wavecom.c   |2 -
>  src/ofono.h |   17 ---
>  src/ssn.c   |  247 
> ---
>  22 files changed, 2 insertions(+), 605 deletions(-)
>  delete mode 100644 drivers/atmodem/ssn.c
>  delete mode 100644 drivers/isimodem/ssn.c
>  delete mode 100644 include/ssn.h
>  delete mode 100644 src/ssn.c
> 

Patch looks good but no longer applies due to changes that Aki pushed
recently.

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


Re: [PATCH] ste: enable multiple oFono runs without restarting the oFono

2011-03-03 Thread Denis Kenzior
Hi Jussi,

On 03/03/2011 05:45 AM, Jussi Kangas wrote:
> ---
> Hi,
> 
> This enables SIM detection in workstation after disabling and enabling the 
> modem without rebooting the oFono.
> 
> Br,
> Jussi
> 
> 
>  plugins/ste.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [PATCH v2] ste: Add support for multiple AT channels

2011-03-03 Thread Denis Kenzior
Hi Lasse,

On 03/03/2011 05:21 AM, Lasse Kunnasluoto wrote:
> ---
> Hi,
> 
> Updated according to valuable comments from Denis.
> 
> BR,
> Lasse
> 
>  plugins/ste.c |  145 
> -
>  1 files changed, 92 insertions(+), 53 deletions(-)
> 

Patch has been applied, thanks.  I did have to amend it a bit to fix a
minor style violation.

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


Re: [PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Marcel Holtmann
Hi Lucas,

> >>  struct gps_data {
> >>   GAtChat *chat;
> >> - GAtChat *data_chat;
> >> +
> >> + struct {
> >> + GIOChannel *channel;
> >> + guint idle_source;
> >> + gsize written;
> >> + ofono_location_reporting_enable_cb_t cb;
> >> + void *cb_data;
> >> + } stream;
> >>  };
> >
> > why do you bother with the struct in struct here?
> 
> Just to group these related fields.

I let Denis decide to take this or not. My preference is to not do this
unless it has some clear benefit, but that is just me ;)

Regards

Marcel


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


Re: [PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Lucas De Marchi
On Thu, Mar 3, 2011 at 2:21 PM, Marcel Holtmann  wrote:
> Hi Lucas,
>
>>  struct gps_data {
>>       GAtChat *chat;
>> -     GAtChat *data_chat;
>> +
>> +     struct {
>> +             GIOChannel *channel;
>> +             guint idle_source;
>> +             gsize written;
>> +             ofono_location_reporting_enable_cb_t cb;
>> +             void *cb_data;
>> +     } stream;
>>  };
>
> why do you bother with the struct in struct here?

Just to group these related fields.


regards,
Lucas De Marchi
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Marcel Holtmann
Hi Lucas,

>  struct gps_data {
>   GAtChat *chat;
> - GAtChat *data_chat;
> +
> + struct {
> + GIOChannel *channel;
> + guint idle_source;
> + gsize written;
> + ofono_location_reporting_enable_cb_t cb;
> + void *cb_data;
> + } stream;
>  };

why do you bother with the struct in struct here?

Regards

Marcel


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


Re: [PATCH] isiusb: add message-waiting

2011-03-03 Thread Aki Niemi
Hi Jukka,

2011/3/3 Jukka Saunamaki :
> ---
>  plugins/isiusb.c |    5 +
>  1 files changed, 5 insertions(+), 0 deletions(-)

Pushed, thanks.

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


[PATCH] mbmmodem: don't let chat open after fd is sent

2011-03-03 Thread Lucas De Marchi
Instead of using a GAtChat, just use a GIOChannel and close it as soon
as its fd is sent to core.

Moreover, when oFono exits it's just a matter of checking if there's an
idle callback scheduled to control if we need to close the GIOChannel.
---

Hi Denis,

Following patch implements what the previous one were trying to accomplish, but
without the problem of closing the chat before the command was sent to tty. As
we talked on IRC, now I'm using the GIOChannel directly, without bothering with
creating the chat. Even if the command to send to this channel is very short, I
preferred to use async calls. Hence the use of an idle callback.


regards,
Lucas De Marchi


 drivers/mbmmodem/location-reporting.c |  105 +++--
 1 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/drivers/mbmmodem/location-reporting.c 
b/drivers/mbmmodem/location-reporting.c
index 941fac4..30571fe 100644
--- a/drivers/mbmmodem/location-reporting.c
+++ b/drivers/mbmmodem/location-reporting.c
@@ -48,7 +48,14 @@ static const char *e2gpsctl_prefix[] = { "*E2GPSCTL:", NULL 
};
 
 struct gps_data {
GAtChat *chat;
-   GAtChat *data_chat;
+
+   struct {
+   GIOChannel *channel;
+   guint idle_source;
+   gsize written;
+   ofono_location_reporting_enable_cb_t cb;
+   void *cb_data;
+   } stream;
 };
 
 static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult *result,
@@ -57,7 +64,6 @@ static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult 
*result,
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);
 
@@ -70,8 +76,6 @@ static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult 
*result,
return;
}
 
-   g_at_chat_unref(gd->data_chat);
-
CALLBACK_WITH_SUCCESS(cb, cbd->data);
 }
 
@@ -94,69 +98,81 @@ static void mbm_location_reporting_disable(struct 
ofono_location_reporting *lr,
g_free(cbd);
 }
 
-static int mbm_create_data_chat(struct ofono_location_reporting *lr)
+static gboolean enable_data_stream(gpointer data)
 {
-   struct gps_data *gd = ofono_location_reporting_get_data(lr);
-   struct ofono_modem *modem;
-   const char *gps_dev;
-   GAtSyntax *syntax;
-   GIOChannel *channel;
+   static const char *buf = "AT*E2GPSNPD\r\n";
+   gsize len = strlen(buf);
+   struct gps_data *gd = data;
+   GIOStatus status;
+   gsize written;
int fd;
 
-   modem = ofono_location_reporting_get_modem(lr);
-   gps_dev = ofono_modem_get_string(modem, "GPSDevice");
+   status = g_io_channel_write_chars(gd->stream.channel,
+   buf + gd->stream.written,
+   len - gd->stream.written,
+   &written, NULL);
+   if (status == G_IO_STATUS_AGAIN)
+   return TRUE;
 
-   channel = g_at_tty_open(gps_dev, NULL);
-   if (channel == NULL)
-   return -1;
+   if (status != G_IO_STATUS_NORMAL) {
+   CALLBACK_WITH_FAILURE(gd->stream.cb, -1, gd->stream.cb_data);
 
-   syntax = g_at_syntax_new_gsm_permissive();
-   gd->data_chat = g_at_chat_new(channel, syntax);
-   fd = g_io_channel_unix_get_fd(channel);
+   return FALSE;
+   }
+
+   gd->stream.written += written;
 
-   g_at_syntax_unref(syntax);
-   g_io_channel_unref(channel);
+   if (gd->stream.written != len)
+   return TRUE;
 
-   if (gd->data_chat == NULL)
-   return -1;
+   fd = g_io_channel_unix_get_fd(gd->stream.channel);
+   CALLBACK_WITH_SUCCESS(gd->stream.cb, fd, gd->stream.cb_data);
 
-   return fd;
+   return FALSE;
+}
+
+static void destroy_data_stream(gpointer data)
+{
+   struct gps_data *gd = data;
+
+   g_io_channel_unref(gd->stream.channel);
+   gd->stream.idle_source = 0;
+   gd->stream.written = 0;
 }
 
 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 ofono_location_reporting *lr = user_data;
struct gps_data *gd = ofono_location_reporting_get_data(lr);
+   struct ofono_modem *modem;
+   const char *gps_dev;
struct ofono_error error;
-   int fd;
 
DBG("lr=%p ok=%d", lr, ok);
 
decode_at_error(&error, g_at_result_final_response(result));
 
if (!ok) {
-   cb(&error, -1, cbd->data);
+   gd->stream.cb(&error, -1, gd->stream.cb_data);
 
return;
}
 
-   

Re: [PATCH] gisi: Consumer functions for ISI message iterator

2011-03-03 Thread Aki Niemi
Hi Antti,

2011/3/3 Antti Paila :


>  struct _GIsiSubBlockIter {
> +       uint8_t cursor;
>        uint8_t *start;
>        uint8_t *end;
>        gboolean longhdr;

The cursor actually needs to be 16 bits, because when the long header
format is in use, that is what subblock length uses.

I pushed this patch, and fixed the issue afterwards.

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


[RFC PATCH 3/3] atmodem: add SSN handling

2011-03-03 Thread Andras Domokos
---
 drivers/atmodem/voicecall.c |   61 +++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index ee055da..7d70c85 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -967,6 +967,63 @@ static void busy_notify(GAtResult *result, gpointer 
user_data)
clcc_poll_cb, vc, NULL);
 }
 
+static void cssi_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_voicecall *vc = user_data;
+   GAtResultIter iter;
+   int code, index;
+
+   g_at_result_iter_init(&iter, result);
+
+   if (!g_at_result_iter_next(&iter, "+CSSI:"))
+   return;
+
+   if (!g_at_result_iter_next_number(&iter, &code))
+   return;
+
+   if (!g_at_result_iter_next_number(&iter, &index))
+   index = 0;
+
+   ofono_voicecall_ssn_mo_notify(vc, 0, code, index);
+}
+
+static void cssu_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_voicecall *vc = user_data;
+   GAtResultIter iter;
+   int code;
+   int index = -1;
+   const char *num;
+   struct ofono_phone_number ph;
+
+   ph.number[0] = '\0';
+   ph.type = 129;
+
+   g_at_result_iter_init(&iter, result);
+
+   if (!g_at_result_iter_next(&iter, "+CSSU:"))
+   return;
+
+   if (!g_at_result_iter_next_number(&iter, &code))
+   return;
+
+   /* This field is optional, if we can't read it, try to skip it */
+   if (!g_at_result_iter_next_number(&iter, &index) &&
+   !g_at_result_iter_skip_next(&iter))
+   goto out;
+
+   if (!g_at_result_iter_next_string(&iter, &num))
+   goto out;
+
+   strncpy(ph.number, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
+
+   if (!g_at_result_iter_next_number(&iter, &ph.type))
+   return;
+
+out:
+   ofono_voicecall_ssn_mt_notify(vc, 0, code, index, &ph);
+}
+
 static void vtd_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct ofono_voicecall *vc = user_data;
@@ -1015,6 +1072,9 @@ static void at_voicecall_initialized(gboolean ok, 
GAtResult *result,
 
/* Populate the call list */
g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix, clcc_cb, vc, NULL);
+
+   g_at_chat_register(vd->chat, "+CSSI:", cssi_notify, FALSE, vc, NULL);
+   g_at_chat_register(vd->chat, "+CSSU:", cssu_notify, FALSE, vc, NULL);
 }
 
 static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
@@ -1038,6 +1098,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, 
unsigned int vendor,
g_at_chat_send(vd->chat, "AT+CDIP=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+CNAP=1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+COLP=1", NULL, NULL, NULL, NULL);
+   g_at_chat_send(vd->chat, "AT+CSSN=1,1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT+VTD?", NULL,
vtd_query_cb, vc, NULL);
g_at_chat_send(vd->chat, "AT+CCWA=1", NULL,
-- 
1.7.0.4

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


[RFC PATCH 2/3] voicecall: add SSN handling functions

2011-03-03 Thread Andras Domokos
---
 include/types.h |2 +
 include/voicecall.h |6 ++
 src/voicecall.c |  156 +++
 3 files changed, 164 insertions(+), 0 deletions(-)

diff --git a/include/types.h b/include/types.h
index d25f409..b639c8a 100644
--- a/include/types.h
+++ b/include/types.h
@@ -96,6 +96,8 @@ struct ofono_call {
char name[OFONO_MAX_CALLER_NAME_LENGTH + 1];
int clip_validity;
int cnap_validity;
+   ofono_bool_t remote_held;
+   ofono_bool_t remote_multiparty;
 };
 
 struct ofono_network_time {
diff --git a/include/voicecall.h b/include/voicecall.h
index f00eb08..5e6da02 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -160,6 +160,12 @@ void ofono_voicecall_set_data(struct ofono_voicecall *vc, 
void *data);
 void *ofono_voicecall_get_data(struct ofono_voicecall *vc);
 int ofono_voicecall_get_next_callid(struct ofono_voicecall *vc);
 
+void ofono_voicecall_ssn_mo_notify(struct ofono_voicecall *vc, unsigned int id,
+   int code, int index);
+void ofono_voicecall_ssn_mt_notify(struct ofono_voicecall *vc, unsigned int id,
+   int code, int index,
+   const struct ofono_phone_number *ph);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/voicecall.c b/src/voicecall.c
index ec001c0..e5936f5 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -400,6 +400,12 @@ static void append_voicecall_properties(struct voicecall 
*v,
 
ofono_dbus_dict_append(dict, "Multiparty", DBUS_TYPE_BOOLEAN, &mpty);
 
+   ofono_dbus_dict_append(dict, "RemoteHeld", DBUS_TYPE_BOOLEAN,
+   &call->remote_held);
+
+   ofono_dbus_dict_append(dict, "RemoteMultiparty", DBUS_TYPE_BOOLEAN,
+   &call->remote_multiparty);
+
if (v->message)
ofono_dbus_dict_append(dict, "Information",
DBUS_TYPE_STRING, &v->message);
@@ -1869,6 +1875,8 @@ static GDBusMethodTable manager_methods[] = {
 };
 
 static GDBusSignalTable manager_signals[] = {
+   { "Forwarded",   "s" },
+   { "BarringActive",   "s" },
{ "PropertyChanged","sv" },
{ "CallAdded",  "oa{sv}" },
{ "CallRemoved","o" },
@@ -2684,3 +2692,151 @@ void __ofono_voicecall_tone_cancel(struct 
ofono_voicecall *vc, int id)
tone_request_run(vc);
}
 }
+
+static void ssn_mt_forwarded_notify(struct ofono_voicecall *vc,
+   unsigned int id, int code,
+   const struct ofono_phone_number *ph)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(vc->atom);
+   char *info = "incoming";
+
+   g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
+   "Forwarded",
+   DBUS_TYPE_STRING, &info,
+   DBUS_TYPE_INVALID);
+}
+
+static struct voicecall *voicecall_select(struct ofono_voicecall *vc,
+   unsigned int id, int code)
+{
+   struct voicecall *v = NULL;
+   GSList *l;
+
+   for (l = vc->call_list; l; l = l->next) {
+   struct voicecall *v1 = l->data;
+
+   if (id == 0 && g_slist_length(vc->call_list) == 1) {
+   if (code == SS_MT_VOICECALL_RETRIEVED &&
+   v1->call->remote_held == TRUE) {
+   v = v1;
+   break;
+   } else if (code == SS_MT_VOICECALL_ON_HOLD &&
+   v1->call->remote_held == FALSE) {
+   v = v1;
+   break;
+   } else if (code == SS_MT_MULTIPARTY_VOICECALL &&
+   v1->call->remote_multiparty == FALSE) {
+   v = v1;
+   break;
+   }
+   } else if (v1->call->id == id) {
+   v = v1;
+   break;
+   }
+   }
+
+   return v;
+}
+
+static void ssn_mt_remote_held_notify(struct ofono_voicecall *vc,
+   unsigned int id, int code,
+   const struct ofono_phone_number *ph)
+{
+   struct voicecall *v = voicecall_select(vc, id, code);
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path;
+
+   if (v == NULL)
+   return;
+
+   if (code == SS_MT_VOICECALL_ON_HOLD)
+   v->call->remote_held = TRUE;
+   else
+   v->call->remote_held = FALSE;
+
+   path = voicecall_build_path(vc, v->call);
+
+   ofono_dbus_signal_proper

[RFC PATCH 1/3] ssn: remove SSN atom completely

2011-03-03 Thread Andras Domokos
---
 Makefile.am |6 +-
 drivers/atmodem/atmodem.c   |2 -
 drivers/atmodem/atmodem.h   |3 -
 drivers/atmodem/ssn.c   |  147 -
 drivers/isimodem/isimodem.c |2 -
 drivers/isimodem/isimodem.h |3 -
 drivers/isimodem/ssn.c  |   95 -
 include/ssn.h   |   61 ---
 plugins/calypso.c   |2 -
 plugins/g1.c|2 -
 plugins/huawei.c|2 -
 plugins/ifx.c   |2 -
 plugins/isiusb.c|2 -
 plugins/linktop.c   |2 -
 plugins/n900.c  |2 -
 plugins/phonesim.c  |2 -
 plugins/ste.c   |2 -
 plugins/tc65.c  |2 -
 plugins/u8500.c |2 -
 plugins/wavecom.c   |2 -
 src/ofono.h |   17 ---
 src/ssn.c   |  247 ---
 22 files changed, 2 insertions(+), 605 deletions(-)
 delete mode 100644 drivers/atmodem/ssn.c
 delete mode 100644 drivers/isimodem/ssn.c
 delete mode 100644 include/ssn.h
 delete mode 100644 src/ssn.c

diff --git a/Makefile.am b/Makefile.am
index 3f20717..b607b0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/dbus.h include/modem.h include/types.h \
include/call-barring.h include/call-forwarding.h \
include/call-meter.h include/call-settings.h \
-   include/phonebook.h include/ssn.h include/ussd.h \
+   include/phonebook.h include/ussd.h \
include/sms.h include/sim.h include/message-waiting.h \
include/netreg.h include/voicecall.h include/devinfo.h \
include/cbs.h include/call-volume.h \
@@ -126,7 +126,6 @@ builtin_sources += $(gisi_sources) \
drivers/isimodem/cbs.c \
drivers/isimodem/sim.c \
drivers/isimodem/sim.h \
-   drivers/isimodem/ssn.c \
drivers/isimodem/ussd.c \
drivers/isimodem/call-forwarding.c \
drivers/isimodem/call-settings.c \
@@ -172,7 +171,6 @@ builtin_sources += $(gatchat_sources) \
drivers/atmodem/voicecall.c \
drivers/atmodem/call-barring.c \
drivers/atmodem/phonebook.c \
-   drivers/atmodem/ssn.c \
drivers/atmodem/devinfo.c \
drivers/atmodem/call-volume.c \
drivers/atmodem/vendor.h \
@@ -372,7 +370,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/network.c src/voicecall.c src/ussd.c src/sms.c \
src/call-settings.c src/call-forwarding.c \
src/call-meter.c src/smsutil.h src/smsutil.c \
-   src/ssn.c src/call-barring.c src/sim.c src/stk.c \
+   src/call-barring.c src/sim.c src/stk.c \
src/phonebook.c src/history.c src/message-waiting.c \
src/simutil.h src/simutil.c src/storage.h \
src/storage.c src/cbs.c src/watch.c src/call-volume.c \
diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c
index e140281..ce6c10a 100644
--- a/drivers/atmodem/atmodem.c
+++ b/drivers/atmodem/atmodem.c
@@ -41,7 +41,6 @@ static int atmodem_init(void)
at_call_meter_init();
at_call_settings_init();
at_phonebook_init();
-   at_ssn_init();
at_ussd_init();
at_sms_init();
at_sim_init();
@@ -63,7 +62,6 @@ static void atmodem_exit(void)
at_sim_exit();
at_sms_exit();
at_ussd_exit();
-   at_ssn_exit();
at_phonebook_exit();
at_call_settings_exit();
at_call_meter_exit();
diff --git a/drivers/atmodem/atmodem.h b/drivers/atmodem/atmodem.h
index 1b7cf67..a6720d1 100644
--- a/drivers/atmodem/atmodem.h
+++ b/drivers/atmodem/atmodem.h
@@ -54,9 +54,6 @@ extern void at_sms_exit(void);
 extern void at_phonebook_init(void);
 extern void at_phonebook_exit(void);
 
-extern void at_ssn_init(void);
-extern void at_ssn_exit(void);
-
 extern void at_devinfo_init(void);
 extern void at_devinfo_exit(void);
 
diff --git a/drivers/atmodem/ssn.c b/drivers/atmodem/ssn.c
deleted file mode 100644
index b7a9df4..000
--- a/drivers/atmodem/ssn.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- *
- *  oFono - Open Source Telephony
- *
- *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of t

[PATCH 0/3] Voice call SS notifications (3rd version)

2011-03-03 Thread Andras Domokos
Implementation proposal for handling some of the voice call
related Supplementary Services (SS) notifications.

Implementation details:
- removed SSN atom
- (re)implemented voice call SS notification handling framework
- added voice call SS notification handling to AT modem driver
  (+CSSU and +CSSI notifications) 

Andras Domokos (3):
  ssn: remove SSN atom completely
  voicecall: add SSN handling functions
  atmodem: add SSN handling

 Makefile.am |6 +-
 drivers/atmodem/atmodem.c   |2 -
 drivers/atmodem/atmodem.h   |3 -
 drivers/atmodem/ssn.c   |  147 -
 drivers/atmodem/voicecall.c |   61 +++
 drivers/isimodem/isimodem.c |2 -
 drivers/isimodem/isimodem.h |3 -
 drivers/isimodem/ssn.c  |   95 -
 include/ssn.h   |   61 ---
 include/types.h |2 +
 include/voicecall.h |6 +
 plugins/calypso.c   |2 -
 plugins/g1.c|2 -
 plugins/huawei.c|2 -
 plugins/ifx.c   |2 -
 plugins/isiusb.c|2 -
 plugins/linktop.c   |2 -
 plugins/n900.c  |2 -
 plugins/phonesim.c  |2 -
 plugins/ste.c   |2 -
 plugins/tc65.c  |2 -
 plugins/u8500.c |2 -
 plugins/wavecom.c   |2 -
 src/ofono.h |   17 ---
 src/ssn.c   |  247 ---
 src/voicecall.c |  156 +++
 26 files changed, 227 insertions(+), 605 deletions(-)
 delete mode 100644 drivers/atmodem/ssn.c
 delete mode 100644 drivers/isimodem/ssn.c
 delete mode 100644 include/ssn.h
 delete mode 100644 src/ssn.c

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


Re: [PATCH v2 13/18] isimodem: wgmodem2.5 added to call-forwarding

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  drivers/isimodem/call-forwarding.c |   29 +
>  1 files changed, 25 insertions(+), 4 deletions(-)

Patch has been applied. Some refactoring after the fact, though.

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


Re: [PATCH v2 14/18] isimodem: wgmodem2.5 added to ssn

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  drivers/isimodem/call-forwarding.c |    1 -
>  drivers/isimodem/ssn.c             |  406 
> +++-
>  2 files changed, 401 insertions(+), 6 deletions(-)

I applied this patch, but had to do some heavy refactoring afterwards.

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


Re: [PATCH v2 12/18] isimodem: SS_GSM_BARRING_INFO added

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> SS_GSM_BSC_INFO added.
> ---
>  drivers/isimodem/call-barring.c |   99 ++
>  1 files changed, 88 insertions(+), 11 deletions(-)

Patch was applied, with some refactoring done afterwards.

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


Re: [PATCH v2 10/18] isimodem: wgmodem2.5 added to voicecall

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  drivers/isimodem/call.h      |   82 -
>  drivers/isimodem/voicecall.c |  218 
> +-
>  2 files changed, 253 insertions(+), 47 deletions(-)

Patch was applied with some refactoring done afterwards. Thanks.

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


Re: [PATCH v2 11/18] isimodem: wgmodem2.5 support in USSD

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  drivers/isimodem/ussd.c |   36 ++--
>  1 files changed, 30 insertions(+), 6 deletions(-)

Patch has been pushed, with some refactoring done afterwards. The N900
modem handles padding fine, so might as well use it always.

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


Re: [PATCH v2 09/18] isimodem: clip colp clir colr wgmodem2.5

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  drivers/isimodem/call-settings.c |  711 
> +-
>  drivers/isimodem/call.h          |    9 +
>  drivers/isimodem/debug.c         |    4 +
>  drivers/isimodem/ss.h            |   22 ++
>  4 files changed, 728 insertions(+), 18 deletions(-)

I pushed CLIP, COLP and COLR query support based on this patch, plus
refactored the call waiting code some.

The CLIR query and set functionality included was sufficiently
convoluted that I had to leave it out for the time being.

Frankly, I am not sure that even oFono core is working properly here,
if the CLIR status can only be modified locally. That said, my
supplementary-service-foo is admittedly lacking, so if someone can
make sense of CLIR here, I would appreciate comments and/or patches.

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


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

2011-03-03 Thread Arun Ravindran

Hi Sjur,

I have a doubt on this interface

+   void Register(array{string} types)
+
+   Registers an IMS Application. It must register
+   with at least one of the types: "voice" or "messaging".
+   In future "video" (Conversational Video, Live
+   Streaming) should be added. This registration will
+   inform the modem's radio stack that the IMS application
+   has registered for Voice and/or Messaging over IMS.
+   This registration may impact "UE Mode of operation"
+   and the ISR feature in the radio stack.
+
+   The registered application is tracked, if the
+   application exits the registration will be
+   automatically released.
+
+   Possible Errors: [service].Error.InvalidArguments
27.007 describes +CEMODE which sets the UE mode of operation and is 
referring to 24.301.


There are only 4 modes PS Mode 1, PS Mode 2, PS/CS Mode 1, PS/CS Mode 
2.  These modes only specify, what type of attach is required (a IMSI, 
EPS or a combined). Also if UE supports CSFB, it should be in CS/PS 
modes . There is also +VCMOD which can be used to decide whether to use 
CS or PS for voice calls.


What does the Register interface do w.r.t ofono? What AT commands could 
be used here to signal the UE mode of operation to modem?


How does "voice" or "messaging" relate to the 4 modes specified in 
27.007 and 24.301?


Regards
Arun

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


[PATCH] ste: enable multiple oFono runs without restarting the oFono

2011-03-03 Thread Jussi Kangas
---
Hi,

This enables SIM detection in workstation after disabling and enabling the 
modem without rebooting the oFono.

Br,
Jussi


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

diff --git a/plugins/ste.c b/plugins/ste.c
index b786571..d2a6cc1 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -184,6 +184,7 @@ static gboolean init_sim_reporting(gpointer user_data)
 {
struct ofono_modem *modem = user_data;
struct ste_data *data = ofono_modem_get_data(modem);
+   data->have_sim = FALSE;
 
g_at_chat_send(data->chat, "AT*ESIMSR=1;*ESIMSR?", NULL,
handle_sim_state,
-- 
1.7.1

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


[PATCH v2] ste: Add support for multiple AT channels

2011-03-03 Thread Lasse Kunnasluoto
---
Hi,

Updated according to valuable comments from Denis.

BR,
Lasse

 plugins/ste.c |  145 -
 1 files changed, 92 insertions(+), 53 deletions(-)

diff --git a/plugins/ste.c b/plugins/ste.c
index b786571..488a3e2 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -65,13 +65,20 @@
 #include 
 #include 
 
-#define NUM_CHAT   1
+#define NUM_CHAT   5
+#define AT_DEFAULT 0
+#define AT_NET 1
+#define AT_VOICE   2
+#define AT_GPRS3
+#define AT_SIM 4
+
 #define MAX_PDP_CONTEXTS   4
 
-static char *chat_prefixes[NUM_CHAT] = { "Default: " };
+static char *chat_prefixes[NUM_CHAT] = { "Default: ", "Net: ", "Voice: ",
+   "GPRS: ", "SIM: " };
 
 struct ste_data {
-   GAtChat *chat;
+   GAtChat *chat[NUM_CHAT];
gboolean have_sim;
struct ofono_sim *sim;
 };
@@ -105,12 +112,14 @@ static int ste_probe(struct ofono_modem *modem)
 static void ste_remove(struct ofono_modem *modem)
 {
struct ste_data *data = ofono_modem_get_data(modem);
+   int i;
 
DBG("%p", modem);
 
ofono_modem_set_data(modem, NULL);
 
-   g_at_chat_unref(data->chat);
+   for (i = 0; i < NUM_CHAT; i++)
+   g_at_chat_unref(data->chat[i]);
 
g_free(data);
 }
@@ -185,7 +194,7 @@ static gboolean init_sim_reporting(gpointer user_data)
struct ofono_modem *modem = user_data;
struct ste_data *data = ofono_modem_get_data(modem);
 
-   g_at_chat_send(data->chat, "AT*ESIMSR=1;*ESIMSR?", NULL,
+   g_at_chat_send(data->chat[AT_SIM], "AT*ESIMSR=1;*ESIMSR?", NULL,
handle_sim_state,
modem, NULL);
 
@@ -195,11 +204,21 @@ static gboolean init_sim_reporting(gpointer user_data)
 static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct ofono_modem *modem = user_data;
+   struct ste_data *data = ofono_modem_get_data(modem);
+   int i;
 
DBG("");
 
if (!ok) {
ofono_modem_set_powered(modem, FALSE);
+
+   for (i = 0; i < NUM_CHAT; i++) {
+   g_at_chat_cancel_all(data->chat[i]);
+   g_at_chat_unregister_all(data->chat[i]);
+   g_at_chat_unref(data->chat[i]);
+   data->chat[i] = NULL;
+   }
+
return;
}
 
@@ -297,47 +316,64 @@ static int ste_enable(struct ofono_modem *modem)
struct ste_data *data = ofono_modem_get_data(modem);
GIOChannel *channel;
GAtSyntax *syntax;
+   int i;
 
-   syntax = g_at_syntax_new_gsm_permissive();
-
-   channel = ste_create_channel(modem);
-   if (!channel)
-   return -EIO;
-
-   data->chat = g_at_chat_new_blocking(channel, syntax);
-   g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
-   NULL, NULL, NULL, NULL);
+   for (i = 0; i < NUM_CHAT; i++) {
+   channel = ste_create_channel(modem);
+   syntax = g_at_syntax_new_gsm_permissive();
+   data->chat[i] = g_at_chat_new_blocking(channel, syntax);
+   if (data->chat[i] == NULL) {
+   g_io_channel_unref(channel);
+   g_at_syntax_unref(syntax);
+   DBG("Failed to create AT chat %s", chat_prefixes[i]);
+   goto error;
+   }
 
-   /* All STE modems support UTF-8 */
-   g_at_chat_send(data->chat, "AT+CSCS=\"UTF-8\"",
-   NULL, NULL, NULL, NULL);
+   if (getenv("OFONO_AT_DEBUG"))
+   g_at_chat_set_debug(data->chat[i], ste_debug,
+   chat_prefixes[i]);
 
-   g_io_channel_unref(channel);
-   g_at_syntax_unref(syntax);
+   g_at_chat_send(data->chat[i], "AT&F E0 V1 X4 &C1 +CMEE=1",
+   NULL, NULL, NULL, NULL);
 
-   if (data->chat == NULL)
-   return -ENOMEM;
+   /* All STE modems support UTF-8 */
+   g_at_chat_send(data->chat[i], "AT+CSCS=\"UTF-8\"",
+   NULL, NULL, NULL, NULL);
 
-   if (getenv("OFONO_AT_DEBUG"))
-   g_at_chat_set_debug(data->chat, ste_debug, chat_prefixes[0]);
+   g_io_channel_unref(channel);
+   g_at_syntax_unref(syntax);
+   }
 
-   g_at_chat_send(data->chat, "AT+CFUN=4", NULL, cfun_enable, modem, NULL);
+   g_at_chat_send(data->chat[AT_DEFAULT], "AT+CFUN=4", NULL, cfun_enable,
+   modem, NULL);
 
-   g_at_chat_register(data->chat, "*ESIMSR:", esimsr_notify,
+   g_at_chat_register(data->chat[AT_SIM], "*ESIMSR:", esimsr_notify,
FALSE, modem, NULL);
 
return -EINPROGRESS;
+
+error:
+   /* Unref open chats if any */
+   while (i--) {
+ 

[PATCH] isiusb: add message-waiting

2011-03-03 Thread Jukka Saunamaki
---
 plugins/isiusb.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/plugins/isiusb.c b/plugins/isiusb.c
index c036604..cf31756 100644
--- a/plugins/isiusb.c
+++ b/plugins/isiusb.c
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "drivers/isimodem/isimodem.h"
 #include "drivers/isimodem/isiutil.h"
@@ -421,6 +422,7 @@ static void isiusb_post_sim(struct ofono_modem *modem)
 static void isiusb_post_online(struct ofono_modem *modem)
 {
struct isi_data *isi = ofono_modem_get_data(modem);
+   struct ofono_message_waiting *mw;
 
DBG("(%p) with %s", modem, isi->ifname);
 
@@ -434,6 +436,9 @@ static void isiusb_post_online(struct ofono_modem *modem)
ofono_call_barring_create(modem, 0, "isimodem", isi->modem);
ofono_call_meter_create(modem, 0, "isimodem", isi->modem);
ofono_gprs_create(modem, 0, "isimodem", isi->modem);
+   mw = ofono_message_waiting_create(modem);
+   if (mw)
+   ofono_message_waiting_register(mw);
 }
 
 static int isiusb_enable(struct ofono_modem *modem)
-- 
1.7.1

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