[PATCH 1/4] n900: Use consistent naming in GPIO API

2012-05-14 Thread Aki Niemi
In addition, add header guards as the API can be used from more than
one plugin.
---
 plugins/n900.c   |   12 +++---
 plugins/nokia-gpio.c |  106 ++
 plugins/nokia-gpio.h |   37 +++--
 3 files changed, 85 insertions(+), 70 deletions(-)

diff --git a/plugins/n900.c b/plugins/n900.c
index 44e2e75..420fd0c 100644
--- a/plugins/n900.c
+++ b/plugins/n900.c
@@ -308,7 +308,7 @@ static void n900_power_cb(enum power_state state, void 
*data)
struct ofono_modem *modem = data;
struct isi_data *isi = ofono_modem_get_data(modem);
 
-   DBG(power state %s, gpio_power_state_name(state));
+   DBG(power state %s, nokia_gpio_power_state_name(state));
 
isi-power_state = state;
 
@@ -358,7 +358,7 @@ static int n900_probe(struct ofono_modem *modem)
if (getenv(OFONO_ISI_TRACE))
g_isi_modem_set_trace(isimodem, isi_trace);
 
-   if (gpio_probe(isimodem, address, n900_power_cb, modem) != 0) {
+   if (nokia_gpio_probe(isimodem, address, n900_power_cb, modem) != 0) {
DBG(gpio for %s: %s, ifname, strerror(errno));
goto error;
}
@@ -382,7 +382,7 @@ static int n900_probe(struct ofono_modem *modem)
 
 error:
g_isi_modem_destroy(isimodem);
-   gpio_remove(modem);
+   nokia_gpio_remove(modem);
g_free(isi);
 
return -errno;
@@ -397,7 +397,7 @@ static void n900_remove(struct ofono_modem *modem)
if (!isi)
return;
 
-   gpio_remove(modem);
+   nokia_gpio_remove(modem);
 
if (isi-timeout)
g_source_remove(isi-timeout);
@@ -523,7 +523,7 @@ static int n900_enable(struct ofono_modem *modem)
 
isi-enabled = TRUE;
 
-   return gpio_enable(modem);
+   return nokia_gpio_enable(modem);
 }
 
 static int n900_disable(struct ofono_modem *modem)
@@ -534,7 +534,7 @@ static int n900_disable(struct ofono_modem *modem)
 
isi-enabled = FALSE;
 
-   return gpio_disable(modem);
+   return nokia_gpio_disable(modem);
 }
 
 static struct ofono_modem_driver n900_driver = {
diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c
index 57aad8d..d9e05f3 100644
--- a/plugins/nokia-gpio.c
+++ b/plugins/nokia-gpio.c
@@ -60,18 +60,6 @@ enum phonet_link {
PHONET_LINK_UP,
 };
 
-enum power_event {
-   POWER_EVENT_PHONET_LINK_UP = 1,
-   POWER_EVENT_PHONET_LINK_DOWN,
-   POWER_EVENT_ON,
-   POWER_EVENT_ON_TIMEOUT,
-   POWER_EVENT_REBOOT_TIMEOUT,
-   POWER_EVENT_OFF,
-   POWER_EVENT_OFF_IMMEDIATELY,
-   POWER_EVENT_OFF_TIMEOUT,
-   POWER_EVENT_OFF_COMPLETE,
-};
-
 struct gpio_data {
GIsiPhonetNetlink *link;
gpio_finished_cb_t callback;
@@ -98,41 +86,6 @@ struct gpio_data {
 
 static struct gpio_data self;
 
-#define _(X) case X: return #X
-
-static inline char const *gpio_power_event_name(enum power_event value)
-{
-   switch (value) {
-   _(POWER_EVENT_PHONET_LINK_UP);
-   _(POWER_EVENT_PHONET_LINK_DOWN);
-   _(POWER_EVENT_ON);
-   _(POWER_EVENT_ON_TIMEOUT);
-   _(POWER_EVENT_REBOOT_TIMEOUT);
-   _(POWER_EVENT_OFF);
-   _(POWER_EVENT_OFF_IMMEDIATELY);
-   _(POWER_EVENT_OFF_TIMEOUT);
-   _(POWER_EVENT_OFF_COMPLETE);
-   }
-   return UNKNOWN;
-}
-
-char const *gpio_power_state_name(enum power_state value)
-{
-   switch (value) {
-   _(POWER_STATE_NONE);
-   _(POWER_STATE_ON_STARTED);
-   _(POWER_STATE_ON);
-   _(POWER_STATE_ON_RESET);
-   _(POWER_STATE_ON_FAILED);
-   _(POWER_STATE_OFF_STARTED);
-   _(POWER_STATE_OFF_WAITING);
-   _(POWER_STATE_OFF);
-   }
-   return UNKNOWN;
-}
-
-#undef _
-
 static void gpio_power_state_machine(enum power_event event);
 static void gpio_power_set_state(enum power_state new_state);
 
@@ -324,14 +277,13 @@ static gboolean gpio_power_timer_cb(gpointer user)
return FALSE;
 }
 
-
 static void gpio_power_state_machine(enum power_event event)
 {
enum power_state new_state;
 
DBG((%s) @ state %s,
-   gpio_power_event_name(event),
-   gpio_power_state_name(self.state));
+   nokia_gpio_power_event_name(event),
+   nokia_gpio_power_state_name(self.state));
 
switch (event) {
case POWER_EVENT_ON:
@@ -491,10 +443,10 @@ static void gpio_power_state_machine(enum power_event 
event)
return;
}
 
-   DBG(Event %s (%d) not handled, gpio_power_event_name(event), event);
+   DBG(Event %s (%d) not handled, nokia_gpio_power_event_name(event),
+   event);
 }
 
-
 static void gpio_power_set_state(enum power_state new_state)
 {
enum power_state old_state = self.state;
@@ -502,8 +454,8 @@ static void gpio_power_set_state(enum power_state new_state)
enum 

[PATCH 4/4] udev: Add bootstrapping for n950 plugin

2012-05-14 Thread Aki Niemi
---
 plugins/udev.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 8cb87a5..fe18450 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -278,6 +278,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, n900) == 0)
add_isi(modem, udev_device);
+   else if (g_strcmp0(driver, n950) == 0)
+   add_isi(modem, udev_device);
else if (g_strcmp0(driver, calypso) == 0)
add_calypso(modem, udev_device);
else if (g_strcmp0(driver, tc65) == 0)
-- 
1.7.5.4

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


[PATCH 2/4] n950: Add new plugin for Nokia N950

2012-05-14 Thread Aki Niemi
---
 plugins/n950.c |  563 
 1 files changed, 563 insertions(+), 0 deletions(-)
 create mode 100644 plugins/n950.c

diff --git a/plugins/n950.c b/plugins/n950.c
new file mode 100644
index 000..6c9a9da
--- /dev/null
+++ b/plugins/n950.c
@@ -0,0 +1,563 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2011  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 config.h
+#endif
+
+#include stdio.h
+#include errno.h
+#include stdlib.h
+#include string.h
+#include glib.h
+
+#include gisi/modem.h
+#include gisi/netlink.h
+#include gisi/client.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/devinfo.h
+#include ofono/phonebook.h
+#include ofono/netreg.h
+#include ofono/voicecall.h
+#include ofono/sms.h
+#include ofono/cbs.h
+#include ofono/sim.h
+#include ofono/ussd.h
+#include ofono/call-forwarding.h
+#include ofono/call-settings.h
+#include ofono/call-barring.h
+#include ofono/call-meter.h
+#include ofono/radio-settings.h
+#include ofono/gprs.h
+#include ofono/gprs-context.h
+#include ofono/audio-settings.h
+
+#include drivers/isimodem/isimodem.h
+#include drivers/isimodem/isiutil.h
+#include drivers/isimodem/infoserver.h
+#include drivers/isimodem/mtc.h
+#include drivers/isimodem/debug.h
+
+#include nokia-gpio.h
+
+struct isi_data {
+   const char *ifname;
+   GIsiModem *modem;
+   GIsiClient *client;
+   struct isi_infoserver *infoserver;
+   ofono_bool_t enabled;
+   ofono_bool_t online;
+   ofono_bool_t reported;
+   enum power_state power_state;
+   int mtc_state;
+   guint timeout;
+   struct isi_cb_data *online_cbd;
+};
+
+static void mtc_power_off(struct isi_data *isi);
+static gboolean mtc_power_off_poll(gpointer user);
+
+static gboolean check_response_status(const GIsiMessage *msg, uint8_t msgid)
+{
+   if (g_isi_msg_error(msg)  0) {
+   DBG(Error: %s, g_isi_msg_strerror(msg));
+   return FALSE;
+   }
+
+   if (g_isi_msg_id(msg) != msgid) {
+   DBG(Unexpected msg: %s,
+   mtc_message_id_name(g_isi_msg_id(msg)));
+   return FALSE;
+   }
+   return TRUE;
+}
+
+static void report_powered(struct ofono_modem *modem, struct isi_data *isi,
+   ofono_bool_t powered)
+{
+   if (powered == isi-reported)
+   return;
+
+   DBG(%s, powered ? Powered on
+   : isi-enabled ? Reset
+   : Powered off);
+
+   isi-reported = powered;
+   ofono_modem_set_powered(modem, powered);
+}
+
+static void report_online(struct isi_data *isi, ofono_bool_t online)
+{
+   struct isi_cb_data *cbd = isi-online_cbd;
+   ofono_modem_online_cb_t cb = cbd-cb;
+
+   isi-online_cbd = NULL;
+
+   if (isi-online == online)
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
+   else
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
+
+   g_free(cbd);
+}
+
+static void set_power_by_mtc_state(struct ofono_modem *modem,
+   struct isi_data *isi, int mtc_state)
+{
+   isi-mtc_state = mtc_state;
+
+   if (isi-online_cbd)
+   report_online(isi, mtc_state == MTC_NORMAL);
+
+   switch (mtc_state) {
+   case MTC_STATE_NONE:
+   case MTC_POWER_OFF:
+   case MTC_CHARGING:
+   case MTC_SELFTEST_FAIL:
+   report_powered(modem, isi, FALSE);
+   break;
+
+   case MTC_RF_INACTIVE:
+   case MTC_NORMAL:
+   default:
+   report_powered(modem, isi, TRUE);
+   }
+}
+
+static void mtc_state_ind_cb(const GIsiMessage *msg, void *data)
+{
+   struct ofono_modem *modem = data;
+   struct isi_data *isi = ofono_modem_get_data(modem);
+   uint8_t action;
+   uint8_t state;
+
+   if (g_isi_msg_error(msg)  0)
+   return;
+
+   if (g_isi_msg_id(msg) != MTC_STATE_INFO_IND)
+   return;
+
+   if (!g_isi_msg_data_get_byte(msg, 0, state) ||
+   !g_isi_msg_data_get_byte(msg, 1, action))
+   return;
+
+   if (action == MTC_START) {
+   DBG(target modem state: %s 

[PATCH 3/4] build: Add n950 plugin to build

2012-05-14 Thread Aki Niemi
---
 Makefile.am |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9cb490d..2586f5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -147,6 +147,9 @@ builtin_sources += plugins/isiusb.c
 builtin_modules += n900
 builtin_sources += plugins/n900.c plugins/nokia-gpio.h plugins/nokia-gpio.c
 
+builtin_modules += n950
+builtin_sources += plugins/n950.c
+
 builtin_modules += u8500
 builtin_sources += plugins/u8500.c
 endif
-- 
1.7.5.4

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


Re: Anyone want to upstraem N950 patches from MeeGo/Mer?

2011-11-24 Thread Aki Niemi
Hi Marko,

2011/11/22 Marko Saukko marko.sau...@gmail.com:
 there are some Nokia N950 related ofono patches that never made to the
 upstream. I wonder if there is anyone that would be interested of fixing
 and upstreaming these?

 The patches seem to apply with minor modification on top of 1.0 tree,
 but I'm not sure if changes are needed or not.

If you send the patches to the list, I can take a look.

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


Re: [PATCH 0/3] isimodem: Allow network registration automatically

2011-08-29 Thread Aki Niemi
Hi Iiro,

2011/8/3  iiro.kaihlani...@nokia.com:
 Network registration is disabled by default. Enable network registration and 
 roaming  when network is started.

  drivers/isimodem/debug.c                |    5 ++
  drivers/isimodem/network-registration.c |   85 
 +++
  drivers/isimodem/network.h              |   12 -
  3 files changed, 101 insertions(+), 1 deletions(-)

I just pushed a set of patches including these changes. Thanks!

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


Re: [PATCH 0/5] isimodem: Add functionality to UICC

2011-08-29 Thread Aki Niemi
Hi Iiro,

2011/8/3  iiro.kaihlani...@nokia.com:
 This patch adds some functionality to UICC which has been pretty much dummy
 so far.

  Makefile.am  |    3 +-
  drivers/isimodem/debug.c |  121 +
  drivers/isimodem/debug.h |    2 +
  drivers/isimodem/uicc.c  | 1282

The set that I just pushed included this stuff as well.

(We had a number of private emails with Iiro to iron out some issues.)

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


Re: [PATCH 2/3] isimodem: Allow network registration automatically

2011-08-05 Thread Aki Niemi
Hi Iiro,

2011/8/3  iiro.kaihlani...@nokia.com:
 diff --git a/drivers/isimodem/network-registration.c 
 b/drivers/isimodem/network-registration.c
 index cc48579..ffcfab4 100644
 --- a/drivers/isimodem/network-registration.c
 +++ b/drivers/isimodem/network-registration.c
 @@ -946,6 +946,84 @@ error:
        g_free(cbd);
  }

 +static void cs_access_config_resp_cb(const GIsiMessage *msg, void *data)
 +{
 +    struct ofono_netreg *netreg = data;
 +    struct netreg_data *nd = ofono_netreg_get_data(netreg);
 +       GIsiSubBlockIter iter;
 +
 +    DBG();
 +    if (g_isi_msg_id(msg) != NET_NW_ACCESS_CONF_RESP)
 +        return;

Indent with a single tab, no spaces allowed. This applies to the rest
of the patch as well.

 +       for (g_isi_sb_iter_init(iter, msg, 2);
 +                       g_isi_sb_iter_is_valid(iter);
 +                       g_isi_sb_iter_next(iter))
 +               {
 +               uint8_t id = g_isi_sb_iter_get_id(iter);
 +               uint8_t mode;
 +
 +               DBG(SB=%02X, id);
 +               if ((id == 0x55) || (id == 0x59))
 +                   {
 +               g_isi_sb_iter_get_byte(iter, mode, 2);
 +                   DBG(Reg %X, mode);
 +                   }
 +               else if ((id == 0x56) || (id == 0x5A))
 +                   {
 +               g_isi_sb_iter_get_byte(iter, mode, 2);
 +                   DBG(Roam %X, mode);
 +                   }

These subblock IDs need to be added in network.h. I would also
recommend a switch statement here for more readability.

 +               else
 +                   {
 +                   DBG(Unknown subblock);
 +                   }
 +           }

Regarding the entire for and if blocks above and elsewhere in the
patch, the style in oFono is to attach curly brackets on the same line
as the for/if/while statement. Please take a look at
doc/coding-style.txt.

To catch style errors early, I would recommend also using the
checkpatch.pl script before submitting.

 +}
 +
 +static void cs_state_resp_cb(const GIsiMessage *msg, void *data)
 +{
 +    struct ofono_netreg *netreg = data;
 +    struct netreg_data *nd = ofono_netreg_get_data(netreg);
 +    uint8_t code;
 +
 +    DBG();
 +    if (g_isi_msg_id(msg) != NET_CS_STATE_RESP)
 +        return;
 +
 +    if (!g_isi_msg_data_get_byte(msg, 0, code))
 +        return;
 +
 +    if (code != NET_CAUSE_OK)
 +        {
 +        DBG(Failed with cause=%X, code);
 +        return;
 +        }
 +
 +    if (!g_isi_msg_data_get_byte(msg, 1, code))
 +        return;
 +    DBG(CS STATE=%X, code);
 +
 +    if (code == NET_CS_INACTIVE)
 +        {
 +        DBG(CS INACTIVE - DO POWER ON NOT IMPLEMENTED!!);

No shouting please ;)

 +        }
 +    else
 +       {
 +       /* Enable registration and roaming */
 +        const uint8_t req[] = {
 +            NET_NW_ACCESS_CONF_REQ, 0, 2,
 +            /* Subblock 1 */
 +            0x59, 4, 1, 0,
 +            /* Subblock 2 */
 +            0x5A, 4, 1, 0,

Should really add these subblock IDs in network.h.

 +        };
 +
 +        DBG(CS ACTIVE - Check access config);
 +        g_isi_client_send(nd-client, req, sizeof(req), 
 cs_access_config_resp_cb, netreg, NULL);

Please take a look at coding style rule O2, and rather than putting
all this in an else statement, just return above if code ==
NET_CS_INACTIVE.

By the way, is CS access config ever set if when probing the CS state
is NET_CS_INACTIVE? Should we also subscribe to the equivalent
indication to drive this code?

 +       }
 +}
 +
  static void subscribe_indications(GIsiClient *cl, void *data)
  {
        g_isi_client_ind_subscribe(cl, NET_RSSI_IND, rssi_ind_cb, data);
 @@ -994,6 +1072,11 @@ static void pn_modem_network_reachable_cb(const 
 GIsiMessage *msg, void *data)
        struct ofono_netreg *netreg = data;
        struct netreg_data *nd = ofono_netreg_get_data(netreg);

 +    const uint8_t req[] = {
 +        NET_CS_STATE_REQ,
 +    };
 +
 +

Indent with tabs here.

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


Re: Problems ofono 0.45 and Nokia 6760

2011-06-16 Thread Aki Niemi
On Thu, 2011-06-16 at 11:27 +0200, ext Claudio Degioanni wrote:
  So my advice is to simply use DUN via USB ACM interface. So I think the
  nokia driver might work better than the isiusb one in this case.
 I'm using embedded tegra2 system, in the past i have tested the
 connection on x86 machine and it
 works succefull.

Ah, I see.

This issue was actually fixed in commit
44ad041c2740064ec055bee7c4084953a10e799d about a week after the 0.45
release.

Cheers,
Aki

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


Re: Problems ofono 0.45 and Nokia 6760

2011-06-15 Thread Aki Niemi
Hi Claudio,

On Wed, 2011-06-08 at 16:22 +0200, ext Claudio Degioanni wrote:
 Error org.ofono.Error.NotAttached: GPRS is not attached

Has this been working before?

It looks like the network registration status query fails with a
SERVICE_NOT_IDENTIFIED service type. My suspicion is that the phone
actually blocks this query, for reasons unknown. Either that, or the API
has changed since 10.001 in a backwards incompatible way unknown to me.

Because of this, the GPRS atom doesn't think the device is registered
and no attach happens.

There's not much that can be done if the query is indeed intentionally
blocked. I didn't find any documented change in the API, so it's not
possible to try to use a different type of query based on version here.

So my advice is to simply use DUN via USB ACM interface. So I think the
nokia driver might work better than the isiusb one in this case.

Cheers,
Aki

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


Re: [PATCH] isimodem: Improper handling of missed call

2011-06-14 Thread Aki Niemi
Hi Arun,

2011/5/30 Arun Ravindran arun...@gmail.com:
 Can you post logs on such a successful case, if you have any around?


 tested once again, its working for me. I have attached the log here.

 But here i am using as n900 modem and not as isiusb .

It seems to be working for me now using the isiusb plugin.

So I pushed the patch along with the WS fixes.

Sorry for the delay.

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


Re: build fail with --disable-atmodem

2011-06-01 Thread Aki Niemi
On Wed, 2011-06-01 at 05:57 +, ext 오인호 wrote:
 i tried to compile with --disable-atmodem, an error occurred.
 
 please help what to do. (i want only isimodem)
 
 - without --disable-atmodem, compile success.

I sent a patch on 24.3. that fixes the issue. Gatchat is now required to
build core, but gets disabled along with atmodem.

Maybe Marcel or Denis could take a look at that patch (reattaching it
here).

Cheers,
Aki
From 1920b813a4db120f0d6692e9d4d86f3fe313a263 Mon Sep 17 00:00:00 2001
From: Aki Niemi aki.ni...@nokia.com
Date: Thu, 24 Mar 2011 17:30:12 +0200
Subject: [PATCH] build: Add gatchat to core sources
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Otherwise, --disable-atmodem breaks build.
---
 Makefile.am |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b0cbcd7..39d8962 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -154,8 +154,7 @@ endif
 
 if ATMODEM
 builtin_modules += atmodem
-builtin_sources += $(gatchat_sources) \
-drivers/atmodem/atmodem.h \
+builtin_sources += drivers/atmodem/atmodem.h \
 drivers/atmodem/atmodem.c \
 drivers/atmodem/call-settings.c \
 drivers/atmodem/sms.c \
@@ -365,9 +364,9 @@ builtin_sources += plugins/push-notification.c
 
 sbin_PROGRAMS = src/ofonod
 
-src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
-			src/main.c src/ofono.h src/log.c src/plugin.c \
-			src/modem.c src/common.h src/common.c \
+src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) $(gatchat_sources) \
+			src/ofono.ver src/main.c src/ofono.h src/log.c \
+			src/plugin.c src/modem.c src/common.h src/common.c \
 			src/manager.c src/dbus.c src/util.h src/util.c \
 			src/network.c src/voicecall.c src/ussd.c src/sms.c \
 			src/call-settings.c src/call-forwarding.c \
-- 
1.7.1

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


Re: [PATCH] isimodem: Improper handling of missed call

2011-05-30 Thread Aki Niemi
Hi Arun,

2011/5/23 Arun Ravindran arun...@gmail.com:
 @@ -548,9 +555,26 @@ static void isi_call_notify(struct ofono_voicecall *ovc, 
 struct isi_call *call)

        case CALL_STATUS_MO_RELEASE:
        case CALL_STATUS_MT_RELEASE:
 -       case CALL_STATUS_TERMINATED:
 +               /*
 +               * Core requires the call status to be either incoming
 +               * or waiting to identify the disconnected call as missed.
 +               * The MT RELEASE is not mapped to any state in +CLCC, but
 +               * we need the disconnect reason.
 +               */
                isi_call_set_disconnect_reason(call);
                break;
 +       case CALL_STATUS_TERMINATED:
 +               DBG(State( CALL_STATUS_TERMINATED ) need not be reported to 
 Core);
 +               /*
 +               * The call terminated is not reported to core as
 +               * these intermediate states are not processed in
 +               * the core. We report the call status when it becomes
 +               * idle and TERMINATED is not mapped to +CLCC. The disconnect
 +               * reason is set, so that the call termination cause
 +               * in case of error is available to the core.
 +               */
 +               isi_call_set_disconnect_reason(call);
 +               return;

These comment blocks had some trailing whitespace.

I tested this patch, and I don't think it's still doing the right
thing. I don't seem to be able to generate a missed call, at least
when using the isiusb plugin. Somehow, ofono_voicecall_disconnect()
does not get called with the correct reason code.

Can you post logs on such a successful case, if you have any around?

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


Re: [PATCH] isimodem: Improper handling of missed call

2011-05-19 Thread Aki Niemi
Hi Arun,

2011/5/18 Arun Ravindran arun...@gmail.com:
 +       case CALL_STATUS_MT_RELEASE:
 +               if ((call-prev_status == CALL_STATUS_MT_ALERTING) ||
 +                               (call-prev_status == CALL_STATUS_COMING) ||
 +                               (call-prev_status == CALL_STATUS_WAITING))
 +                       return 4;
 +               else
 +                       return 6;
 +

Extra whitespace here.

        case CALL_STATUS_ACTIVE:
        case CALL_STATUS_HOLD_INITIATED:
                return 0;
 @@ -548,9 +555,14 @@ static void isi_call_notify(struct ofono_voicecall *ovc, 
 struct isi_call *call)

        case CALL_STATUS_MO_RELEASE:
        case CALL_STATUS_MT_RELEASE:
 +               isi_call_set_disconect_reason(call):
 +               break;
 +
        case CALL_STATUS_TERMINATED:
                isi_call_set_disconnect_reason(call);
 -               break;
 +               DBG(State( CALL_STATUS_TERMINATED ) need not be reported to 
 Core);
 +               return;
 +
        case CALL_STATUS_ANSWERED:
                DBG(State need not be reported to Core);
                return;

If the intention is not to report this up, then why set the disconnect
reason with isi_call_set_disconnect_reason()? Why not just fold these
two case statements together?

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


Re: [PATCH] isiusb: wait for MTC transitions, too

2011-04-19 Thread Aki Niemi
Hi Pekka,

2011/4/18  pekka.pe...@nokia.com:
 From: Pekka Pessi pekka.pe...@nokia.com

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

Patch has been pushed, thanks.

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


Re: [PATCH] isimodem: fix call_create_resp handling

2011-04-12 Thread Aki Niemi
Hi Pekka,

2011/4/12  pekka.pe...@nokia.com:
 From: Pekka Pessi pekka.pe...@nokia.com

 In case of call creation failure modem may return a valid call id in
 order to send CALL_SERVICE_DENIED_IND which we do not handle.

 Fixes MeeGo bug#15855.
 ---
  drivers/isimodem/voicecall.c |   39 +--
  1 files changed, 33 insertions(+), 6 deletions(-)

Patch has been pushed. Thanks!

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


Re: [PATCH] isimodem: notify sms-status-reports, too

2011-04-12 Thread Aki Niemi
Hi Pekka,

2011/4/12  pekka.pe...@nokia.com:
 From: Pekka Pessi pekka.pe...@nokia.com

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

I actually ended up pushing a fix for this as part of the wgmodem2.5
additions. Thanks anyway!

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


Re: [PATCH 1/1] isimodem: fix network registration for older modems

2011-03-24 Thread Aki Niemi
Hi Mika,

2011/3/24 Mika Liljeberg mika.liljeb...@nokia.com:
 ---
  drivers/isimodem/network-registration.c |   10 --
  1 files changed, 8 insertions(+), 2 deletions(-)

Patch has been pushed. Thanks.

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


Re: [PATCH 1/2] isimodem/sim: added PIN and SIM state handling

2011-03-24 Thread Aki Niemi
Hi Pekka,

2011/3/24  pekka.pe...@nokia.com:
 From: Pekka Pessi pekka.pe...@nokia.com

 Using PN_SECURITY resource to obtain PIN statuses.

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

Patch has been pushed. Thanks.

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


[PATCH] build: Add gatchat to core sources

2011-03-24 Thread Aki Niemi
Otherwise, --disable-atmodem breaks build.
---
 Makefile.am |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b0cbcd7..39d8962 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -154,8 +154,7 @@ endif
 
 if ATMODEM
 builtin_modules += atmodem
-builtin_sources += $(gatchat_sources) \
-   drivers/atmodem/atmodem.h \
+builtin_sources += drivers/atmodem/atmodem.h \
drivers/atmodem/atmodem.c \
drivers/atmodem/call-settings.c \
drivers/atmodem/sms.c \
@@ -365,9 +364,9 @@ builtin_sources += plugins/push-notification.c
 
 sbin_PROGRAMS = src/ofonod
 
-src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
-   src/main.c src/ofono.h src/log.c src/plugin.c \
-   src/modem.c src/common.h src/common.c \
+src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) $(gatchat_sources) \
+   src/ofono.ver src/main.c src/ofono.h src/log.c \
+   src/plugin.c src/modem.c src/common.h src/common.c \
src/manager.c src/dbus.c src/util.h src/util.c \
src/network.c src/voicecall.c src/ussd.c src/sms.c \
src/call-settings.c src/call-forwarding.c \
-- 
1.7.1

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


Re: [RESEND 3 PATCH 00/13] IPv6 Support

2011-03-21 Thread Aki Niemi
Hi Denis,

2011/3/18 Denis Kenzior denk...@gmail.com:
 Unfortunately that ship has sailed.  Every vendor except Nokia uses AT
 command modems, or at least implements a (somewhat) full-featured AT
 backend.

Not quite the way I see things. There are notable exceptions to this,
for example, Qualcomm modems don't use AT commands but a proprietary
protocol.

That said, I think designing the modem driver API based on 27.007 was
a good design decision, but the real test of that decision hasn't
really been done yet. Of course you'll find AT modems mostly a good
fit, and in most cases the other protocols too. But calling it a
raving success without, say, QMI support is a bit premature.

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


Re: [PATCH] Isimodem: Crash while setting SCA

2011-03-14 Thread Aki Niemi
Hi Denis,

2011/3/11 Denis Kenzior denk...@gmail.com:
 diff --git a/drivers/isimodem/sms.c b/drivers/isimodem/sms.c
 index 957b342..c90c06d 100644
 --- a/drivers/isimodem/sms.c
 +++ b/drivers/isimodem/sms.c
 @@ -292,7 +292,7 @@ static void isi_sca_set(struct ofono_sms *sms,
               { sd-params, sizeof(sd-params) },
       };

 -     if (cbd == NULL || sd == NULL)
 +     if (cbd == NULL || sd == NULL || sd-sim == NULL)

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

That's right. However, the only way for sd == NULL would be that core
first called remove() and then sca_set(), which should not happen.

So I think I will just remove that check.

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


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

2011-03-08 Thread Aki Niemi
Hi Jeevaka,

On Tue, 2011-03-08 at 12:35 +0200, ext jeevaka.badrap...@elektrobit.com
wrote:
 This log is taken some time back. Possible that Network Daylight Saving
 Time is received as part of the MM information message whereas
 it may not be in your case.

If my memory serves, DST is optional in NITZ; only the UTC offset is
mandatory content.

Cheers,
Aki

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


Re: [PATCH] gisi: M6 coding style violation corrections

2011-03-04 Thread Aki Niemi
Hi Antti,

2011/3/4 Antti Paila antti.pa...@nokia.com:
 ---
  gisi/iter.c |   16 
  1 files changed, 8 insertions(+), 8 deletions(-)

Patch has been pushed. Thanks.

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 andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  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: [PATCH v2 10/18] isimodem: wgmodem2.5 added to voicecall

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  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 12/18] isimodem: SS_GSM_BARRING_INFO added

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 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 14/18] isimodem: wgmodem2.5 added to ssn

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  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 13/18] isimodem: wgmodem2.5 added to call-forwarding

2011-03-03 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  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] gisi: Consumer functions for ISI message iterator

2011-03-03 Thread Aki Niemi
Hi Antti,

2011/3/3 Antti Paila antti.pa...@nokia.com:
snip

  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


Re: [PATCH] isiusb: add message-waiting

2011-03-03 Thread Aki Niemi
Hi Jukka,

2011/3/3 Jukka Saunamaki jukka.saunam...@nokia.com:
 ---
  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


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

2011-03-03 Thread Aki Niemi
Hi Antti,

2011/2/14 Antti Paila antti.pa...@nokia.com:
 ---
  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 config.h
 +#endif
 +
 +#include errno.h
 +
 +#include glib.h
 +#include gdbus.h
 +
 +#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,
 +                                       void *data)
 +{

Coding style, M4.

 +       struct ofono_cell_info *ci;
 +       GSList *l;
 +
 +       if (driver == NULL)
 +              

Re: ofono patch review policy?

2011-03-01 Thread Aki Niemi
Hi George,

2011/3/1 George Matveev geo...@matveev.se:
 on February 6, I submitted a patch (isimodem):

 http://lists.ofono.org/pipermail/ofono/2011-February/008635.html

 But it is already March and the patch has never been reviewed nor formally
 rejected.

Sorry, I had missed that.

 Other people had asked similar questions regarding their patches recently
 on #ofono IRC.

 It would be nice to understand if there's any patch review
 policy/procedure in this project?

Currently, patch submitters are kindly asked to follow through. That
is, if the patch doesn't receive attention, to resubmit, and bug the
maintainers long enough for them to review the patch.

It's not optimal, but the inflow is quite big at the moment, and I
have been for instance (among other duties) quite busy with the
wgmodem2.5 patches.

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


Re: [PATCH 1/1] isimodem: group timeouts in enum, remove unused timeout

2011-03-01 Thread Aki Niemi
Hi George,

2011/2/6 George Matveev geo...@matveev.se:
 Introduce enum network_timeout for scan/registration timeouts,
 remove unused NETWORK_TIMEOUT.
 ---
  drivers/isimodem/network.h |    8 +---
  1 files changed, 5 insertions(+), 3 deletions(-)

 diff --git a/drivers/isimodem/network.h b/drivers/isimodem/network.h
 index b96216d..f35ed5a 100644
 --- a/drivers/isimodem/network.h
 +++ b/drivers/isimodem/network.h
 @@ -27,11 +27,13 @@ extern C {
  #endif

  #define PN_NETWORK                                     0x0A
 -#define NETWORK_TIMEOUT                                        5
 -#define NETWORK_SCAN_TIMEOUT                           180
 -#define NETWORK_SET_TIMEOUT                            240
  #define NET_INVALID_TIME                               0x64

I would rather just remove the unused define.

 +enum network_timeout {
 +       NETWORK_SCAN_TIMEOUT    =       180,
 +       NETWORK_SET_TIMEOUT             =       240

This is not the indentation style to use for enums. Check
coding-style.txt, section M11.

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


Re: [PATCH v2 04/18] plugins: add u8500 to udev

2011-02-25 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

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

Patch applied. Thanks!

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


Re: [PATCH v2 06/18] src: add missing SIM enum to simutil.h

2011-02-25 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  src/simutil.h |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

Applied this patch with minor tweak of the commit message.

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


Re: [PATCH v2 07/18] isimodem: code points uicc sim wgmodem2.5

2011-02-25 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  Makefile.am              |    4 +-
  drivers/isimodem/debug.c |   84 +++
  drivers/isimodem/debug.h |    1 +
  drivers/isimodem/uicc.h  |  265 
 ++
  4 files changed, 353 insertions(+), 1 deletions(-)
  create mode 100644 drivers/isimodem/uicc.h

I applied this patch, but removed the inter-driver API for now.

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


Re: [PATCH v2 15/18] isimodem: code points for sms wgmodem2.5

2011-02-25 Thread Aki Niemi
Hi,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/debug.c |   56 
 ++
  drivers/isimodem/debug.h |    1 +
  drivers/isimodem/sms.h   |   34 
  3 files changed, 91 insertions(+), 0 deletions(-)

Patch has been pushed. Thanks!

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


Re: [PATCH v2 02/18] isimodem: added codepoints for u8500

2011-02-23 Thread Aki Niemi
Hi Andreas,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/debug.c |    1 +
  drivers/isimodem/info.h  |    3 +++
  2 files changed, 4 insertions(+), 0 deletions(-)

Patch has been pushed. Thanks.

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


Re: [PATCH v2 03/18] plugins: add plugin for u8500

2011-02-23 Thread Aki Niemi
Hi Andreas,

2011/2/23 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  Makefile.am     |    3 +
  plugins/u8500.c |  708 
 +++
  2 files changed, 711 insertions(+), 0 deletions(-)
  create mode 100644 plugins/u8500.c

I pushed this patch, but split it into two, and fixed the plugin
description afterwards.

Cheers,
Aki

 diff --git a/Makefile.am b/Makefile.am
 index 7bd7f4f..aa4f3f9 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -144,6 +144,9 @@ builtin_sources += plugins/isiusb.c

  builtin_modules += n900
  builtin_sources += plugins/n900.c plugins/nokia-gpio.h plugins/nokia-gpio.c
 +
 +builtin_modules += u8500
 +builtin_sources += plugins/u8500.c
  endif

  if ATMODEM
 diff --git a/plugins/u8500.c b/plugins/u8500.c
 new file mode 100644
 index 000..78e1a97
 --- /dev/null
 +++ b/plugins/u8500.c
 @@ -0,0 +1,708 @@
 +/*
 + *
 + *  oFono - Open Source Telephony
 + *
 + *  Copyright (C) 2010  Nokia Corporation and/or its subsidiary(-ies).
 + *  Copyright (C) ST-Ericsson SA 2011.
 + *
 + *  This program is free software; you can redistribute it and/or modify
 + *  it under the terms of the GNU General Public License version 2 as
 + *  published by the Free Software Foundation.
 + *
 + *  This program is distributed in the hope that it will be useful,
 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + *  GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
 USA
 + *
 + */
 +
 +#ifdef HAVE_CONFIG_H
 +#include config.h
 +#endif
 +
 +#include stdio.h
 +#include errno.h
 +#include stdlib.h
 +#include string.h
 +#include glib.h
 +
 +#include gisi/netlink.h
 +#include gisi/modem.h
 +#include gisi/client.h
 +#include gisi/message.h
 +#include gisi/iter.h
 +
 +#define OFONO_API_SUBJECT_TO_CHANGE
 +#include ofono/plugin.h
 +#include ofono/log.h
 +#include ofono/modem.h
 +#include ofono/devinfo.h
 +#include ofono/phonebook.h
 +#include ofono/netreg.h
 +#include ofono/voicecall.h
 +#include ofono/sms.h
 +#include ofono/cbs.h
 +#include ofono/sim.h
 +#include ofono/ussd.h
 +#include ofono/ssn.h
 +#include ofono/call-forwarding.h
 +#include ofono/call-settings.h
 +#include ofono/call-barring.h
 +#include ofono/call-meter.h
 +#include ofono/radio-settings.h
 +#include ofono/gprs.h
 +#include ofono/gprs-context.h
 +
 +#include drivers/isimodem/isimodem.h
 +#include drivers/isimodem/isiutil.h
 +#include drivers/isimodem/mtc.h
 +#include drivers/isimodem/debug.h
 +
 +struct isi_data {
 +       char const *ifname;
 +       GIsiModem *modem;
 +       GIsiClient *client;
 +       GIsiPhonetNetlink *link;
 +       enum GIsiPhonetLinkState linkstate;
 +       unsigned interval;
 +       int reported;
 +       ofono_bool_t online;
 +       struct isi_cb_data *online_cbd;
 +};
 +
 +struct devinfo_data {
 +       GIsiClient *client;
 +};
 +
 +static gboolean check_response_status(const GIsiMessage *msg, uint8_t msgid)
 +{
 +       if (g_isi_msg_error(msg)  0) {
 +               DBG(Error: %s, strerror(-g_isi_msg_error(msg)));
 +               return FALSE;
 +       }
 +
 +       if (g_isi_msg_id(msg) != msgid) {
 +               DBG(Unexpected msg: %s,
 +                       mce_message_id_name(g_isi_msg_id(msg)));
 +               return FALSE;
 +       }
 +       return TRUE;
 +}
 +
 +static void report_powered(struct ofono_modem *modem, struct isi_data *isi,
 +                               ofono_bool_t powered)
 +{
 +       if (powered == isi-reported)
 +               return;
 +
 +       isi-reported = powered;
 +       ofono_modem_set_powered(modem, powered);
 +}
 +
 +static void report_online(struct isi_data *isi, ofono_bool_t online)
 +{
 +       struct isi_cb_data *cbd = isi-online_cbd;
 +       ofono_modem_online_cb_t cb = cbd-cb;
 +
 +       isi-online_cbd = NULL;
 +
 +       if (isi-online == online)
 +               CALLBACK_WITH_SUCCESS(cb, cbd-data);
 +       else
 +               CALLBACK_WITH_FAILURE(cb, cbd-data);
 +
 +       g_free(cbd);
 +}
 +
 +static void set_power_by_mce_state(struct ofono_modem *modem,
 +                                       struct isi_data *isi, int mce_state)
 +{
 +       switch (mce_state) {
 +       case MCE_POWER_OFF:
 +               report_powered(modem, isi, FALSE);
 +               break;
 +       case MCE_NORMAL:
 +               if (isi-online_cbd)
 +                       report_online(isi, mce_state == MCE_NORMAL);
 +       default:
 +               report_powered(modem, isi, TRUE);
 +       }
 +}
 +
 +static void mce_state_ind_cb(const GIsiMessage *msg, void *data)
 +{
 +       struct ofono_modem *modem = data;
 +       struct isi_data *isi = 

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

2011-02-18 Thread Aki Niemi
Hi Andreas,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/call-settings.c |  697 
 +-
  drivers/isimodem/call.h          |    9 +
  drivers/isimodem/debug.c         |    4 +
  drivers/isimodem/ss.h            |   22 ++
  4 files changed, 714 insertions(+), 18 deletions(-)

 diff --git a/drivers/isimodem/call-settings.c 
 b/drivers/isimodem/call-settings.c
 index 89270e9..7a6bedf 100644
 --- a/drivers/isimodem/call-settings.c
 +++ b/drivers/isimodem/call-settings.c
 @@ -3,6 +3,7 @@
  *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 + *  Copyright (C) ST-Ericsson SA 2011.
  *
  *  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
 @@ -43,10 +44,15 @@
  #include ss.h
  #include debug.h

 +#define CLIP_ETC
 +

I don't see this used anywhere in the code.

  struct settings_data {
        GIsiClient *client;
  };

 +#define content_size  40
 +static char content[content_size] = {0};
 +

(snip)

 +static int set_clir_status(const char *value)
 +{
 +       DBG(Setting CLIR status to %s, value);
 +       strncpy(content, value, content_size);
 +       content[content_size-1] = 0;
 +       return EXIT_SUCCESS;
 +}
 +
 +static int get_clir_status(void)
 +{
 +       DBG(Getting CLIR status %s, content);
 +
 +       if (!strcmp(content, OFONO_CLIR_OPTION_INVOCATION))
 +               return OFONO_CLIR_OPTION_INVOCATION;
 +
 +       if (!strcmp(content, OFONO_CLIR_OPTION_SUPPRESSION))
 +               return OFONO_CLIR_OPTION_SUPPRESSION;
 +
 +       return OFONO_CLIR_OPTION_DEFAULT;
 +}

I don't understand this part. Why is 'content' a static buffer, and
why is strncpy() used? All I see are const strings copied there.

Also, if the getter anyway returns an int, why not store an int there
in the first place? Could it also be part of the call-settings driver
data?

 +static void clir_set_cb(const GIsiMessage *msg, void *data)
 +{
 +       GIsiSubBlockIter iter, iter_info;
 +       struct isi_cb_data *cbd = data;
 +       ofono_call_settings_set_cb_t cb = cbd-cb;
 +       gint override = OFONO_CLIR_OPTION_DEFAULT;
 +       gint network = CLIR_STATUS_UNKNOWN;
 +       uint8_t service;
 +
 +       if (!check_response_status(msg, SS_SERVICE_COMPLETED_RESP))
 +               goto error;
 +
 +       if (!g_isi_msg_data_get_byte(msg, 0, service) ||
 +                       service != SS_INTERROGATION)
 +               goto error;
 +
 +       for (g_isi_sb_iter_init(iter, msg, 6);
                        g_isi_sb_iter_is_valid(iter);
                        g_isi_sb_iter_next(iter)) {
 +               DBG(Sub-block %s,
 +                               
 ss_subblock_name(g_isi_sb_iter_get_id(iter)));

 -               if (g_isi_sb_iter_get_id(iter) != SS_GSM_BSC_INFO)
 -                       continue;
 +               switch (g_isi_sb_iter_get_id(iter)) {
 +               case SS_STATUS_RESULT: {
 +                       guint8 ss_status;
 +
 +                       if (!g_isi_sb_iter_get_byte(iter, ss_status, 2))
 +                               goto error;
 +
 +                       DBG(SS_STATUS_RESULT=%d, ss_status);
 +
 +                       if (!(ss_status  SS_GSM_PROVISIONED))
 +                               network = CLIR_STATUS_NOT_PROVISIONED;
 +               }
 +               break;
 +               case SS_GSM_ADDITIONAL_INFO:
 +                       break;
 +               case SS_GSM_GENERIC_SERVICE_INFO: {
 +                       guint8 ss_status = 0;
 +                       guint8 clir_option = 0;
 +                       void *info = NULL;
 +                       GIsiMessage info_msg;
 +
 +                       if (!g_isi_sb_iter_get_byte(iter, ss_status, 2))
 +                               goto error;
 +
 +                       if (!(ss_status  SS_GSM_PROVISIONED))
 +                               network = CLIR_STATUS_NOT_PROVISIONED;
 +
 +                       if (!g_isi_sb_iter_get_data(iter, info, 4))
 +                               goto error;
 +
 +                       info_msg.addr = NULL;
 +                       info_msg.error = 0;
 +                       /*
 +                        * GIsiMessage function adds 2 to data pointer and
 +                        * removes 2 from len
 +                        */
 +                       info_msg.data = info - 2;
 +                       info_msg.len = msg-len - 6 + 2;
 +
 +                       for (g_isi_sb_iter_init(iter_info, info_msg, 0);
 +                                       g_isi_sb_iter_is_valid(iter_info);
 +                                       g_isi_sb_iter_next(iter_info)) {
 +                               DBG(Sub-block %s,
 +                                       ss_subblock_name(
 +                                       

Re: [PATCH 11/18] isimodem: gprs-context updates wgmodem2.5

2011-02-18 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/gprs-context.c |   95 +-
  1 files changed, 62 insertions(+), 33 deletions(-)

 diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
 index 6d579d8..f458fcc 100644
 --- a/drivers/isimodem/gprs-context.c
 +++ b/drivers/isimodem/gprs-context.c
 @@ -347,32 +347,52 @@ static void send_context_authenticate(GIsiClient 
 *client, void *opaque)
        struct context_data *cd = opaque;
        size_t username_len = strlen(cd-username);
        size_t password_len = strlen(cd-password);
 +       size_t sb_user_info_len = (3 + username_len + 3)  ~3;
 +       size_t fill_sb_user_info_count =
 +                       sb_user_info_len - (3 + username_len);
 +       uint8_t *fill_sb_user_info_data =
 +                       g_try_malloc0(fill_sb_user_info_count);
 +       size_t sb_password_info_len = (3 + password_len + 3)  ~3;
 +       size_t fill_sb_password_info_count =
 +                       sb_user_info_len - (3 + password_len);

This should be sb_password_info_len, no?

 +       uint8_t *fill_sb_password_info_data =
 +                       g_try_malloc0(fill_sb_password_info_count);

There's no reason to allocate the padding from heap. (Especially if
they're never freed.)

I applied this patch, but fixed the above issues afterwards. Please
check that it's still doing the right thing.

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


Re: [PATCH 16/18] isimodem: sms updated with wgmodem2.5

2011-02-17 Thread Aki Niemi
Hi Andreas,

2011/2/16 Andreas WESTIN andreas.wes...@stericsson.com:
 This UICC stuff seems to be leftovers form patch 8/18.

 Well they are related to SMS, debug prints. But yes they are also UICC. Do
 you want them in patch 8 ?

That would be my preference. That is, a patch to bring in the PN_UICC
codepoints and debugs, then separate patches for implementations using
those new codepoints.

 PN_SIM client is created in the UICC client verify callback if it fails, do
 we not get a response to that callback even if UICC fails ?

Ah, right.

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


Re: [PATCH 04/18] gisi: fix subscription for wgmodem2.5

2011-02-16 Thread Aki Niemi
Hi Andreas,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
                if (legacy)
                        msg[3 + count] = mux-resource;
 -               else
 +               else {
                        /* Resource field is 32bit and Little-endian */
                        msg[4 + count * 4 + 3] = mux-resource;
 +               }

Curly brackets are either in both if and else, or in neither. I
actually prefer not to have them here, since the first line is just a
comment in the else statement. ;)

                count++;
        }

 +       commgr.spn_dev = legacy ? modem-device : PN_DEV_MODEM;
        len = legacy ? 3 + count : 4 + count * 4;
        msg[2] = count;

This is not necessary, as a modem plugin is supposed to call
g_isi_modem_set_device() to set the modem-device to whatever it needs
to right after creating the GIsiModem instance.

In other words, the assumption is that when the GIsiModem instace is
actually used, all necessary internal data, such as flags and the
remote device have already been set.

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


Re: [PATCH 03/18] isimodem: general build updates for wgmodem2.5

2011-02-16 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/debug.c |   48 
 ++
  drivers/isimodem/debug.h |    8 +++
  drivers/isimodem/mtc.h   |   38 
  3 files changed, 94 insertions(+), 0 deletions(-)

I pushed this patch, but modified the commit message a bit.

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


Re: [PATCH 04/18] gisi: fix subscription for wgmodem2.5

2011-02-16 Thread Aki Niemi
Hi Andreas,

2011/2/16 Andreas WESTIN andreas.wes...@stericsson.com:
 Tested and works fine, will submit a new patch for the u8500 plugin. This is
 not done in the n900 plugin though, perhaps not necessary ?

The default is PN_DEV_HOST, which is what the N900 uses.

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


Re: [PATCH 07/18] isimodem: add wgmodem2.5 to devinfo

2011-02-16 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 @@ -111,17 +115,22 @@ static void isi_query_manufacturer(struct ofono_devinfo 
 *info,
        struct devinfo_data *dev = ofono_devinfo_get_data(info);
        struct isi_cb_data *cbd = isi_cb_data_new(dev, cb, data);

 +       if (cbd == NULL || dev == NULL)
 +               goto error;
 +
 +       if (g_isi_client_resource(dev-client) == PN_MODEM_INFO) {
 +               goto error;
 +       } else {
 +

So do I understand this right, that PN_MODEM_INFO doesn't return any
of manufacturer, model, revision, or serial information at all?

If so, then I don't understand why any of this code is here. To
implement the serial number query, you just need to implement and
register your custom devinfo driver in the U8500 plugin that reads the
serial from under /etc.

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


Re: [PATCH 16/18] isimodem: sms updated with wgmodem2.5

2011-02-16 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 From: Jessica Nilsson jessica.j.nils...@stericsson.com

 ---
  drivers/isimodem/debug.c |   56 +++
  drivers/isimodem/debug.h |    1 +
  drivers/isimodem/sms.c   |  972 
 +++---
  drivers/isimodem/sms.h   |   34 ++
  4 files changed, 927 insertions(+), 136 deletions(-)

 diff --git a/drivers/isimodem/debug.c b/drivers/isimodem/debug.c
 index 33e4dcb..1fd2226 100644
 --- a/drivers/isimodem/debug.c
 +++ b/drivers/isimodem/debug.c
 @@ -53,6 +53,7 @@ const char *pn_resource_name(int value)
                _(PN_GSS);
                _(PN_GPDS);
                _(PN_WRAN);
 +               _(PN_UICC);
        }
        return PN_UNKNOWN;
  }
 @@ -218,6 +219,47 @@ const char *mce_rf_state_name(enum mce_rf_state value)
        return MCE_RFUNKNOWN;
  }

 +const char *uicc_message_id_name(enum uicc_message_id value)
 +{
 +       switch (value) {
 +               _(UICC_REQ);
 +               _(UICC_RESP);
 +               _(UICC_IND);
 +               _(UICC_CARD_REQ);
 +               _(UICC_CARD_RESP);
 +               _(UICC_CARD_IND);
 +               _(UICC_APPLICATION_REQ);
 +               _(UICC_APPLICATION_RESP);
 +               _(UICC_APPLICATION_IND);
 +               _(UICC_PIN_REQ);
 +               _(UICC_PIN_RESP);
 +               _(UICC_PIN_IND);
 +               _(UICC_APPL_CMD_REQ);
 +               _(UICC_APPL_CMD_RESP);
 +               _(UICC_APPL_CMD_IND);
 +               _(UICC_CONNECTOR_REQ);
 +               _(UICC_CONNECTOR_RESP);
 +               _(UICC_CAT_REQ);
 +               _(UICC_CAT_RESP);
 +               _(UICC_CAT_IND);
 +               _(UICC_APDU_REQ);
 +               _(UICC_APDU_RESP);
 +               _(UICC_APDU_RESET_IND);
 +               _(UICC_REFRESH_REQ);
 +               _(UICC_REFRESH_RESP);
 +               _(UICC_REFRESH_IND);
 +               _(UICC_SIMLOCK_REQ);
 +               _(UICC_SIMLOCK_RESP);
 +               _(UICC_APDU_SAP_REQ);
 +               _(UICC_APDU_SAP_RESP);
 +               _(UICC_APDU_SAP_IND);
 +               _(UICC_PWR_CTRL_REQ);
 +               _(UICC_PWR_CTRL_RESP);
 +               _(UICC_PWR_CTRL_IND);
 +       }
 +       return UICC_UNKNOWN;
 +}
 +

This UICC stuff seems to be leftovers form patch 8/18.

(snip)

 @@ -664,28 +1334,44 @@ static int isi_sms_probe(struct ofono_sms *sms, 
 unsigned int vendor,
        if (sd == NULL)
                return -ENOMEM;

 -       sd-params.absent = 0xFF;
 -       sd-params.alphalen = 1; /* Includes final UCS2-coded NUL */
 +       sd-sim_params.absent = 0xFF;
 +       sd-sim_params.alphalen = 1; /* Includes final UCS2-coded NUL */
 +
 +       sd-usim_params.indicators = 0xFF;
 +       sd-usim_params.alphalen = 0; /* Includes final UCS2-coded NUL */
 +

        sd-client = g_isi_client_create(modem, PN_SMS);
        if (sd-client == NULL)
                goto nomem;

 -       sd-sim = g_isi_client_create(modem, PN_SIM);
 +       sd-sim = g_isi_client_create(modem, PN_UICC);
 +

After this, the driver will no longer work with N900 or the isimodem plugin.

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


Re: [PATCH 05/18] plugins: add plugin for u8500

2011-02-16 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin andreas.wes...@stericsson.com:
 +static int u8500_probe(struct ofono_modem *modem)
 +{
 +       const char *ifname = ofono_modem_get_string(modem, Interface);
 +       unsigned address = ofono_modem_get_integer(modem, Address);
 +       GIsiModem *isimodem;
 +       GIsiClient *client = NULL;
 +       GIsiPhonetNetlink *link = NULL;
 +       struct isi_data *isi = NULL;
 +
 +       if (ifname == NULL)
 +               return -EINVAL;
 +
 +       DBG((%p) with %s, modem, ifname);
 +
 +       isimodem = g_isi_modem_create_by_name(ifname);
 +       if (isimodem == NULL) {
 +               DBG(Interface=%s: %s, ifname, strerror(errno));
 +               return -errno;
 +       }
 +
 +       if (!g_isi_modem_set_version(isimodem, modemversion))
 +               return -EINVAL;

I'm not going to add this API in GIsiModem. If we went this route, and
used vendor quirks inside the isimodem driver, then it would make a
whole lot more sense to do it in the driver create(), not here.

But we're not going that route. Each driver detects the version of the
ISI service it is talking to when it is probed.

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


Re: [PATCH] TODO: Add vCard export to SM/ME stores

2011-02-09 Thread Aki Niemi
Hi Marcel,

2010/11/23 Marcel Holtmann mar...@holtmann.org:
 So the aa{sv} parameter/return value would be of format:
 {
   'name'    : string,
   'group'   : string,   // optional, for eg. organization
   'hidden'  : integer,  // boolean value: defaults to 0
   'numbers' : array of dict {
     'number'   : string,
     'category' : integer
   },
   'emails' : array of dict {
     'address'  : string,
     'category' : integer
   },
   'voip_uris' : array of dict {
     'uri'      : string,
     'category' : integer
   },
 }

 category : enum { // like existing enum phonebook_number_type
   HOME, MOBILE, FAX, WORK, OTHER
 }

 this feels a bit too complicated for me. I actually don't want to
 over-design this feature, but it does have to be consistent with our
 other key names.

I agree, how about a strict subset of the spec, like a dict of name - number?

 To be honest, the more and more I think about this, the more my
 conclusion is to not support phonebook export. It is a bad idea. It is
 highly complex and it is not a feature that will be used anyway.

I tend to agree. However, people seem to really want to have this
export(), so we need to arrive at some reasonable conclusion here.

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


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

2011-02-08 Thread Aki Niemi
Hi,

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

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

Please take a look if it works for you.

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


Re: [PATCH 1/1] gisi: Updated subscriptions and pipe handling to accomodate additional isimodem versions

2011-02-04 Thread Aki Niemi
Hi Rémi,

2011/1/28 Rémi Denis-Courmont remi.denis-courm...@nokia.com:
 On Friday 28 January 2011 13:37:10 ext Jessica Nilsson, you wrote:
 diff --git a/gisi/common.h b/gisi/common.h
 index 83a8cf5..c78f893 100644
 --- a/gisi/common.h
 +++ b/gisi/common.h
 @@ -26,6 +26,8 @@
  extern C {
  #endif

 +#define PN_HOST                                        0x00
 +#define PN_MODEM                               0x60

 It looks like you are mixing up services (PN_* from 0 to 255), with device
 addresses (PN_DEV_* multiple of four from 0 to 252).

  #define PN_COMMGR                              0x10
  #define PN_NAMESERVICE                         0xDB
  #define PN_FIREWALL                            0x43
 diff --git a/gisi/modem.c b/gisi/modem.c
 index 8750367..7201235 100644
 --- a/gisi/modem.c
 +++ b/gisi/modem.c
 @@ -61,6 +61,7 @@ struct _GIsiModem {
         unsigned index;
         GHashTable *services;
         gboolean subs_source;
 +       GIsiVersion version;

 I can't see where this gets set?!

         int req_fd;
         int ind_fd;
         guint req_watch;
 @@ -349,11 +345,34 @@ static gboolean modem_subs_update(gpointer data)
         gpointer keyptr, value;

         GIsiModem *modem = data;
 -       uint8_t msg[3 + 256] = {
 -               0, PNS_SUBSCRIBED_RESOURCES_IND,
 -               0,
 -       };
 +       GIsiMessage dmsg;
 +       uint8_t msg[3 + 256] = { 0 };
         uint8_t count = 0;
 +       int msg_size = 0;
 +       struct sockaddr_pn commgr = {
 +               .spn_family = AF_PHONET,
 +               .spn_resource = PN_COMMGR,
 +       };
 +
 +       if (g_isi_modem_version_major(modem) == 2 
 +               g_isi_modem_version_minor(modem) == 5) {

 You really need to factor this check out. It's going to be a disaster when
 there are more than two versions otherwise.

This is problematic, since there is no version query by default for
the PN_COMMGR because creating the GIsiModem is not async. Also, even
the N900 modem supports both of these INDs, but the
PNS_SUBSCRIBED_RESOURCES_EXTEND_IND is blocked by a modem side
firewall.

So I think we need something different here, like flags that the
plugin can set to control which IND type gets used.

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


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

2011-02-04 Thread Aki Niemi
Hi Andreas,

2011/2/3 Andreas WESTIN andreas.wes...@stericsson.com:
 I don't see what that has to do with the device supporting the PC
 suite USB profile, which allows modem access using cdc_phonet.

 Currently our platform does not support this.

Well, I know of platforms that do, and have different versions of ISI modems.

 That is exactly what I meant. This version allows building quirks inside
 the drivers. An example in pseudo-code:

 if GIsiVersion.major == 15 and GIsiVersion.minor= 3:
        send( { FOO, value, filler, filler}, callback1 )
 else:
        send( { FOO, value }, callback2 )


 Yes, we use a similar solution in gisi, but Rémi pointed out that it would
 be a maintenance problem once there are more versions to support and I tend
 to agree. A solution could be to use a lookup function, but this function
 would need to return something to compare with, an enum perhaps.
 Also are you certain that e.g major == 15 and minor == 25 is still the same
 ISI version, if not then the lookup function could become messy.

The PNS_SUBSCRIBED_RESOURCES_EXTEND_IND is a bit of a special case, as
it requires quirking inside GIsiModem. But see my other response in
that thread.

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


[PATCH 1/2 v2] netreg: Add CPHS CSP implementation

2011-02-04 Thread Aki Niemi
---
 src/network.c |  122 
 1 files changed, 96 insertions(+), 26 deletions(-)

diff --git a/src/network.c b/src/network.c
index bf61472..07f9cdf 100644
--- a/src/network.c
+++ b/src/network.c
@@ -42,7 +42,8 @@
 
 enum network_registration_mode {
NETWORK_REGISTRATION_MODE_AUTO =0,
-   NETWORK_REGISTRATION_MODE_MANUAL =  1,
+   NETWORK_REGISTRATION_MODE_AUTO_ONLY =   1,
+   NETWORK_REGISTRATION_MODE_MANUAL =  2,
 };
 
 #define SETTINGS_STORE netreg
@@ -98,6 +99,8 @@ static const char *registration_mode_to_string(int mode)
switch (mode) {
case NETWORK_REGISTRATION_MODE_AUTO:
return auto;
+   case NETWORK_REGISTRATION_MODE_AUTO_ONLY:
+   return auto-only;
case NETWORK_REGISTRATION_MODE_MANUAL:
return manual;
}
@@ -143,6 +146,42 @@ static char **network_operator_technologies(struct 
network_operator_data *opd)
return techs;
 }
 
+static void registration_status_callback(const struct ofono_error *error,
+   int status, int lac, int ci, int tech,
+   void *data)
+{
+   struct ofono_netreg *netreg = data;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Error during registration status query);
+   return;
+   }
+
+   ofono_netreg_status_notify(netreg, status, lac, ci, tech);
+}
+
+static void init_register(const struct ofono_error *error, void *data)
+{
+   struct ofono_netreg *netreg = data;
+
+   if (netreg-driver-registration_status == NULL)
+   return;
+
+   netreg-driver-registration_status(netreg,
+   registration_status_callback, netreg);
+}
+
+static void enforce_auto_only(struct ofono_netreg *netreg)
+{
+   if (netreg-mode != NETWORK_REGISTRATION_MODE_MANUAL)
+   return;
+
+   if (netreg-driver-register_auto == NULL)
+   return;
+
+   netreg-driver-register_auto(netreg, init_register, netreg);
+}
+
 static void set_registration_mode(struct ofono_netreg *netreg, int mode)
 {
DBusConnection *conn;
@@ -152,6 +191,9 @@ static void set_registration_mode(struct ofono_netreg 
*netreg, int mode)
if (netreg-mode == mode)
return;
 
+   if (mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   enforce_auto_only(netreg);
+
netreg-mode = mode;
 
if (netreg-settings) {
@@ -170,20 +212,6 @@ static void set_registration_mode(struct ofono_netreg 
*netreg, int mode)
Mode, DBUS_TYPE_STRING, strmode);
 }
 
-static void registration_status_callback(const struct ofono_error *error,
-   int status, int lac, int ci, int tech,
-   void *data)
-{
-   struct ofono_netreg *netreg = data;
-
-   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
-   DBG(Error during registration status query);
-   return;
-   }
-
-   ofono_netreg_status_notify(netreg, status, lac, ci, tech);
-}
-
 static void register_callback(const struct ofono_error *error, void *data)
 {
struct ofono_netreg *netreg = data;
@@ -211,15 +239,6 @@ out:
registration_status_callback, netreg);
 }
 
-static void init_register(const struct ofono_error *error, void *data)
-{
-   struct ofono_netreg *netreg = data;
-
-   if (netreg-driver-registration_status)
-   netreg-driver-registration_status(netreg,
-   registration_status_callback, netreg);
-}
-
 static struct network_operator_data *
network_operator_create(const struct ofono_network_operator *op)
 {
@@ -586,6 +605,9 @@ static DBusMessage 
*network_operator_register(DBusConnection *conn,
struct network_operator_data *opd = data;
struct ofono_netreg *netreg = opd-netreg;
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -828,6 +850,9 @@ static DBusMessage *network_register(DBusConnection *conn,
 {
struct ofono_netreg *netreg = data;
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -947,6 +972,9 @@ static DBusMessage *network_scan(DBusConnection *conn,
 {
struct ofono_netreg *netreg = data;
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -1364,7 +1392,7 @@ static void init_registration_status(const struct 
ofono_error 

Re: [PATCH 1/2] isimodem: fix problems in call state reporting

2011-02-03 Thread Aki Niemi
Hi Pekka,

2011/2/2  pekka.pe...@nokia.com:
 From: Pekka Pessi pekka.pe...@nokia.com

 Do not report early incoming calls.

 Report disconnected state separately.

 Call ofono_voicecall_disconnected() only after call id is released.
 ---
  drivers/isimodem/voicecall.c |   84 
 ++
  1 files changed, 60 insertions(+), 24 deletions(-)

Patch has been pushed. Thanks!

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


[PATCH 3/6] util: Add best dialect picker API

2011-02-03 Thread Aki Niemi
---
 src/util.c |   64 
 src/util.h |7 ++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c
index 547f38c..e1e8a0a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -788,6 +788,70 @@ unsigned char *convert_utf8_to_gsm(const char *text, long 
len,
 }
 
 /*!
+ * Converts UTF-8 encoded text to GSM alphabet. It finds an encoding
+ * that uses the minimum set of GSM dialects based on the hint given.
+ *
+ * It first attempts to use the default dialect's single shift and
+ * locking shift tables. It then tries with only the single shift
+ * table of the hinted dialect, and finally with both the single shift
+ * and locking shift tables of the hinted dialect.
+ *
+ * Returns the encoded data or NULL if no suitable encoding could be
+ * found. The data must be freed by the caller. If items_read is not
+ * NULL, it contains the actual number of bytes read. If items_written
+ * is not NULL, it contains the number of bytes written. If
+ * used_locking and used_single are not NULL, they will contain the
+ * dialects used for the locking shift and single shift tables.
+ */
+unsigned char *convert_utf8_to_gsm_best_lang(const char *utf8, long len,
+   long *items_read, long *items_written,
+   unsigned char terminator,
+   enum gsm_dialect hint,
+   enum gsm_dialect *used_locking,
+   enum gsm_dialect *used_single)
+{
+   enum gsm_dialect locking = GSM_DIALECT_DEFAULT;
+   enum gsm_dialect single = GSM_DIALECT_DEFAULT;
+   unsigned char *encoded;
+
+   encoded = convert_utf8_to_gsm_with_lang(utf8, len, items_read,
+   items_written, terminator,
+   locking, single);
+   if (encoded != NULL)
+   return encoded;
+
+   if (hint == GSM_DIALECT_DEFAULT)
+   return NULL;
+
+   single = hint;
+   encoded = convert_utf8_to_gsm_with_lang(utf8, len, items_read,
+   items_written, terminator,
+   locking, single);
+   if (encoded != NULL)
+   return encoded;
+
+   /* Spanish dialect uses the default locking shift table */
+   if (hint == GSM_DIALECT_SPANISH)
+   return NULL;
+
+   locking = hint;
+   encoded = convert_utf8_to_gsm_with_lang(utf8, len, items_read,
+   items_written, terminator,
+   locking, single);
+
+   if (encoded == NULL)
+   return NULL;
+
+   if (used_locking != NULL)
+   *used_locking = locking;
+
+   if (used_single != NULL)
+   *used_single = single;
+
+   return encoded;
+}
+
+/*!
  * Decodes the hex encoded data and converts to a byte array.  If terminator
  * is not 0, the terminator character is appended to the end of the result.
  * This might be useful for converting GSM encoded data if the CSCS is set
diff --git a/src/util.h b/src/util.h
index 8e4b7f3..a1d11b4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -44,6 +44,13 @@ unsigned char *convert_utf8_to_gsm_with_lang(const char 
*text, long len,
enum gsm_dialect locking_shift_lang,
enum gsm_dialect single_shift_lang);
 
+unsigned char *convert_utf8_to_gsm_best_lang(const char *utf8, long len,
+   long *items_read, long *items_written,
+   unsigned char terminator,
+   enum gsm_dialect hint,
+   enum gsm_dialect *used_locking,
+   enum gsm_dialect *used_single);
+
 unsigned char *decode_hex_own_buf(const char *in, long len, long 
*items_written,
unsigned char terminator,
unsigned char *buf);
-- 
1.7.1

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


[PATCH 2/2] TODO: Remove completed CPHS CSP task

2011-02-03 Thread Aki Niemi
---
 TODO |   13 -
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/TODO b/TODO
index 13a6baa..82066fa 100644
--- a/TODO
+++ b/TODO
@@ -88,19 +88,6 @@ SIM / SIM File system
   Complexity: C1
   Owner: Marit Henriksen marit.henrik...@stericsson.com
 
-- Add support for CPHS Customer Service Profile (CSP).  This task adds support
-  for reading the EFcsp file and in particular, interpreting the PLMN mode bit
-  within the 'Value Added Services' service group.
-
-  Based on the PLMN mode value, manual network selection needs to either be
-  enabled or disabled in the netreg atom.  Also to accommodate this, there
-  probably needs to be a new 'forced' mode to indicate that manual network
-  selection is disabled.
-
-  Priority: Medium
-  Complexity: C1
-  Owner: Aki Niemi aki.ni...@nokia.com
-
 - Support SIM authentication: SIM and AKA suites.
 
   Priority: Medium
-- 
1.7.1

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


[PATCH 1/2] netreg: Add CPHS CSP implementation

2011-02-03 Thread Aki Niemi
---
 src/network.c |  121 
 1 files changed, 95 insertions(+), 26 deletions(-)

diff --git a/src/network.c b/src/network.c
index bf61472..ef0b37f 100644
--- a/src/network.c
+++ b/src/network.c
@@ -42,7 +42,8 @@
 
 enum network_registration_mode {
NETWORK_REGISTRATION_MODE_AUTO =0,
-   NETWORK_REGISTRATION_MODE_MANUAL =  1,
+   NETWORK_REGISTRATION_MODE_AUTO_ONLY =   1,
+   NETWORK_REGISTRATION_MODE_MANUAL =  2,
 };
 
 #define SETTINGS_STORE netreg
@@ -98,6 +99,8 @@ static const char *registration_mode_to_string(int mode)
switch (mode) {
case NETWORK_REGISTRATION_MODE_AUTO:
return auto;
+   case NETWORK_REGISTRATION_MODE_AUTO_ONLY:
+   return auto-only;
case NETWORK_REGISTRATION_MODE_MANUAL:
return manual;
}
@@ -143,6 +146,42 @@ static char **network_operator_technologies(struct 
network_operator_data *opd)
return techs;
 }
 
+static void registration_status_callback(const struct ofono_error *error,
+   int status, int lac, int ci, int tech,
+   void *data)
+{
+   struct ofono_netreg *netreg = data;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Error during registration status query);
+   return;
+   }
+
+   ofono_netreg_status_notify(netreg, status, lac, ci, tech);
+}
+
+static void init_register(const struct ofono_error *error, void *data)
+{
+   struct ofono_netreg *netreg = data;
+
+   if (netreg-driver-registration_status == NULL)
+   return;
+
+   netreg-driver-registration_status(netreg,
+   registration_status_callback, netreg);
+}
+
+static void enforce_auto_only(struct ofono_netreg *netreg)
+{
+   if (netreg-mode != NETWORK_REGISTRATION_MODE_MANUAL)
+   return;
+
+   if (netreg-driver-register_auto == NULL)
+   return;
+
+   netreg-driver-register_auto(netreg, init_register, netreg);
+}
+
 static void set_registration_mode(struct ofono_netreg *netreg, int mode)
 {
DBusConnection *conn;
@@ -152,6 +191,9 @@ static void set_registration_mode(struct ofono_netreg 
*netreg, int mode)
if (netreg-mode == mode)
return;
 
+   if (mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   enforce_auto_only(netreg);
+
netreg-mode = mode;
 
if (netreg-settings) {
@@ -170,20 +212,6 @@ static void set_registration_mode(struct ofono_netreg 
*netreg, int mode)
Mode, DBUS_TYPE_STRING, strmode);
 }
 
-static void registration_status_callback(const struct ofono_error *error,
-   int status, int lac, int ci, int tech,
-   void *data)
-{
-   struct ofono_netreg *netreg = data;
-
-   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
-   DBG(Error during registration status query);
-   return;
-   }
-
-   ofono_netreg_status_notify(netreg, status, lac, ci, tech);
-}
-
 static void register_callback(const struct ofono_error *error, void *data)
 {
struct ofono_netreg *netreg = data;
@@ -211,15 +239,6 @@ out:
registration_status_callback, netreg);
 }
 
-static void init_register(const struct ofono_error *error, void *data)
-{
-   struct ofono_netreg *netreg = data;
-
-   if (netreg-driver-registration_status)
-   netreg-driver-registration_status(netreg,
-   registration_status_callback, netreg);
-}
-
 static struct network_operator_data *
network_operator_create(const struct ofono_network_operator *op)
 {
@@ -586,6 +605,9 @@ static DBusMessage 
*network_operator_register(DBusConnection *conn,
struct network_operator_data *opd = data;
struct ofono_netreg *netreg = opd-netreg;
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -838,6 +860,9 @@ static DBusMessage *network_register(DBusConnection *conn,
 
netreg-driver-register_auto(netreg, register_callback, netreg);
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return NULL;
+
set_registration_mode(netreg, NETWORK_REGISTRATION_MODE_AUTO);
 
return NULL;
@@ -947,6 +972,9 @@ static DBusMessage *network_scan(DBusConnection *conn,
 {
struct ofono_netreg *netreg = data;
 
+   if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -1364,7 +1392,7 @@ static void init_registration_status(const struct 

Re: [PATCH 1/2] netreg: Add CPHS CSP implementation

2011-02-03 Thread Aki Niemi
Hi Denis,

2011/2/3 Denis Kenzior denk...@gmail.com:
 +     if (netreg-mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
 +             return NULL;
 +

 So we might just return access_denied here as well.

There is a reason for allowing this, namely that sometimes you want to
re-run the logic for automatically operator selection. Granted, this
is not your most common use case, but since it also does no harm to
allowing it, I didn't.

       set_registration_mode(netreg, NETWORK_REGISTRATION_MODE_AUTO);

       return NULL;

 snip

 @@ -1769,7 +1835,7 @@ static void netreg_load_settings(struct ofono_netreg 
 *netreg)
       mode = g_key_file_get_integer(netreg-settings, SETTINGS_GROUP,
                                       Mode, NULL);

 -     if (mode = 0  mode = 1)
 +     if (mode != NETWORK_REGISTRATION_MODE_AUTO_ONLY)
               netreg-mode = mode;


 This check is unnecessary, you already loaded the settings before you
 managed to load the sim file.  You're also removing a sanity check for
 no real reason.

That's just a bug. The intention was to write:

if (mode == NEtWORK_REGISTRATION_MODE_AUTO ||
mode == NETWORK_REGISTRATION_MODE_MANUAL)
netreg-mode = mode;

The patch has a seemingly shorter way of describing the same, but as
you point out, misses the sanity check. Must have been lack of coffee
or something. ;)

 This brings up another point, since the CPHS CSP file is actually
 user-writeable (for some unknown reason) the user can remove the SIM,
 put it in another phone and modify the forced-auto settings.  If you
 store the forced-auto mode in the settings file, then there's no way to
 ever go back to non-forced auto, even though he should be able to.

I think the above way will in fact default to auto even if the
settings store has auto-only. And yes, EFcsp can definitely change
even at run-time, as manual mode really should be allowed when
roaming, at least in countries that the operator for instance has
multiple suitable roaming partners with varying coverage.

 I suggest that when forced-auto is detected, that we only write
 NETWORK_REGISTRATION_MODE_AUTO to the settings store.

That sounds reasonable, too.

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


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

2011-02-02 Thread Aki Niemi
On Wed, 2011-02-02 at 10:03 +0100, ext Andreas WESTIN wrote:
 On 2011-02-01 20:32, Aki Niemi wrote:
  Like I replied earlier, I don't see the need for this. Also, it will not
  work well with the isiusb plugin, which has the potential to work with
  any ISI modem. I'm not willing to break that potential until we just
  absolutely have to.
 
 U8500 uses shrm driver and will not be recognized via isiusb.

I don't see what that has to do with the device supporting the PC
suite USB profile, which allows modem access using cdc_phonet.

  So, my stance holds: we quirk based on resource ID and based on the
  server's ISI version.
 
  From the information we have regarding ISI version from each server is 
 that it is not consistent, meaning the value you get is not really the 
 ISI version but the version of the server.

That is exactly what I meant. This version allows building quirks inside
the drivers. An example in pseudo-code:

if GIsiVersion.major == 15 and GIsiVersion.minor = 3:
send( { FOO, value, filler, filler}, callback1 )
else:
send( { FOO, value }, callback2 )

Cheers,
Aki

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


Re: [PATCH] Phonesim HACKING updated to refer to phonesim.conf instead of modem.conf.

2011-02-01 Thread Aki Niemi
Hi Essi,

2011/2/1 Essi Vehmersalo essi.vehmers...@nokia.com:
 -automatically includes this option.
 +automatically includes this option. See phonesim.conf sample configuration
 +under ofono/plugins on how to configure oFono to use phonesim.

   Run phonesim in foreground using the following options
     # ./src/phonesim -p 12345 -gui src/default.xml

 -Check your modem.conf file and enable the phonesim configuration before
 -executing the above command. Argument -p should be followed by the proper
 -port number, in case you have changed the default 12345. Argument -gui
 -will launch the gui once the modem is enabled.
 +Argument -p should be followed by the proper port number, in case you have
 +changed the default 12345. Argument -gui will launch the gui once the
 +modem is enabled.

A couple of nits: there are some extra whitespace at the end of the
lines, and also, the commit message header should be below 50
characters.

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


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

2011-02-01 Thread Aki Niemi
Hi Marcel,

On Tue, 2011-02-01 at 16:43 +0100, ext Marcel Holtmann wrote:
  +enum isi_version {
  +   ISI_20 = 0,
  +   ISI_25 = 1
  +};
 
 so what is the final decision here now. ISI doing auto-detection and
 this gets not exposed to the modem drivers or we do.

Like I replied earlier, I don't see the need for this. Also, it will not
work well with the isiusb plugin, which has the potential to work with
any ISI modem. I'm not willing to break that potential until we just
absolutely have to.

So, my stance holds: we quirk based on resource ID and based on the
server's ISI version.

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

Cheers,
Aki

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


Re: [PATCH] TODO: SMS Validity Period

2011-01-31 Thread Aki Niemi
Hi Marcel,

2011/1/31 Marcel Holtmann mar...@holtmann.org:
 How does a normal user actually know what this means for him and the
 network he is using? Is the network actually honoring these values at
 all these days?

These are not clear to me either, so I don't see the point in exposing
this setting over the D-Bus interface. I would, however, err on the
side of flexibility here, and make this a configuration option in
main.conf (once that support is available in oFono).

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


[RFC 0/6] Add configuration support via main.conf

2011-01-26 Thread Aki Niemi
Hi all,

This set of patches adds support for oFono configuration settings via
main.conf. First three add the file and routines for parsing that
file; the following three take a parameter in the sms atom and makes
it configurable.

Cheers,
Aki

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


[RFC 6/6] sms: Use main configuration for 16bit ref number

2011-01-26 Thread Aki Niemi
---
 src/sms.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index 7224bdf..48d2d81 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -842,7 +842,6 @@ static DBusMessage *sms_send_message(DBusConnection *conn, 
DBusMessage *msg,
GSList *msg_list;
struct ofono_modem *modem;
unsigned int flags;
-   gboolean use_16bit_ref = FALSE;
int err;
struct ofono_uuid uuid;
 
@@ -854,7 +853,7 @@ static DBusMessage *sms_send_message(DBusConnection *conn, 
DBusMessage *msg,
if (valid_phone_number_format(to) == FALSE)
return __ofono_error_invalid_format(msg);
 
-   msg_list = sms_text_prepare(to, text, sms-ref, use_16bit_ref,
+   msg_list = sms_text_prepare(to, text, sms-ref, main_opts.use_16bit_ref,
sms-use_delivery_reports);
 
if (msg_list == NULL)
-- 
1.7.1

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


[RFC 4/6] conf: Add ref number setting for MessageManager

2011-01-26 Thread Aki Niemi
---
 src/main.conf |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/main.conf b/src/main.conf
index facb950..0b23998 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -2,3 +2,9 @@
 
 # List of plugins that should not be loaded on oFono startup
 #DisablePlugins =
+
+[MessageManager]
+
+# Use 16bit long reference numbers in outgoing SMSs. The default is
+# False, which causes 8bit long reference numbers to be used.
+Use16bitReference = false
-- 
1.7.1

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


[RFC 3/6] build: Add main.conf to the build

2011-01-26 Thread Aki Niemi
---
 Makefile.am |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f941a19..02ea2cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,7 +35,7 @@ endif
 
 confdir = $(sysconfdir)/ofono
 
-conf_DATA =
+conf_DATA = src/main.conf
 
 statedir = $(localstatedir)/lib/ofono
 
@@ -477,7 +477,7 @@ testdir = $(pkglibdir)/test
 test_SCRIPTS = $(test_scripts)
 endif
 
-conf_files = src/ofono.conf plugins/phonesim.conf
+conf_files = src/ofono.conf plugins/phonesim.conf src/main.conf
 
 EXTRA_DIST = src/genbuiltin $(conf_files) $(udev_files) \
$(doc_files) $(test_scripts)
-- 
1.7.1

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


[PATCH 0/4] Add support for CPHS customer service profile

2011-01-26 Thread Aki Niemi
Hi all,

This series adds support for CPHS CSP PLMN mode into the netreg atom.

Cheers,
Aki

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


Re: [PATCH 0/4] Add support for CPHS customer service profile

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
 one open question here is still if we also have to disallow scanning
 when this is set?

 So we might wanna update the Scan() and Register() method with the
 proper error codes and put a note in there for mode = auto-only.

Good point, it's also missing from the Scan() implementation. I meant
to add it for but forgot. I'll send a v2 shortly.

The other open item was whether to create a new error code for this or
reuse the existing access denied error (my preference).

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


Re: [PATCH 2/4] netreg: Add CPHS CSP PLMN mode implementation

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
 diff --git a/src/network.c b/src/network.c
 index b5450ee..64734d0 100644
 --- a/src/network.c
 +++ b/src/network.c
 @@ -64,6 +64,7 @@ struct ofono_netreg {
       int cellid;
       int technology;
       int mode;
 +     gboolean forced_auto;

 do we wanna keep it named forced_auto and not better keep this in sync
 with auto_only as we use in the D-Bus API. Or if manual_disabled.

I can rename this auto_only.

 -static const char *registration_mode_to_string(int mode)
 +static const char *registration_mode_to_string(int mode, gboolean 
 forced_auto)
  {
 +     if (forced_auto)
 +             return auto-only;
 +

 I see the benefit of keeping this in this function, but I would not have
 done it like this actually. I would have kept it next to the function
 needing that string and let it do the auto-only check by itself.

That is how I originally had it, but this ends up being a bit less
code. Also, I'd like to localize all of these constant strings into a
single function and not sprinkle them across the code.

 Another possibility might be to convert this into

        get_registration_mode_string(struct ofono_netreg *netreg)

 Since I am not mistaken, then the netreg-mode is always set before you
 are calling this, right?

No, you call it with the new value. The function will then compare the
old and the new, and based on this decide on sending a
PropertyChanged.

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


Re: [PATCH 0/4] Add support for CPHS customer service profile

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
  one open question here is still if we also have to disallow scanning
  when this is set?
 
  So we might wanna update the Scan() and Register() method with the
  proper error codes and put a note in there for mode = auto-only.

 Good point, it's also missing from the Scan() implementation. I meant
 to add it for but forgot. I'll send a v2 shortly.

 The other open item was whether to create a new error code for this or
 reuse the existing access denied error (my preference).

 good question. I can see the benefit of having a proper error code, but
 I have no preference here right now.

I really would prefer to use the existing one, which I think came with
the lockdown property. It fits the bill here as well, and since access
denied won't ever occur for these methods for any other reason, the
code will look exactly the same on the client side.

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


Re: [gprs-provision RFCPATCHv6 0/4] Plugin API for provisioning of GPRS context settings

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
 lets get this merged without support for SPN for now. We can easily add
 this later. So please fix Denis' comments and re-submit this without the
 SPN change.

 Andrew is currently looking into fixing the SIM reading race. Once that
 is done we can tackle the SPN part. Feel free to add a TODO item for
 adding access to SPN information.

By SIM race do you mean an atom getting removed while it has a pending
ofono_sim_read?

 Right now I think we need to do that in the SIM atom, store it, and then
 provide it for netreg and other plugins that might want it. However we
 might need to discuss this a bit further.

I think this is actually easy to fix internally to the sim atom. The
first ofono_sim_read() to EFspn would initiate an async read, and any
call to ofono_sim_read() after the fact would pend on that single read
results, or return immediately with cached results if available.

There is still the SIM race problem, but I would really rather solve
that problem by always having all atoms created and removed in the
same callbacks, without returning to mainloop.
Whether atoms register any D-Bus API in certain modem states is then a
different matter.

But the lifetime of all atoms should be the same, and then the SIM
race is again a local matter to the SIM atom to fix. E.g., cancelling
any pending reads it has on the SIM when it gets removed. Simply
removing the driver should take care of this, in fact (at least
isimodem should handle such a thing gracefully).

So I don't see the point in removing the SPN code from provisioning
right now. It is a necessary part of the solution, so at least we need
to keep the task open as long as SPN is not in.

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


Re: [PATCH 2/4] netreg: Add CPHS CSP PLMN mode implementation

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
 That is how I originally had it, but this ends up being a bit less
 code. Also, I'd like to localize all of these constant strings into a
 single function and not sprinkle them across the code.

 so I am counting two callers to registration_mode_to_string.

Yup, that's two times auto-only. ;)

 In the current code base it is always checked and set before:

        if (netreg-mode == mode)
                return;

        netreg-mode = mode;

        ...

        strmode = registration_mode_to_string(mode);

Ah, right. I was thinking one call up the stack.

 Just on a different thought here. The NETWORK_REGISTRATION_MODE_* is
 local to src/network.c. We could just add the AUTO_ONLY mode there.

 The only downside I is see the already nasty init_registration_status
 check, but that might be acceptable compared to crippling the string
 conversion function.

 However at least the check would be clearly to just checking mode and
 not mode + forced_mode.

I thought about this, but then we'd need more logic to when the user
calls NetworkRegistration.Register() for automatic mode. That
obviously can't change the mode. But perhaps this is now more
manageable, since we got rid of Deregister(), which means there is
just this one case to worry about.

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


Re: [PATCH 2/4] netreg: Add CPHS CSP PLMN mode implementation

2011-01-26 Thread Aki Niemi
Hi Marcel,

2011/1/26 Marcel Holtmann mar...@holtmann.org:
 can you have a stab at this and check how a patch would look like if we
 just add another mode. If I am not mistaken we only have the extra code
 in the init_registration_status. I could be wrong here since I have not
 looked through that code in a long time.

Sure thing.

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


Re: [PATCH 1/1] isimodem: Adding version isimodem and isimodem2.5

2011-01-25 Thread Aki Niemi
Hi,

2011/1/25 Marcel Holtmann mar...@holtmann.org:
 +enum isi_version {
 +     ISI_20 = 0,
 +     ISI_25 = 1
 +};
 +

 If we follow the same layout as with all other modem drivers, then the
 *modem.h should only contain the prototypes for the init callbacks.

  extern struct ofono_modem *isi_modem_by_interface(char const *ifname);

 This one already violates this one and might need to be cleaned up.

 The ISI modem is special since it really only has two users anyway in
 the end, but maybe drivers/isimodem/version.h analog to vendor.h from
 atmodem might be a good idea.

 Aki, what is your preference here?

I don't think there is a need for this, as ISI itself already provides
both ISI version (which we have available always via the
g_isi_client_verify() call), and in many cases also the resource ID as
means to find the correct quirk to use.

Of course, I could be convinced otherwise, but not without seeing
actual patches. It might become extremely ugly with using ISI version
and the resource ID, and using something like vendor.h might then make
sense.

But remember that we also have the isiusb plugin, and I would like it
to keep working with *any* isimodem out there.

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


Re: [PATCH 1/1] isimodem: Adding version isimodem and isimodem2.5

2011-01-25 Thread Aki Niemi
Hi Marcel,

2011/1/25 Marcel Holtmann mar...@holtmann.org:
 So this clearly then is not suppose to be in isimodem.h and while at it,
 someone might wanna cleanup isi_modem_by_interface and move it to a
 better location.

Done. Moved it to /dev/null. ;-)

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


Re: SAT support in oFono

2011-01-24 Thread Aki Niemi
Hi Lasse,

2011/1/24 Lasse Kunnasluoto lasse.kunnaslu...@tieto.com:
 Let us set aside the the merits of the use cases for these features for
 the moment ;)  Implementing Call control by USIM is fairly
 straightforward to do in the core.  However, no modem manufacturer
 currently allows us to have full control over this feature.  It is
 implemented in the firmware and every vendor does this differently.  So
 for now support of this feature is in the realm of the modem driver.

 okay, so assuming this is how it is going stay. Even modem handles
 these, ofono should deliver possible AlphaId SIM may give in a response
 to call control envelope. I did not see if this is implemented. Or is it
 dropped since it is not tested in GCF..

I think enabling these types of modems would require the stk driver
API be able to give a bit of context to a proactive command. For
example, indicating that a send SMS proactive command is for
information purposes only, and that the SMS has been sent by the
modem.

Also some sort of feature negotiation between core and the stk drivers
might be needed for instance for indicating whether the modem takes
care of call control or not.

The ISI modems are another variation on this topic, as there you need
to use a specific request type to create calls with SIM toolkit turned
off (= no call control). With the default request type and
implementation, the call service would actually send the call control
requests back towards the stk driver. This would likely cause the
voicecall driver to be different, say, between the isiusb and n900
plugins.

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


Re: [PATCH 1/6] gprs-provision: add driver API header

2011-01-24 Thread Aki Niemi
Hi Jukka,

2011/1/24 Jukka Saunamaki jukka.saunam...@nokia.com:
 Then how about something like this: Lets make provisioning API
 synchronous (so that plugins do not need to care about SIM or other
 safety).
 In stead, if in gprs atom ofono_gprs_register() we notice the need for
 provisioning,  ofono_sim_read(SPN) is called there. All issues would be
 localised there. Provisioning modules would be called with MCC,MNC,SPN
 as parameters.

I think this is a better approach. It would reduce the role of the
provisioning plugins to database abstraction only, which is
essentially what they are.

I think the provisioning atom/plugins also should not be modem
specific, but just created once for all modems to use.

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


Re: [PATCH 1/6] gprs-provision: add driver API header

2011-01-24 Thread Aki Niemi
Hi Denis,

2011/1/21 Denis Kenzior denk...@gmail.com:
 How exactly are you guaranteeing that 'nothing bad should happen'?
 There is no cancellation mechanism that I see.  Not to mention that the
 current ofono_sim_read API is not even safe either.  For exactly the
 same reasons.

This is a problem with all users of ofono_sim_read() at the moment. I
suppose if the atoms get removed at different times, it may happen
that after the gprs atom is gone, the SIM atom is still calling its
read callback.

Seems like we need some sort of cancellation API to ofono_sim_read(),
or use Jukka's approach of a request object, perhaps with a
GDestroyNotify parameter, or simply change the way atoms are created
and removed so that this could be handled inside the SIM atom.

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


Re: [PATCH] isimodem: fix issue with user busy release

2011-01-21 Thread Aki Niemi
Hi Jeevaka,

2011/1/21 Jeevaka Badrappan jeevaka.badrap...@elektrobit.com:
 when the user rejects the incoming call, hangup_active
 will get called on the driver side whereas when the user
 rejects the waiting call, set_udub will get called on the
 driver side.
 ---
  drivers/isimodem/voicecall.c |   13 +
  1 files changed, 9 insertions(+), 4 deletions(-)

Patch has been pushed, thanks!

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


Re: [PATCH] isimodem: fix sending DTMF

2011-01-21 Thread Aki Niemi
Hi Kai,

2011/1/20 Kai Vehmanen kai.vehma...@nokia.com:
 isi_call_dtmf_send_resp() handles the success case incorrectly, and
 thus all send_tones attempts fail with bogus error codes.
 ---
  drivers/isimodem/voicecall.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

Patch has been pushed, thanks!

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


Re: [PATCH 5/6] GPRS: document bearer property

2011-01-20 Thread Aki Niemi
Hi Rémi,

2011/1/19 Rémi Denis-Courmont remi.denis-courm...@nokia.com:
 ---
  doc/connman-api.txt |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)

 diff --git a/doc/connman-api.txt b/doc/connman-api.txt
 index 22e02e5..13f622c 100644
 --- a/doc/connman-api.txt
 +++ b/doc/connman-api.txt
 @@ -77,6 +77,16 @@ Properties   boolean Attached [readonly]
                        be available, e.g. receiving SMS over packet radio
                        or network initiated PDP activation.

 +               string Bearer [readonly, optional]
 +
 +                       Contains the data bearer technology as reported by the
 +                       GPRS service registration (if known).
 +
 +                       Possible values are:
 +                       gsm, edge, umts, hsdpa, hsupa,
 +                       hspa (HSDPA and HSUPA at the same time) and
 +                       lte
 +

Should this also report 'none'? At least CPSB can report that a
context is idle, i.e., no bearer associated with it.

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


Re: [RFC] TODO: Move signal strength property to separate Agent API.

2011-01-20 Thread Aki Niemi
Hi Marcel,

2011/1/20 Marcel Holtmann mar...@holtmann.org:
 I don't think is needed. You do not get woken up until you tell D-Bus to
 wake you up on that PropertyChanged signal. You can even match the first
 parameter of that signal if you desire.

I think this is still a worthy optimization, because this way not even
oFono will wake up unnecessarily.

 What we might should ensure is that we delay the signal reporting from
 the modem. In case it wants to play ping-pong between two values. We
 have done that for ConnMan in the past since WiFi signals are also kinda
 flaky and made the UI go nuts.

Personally, I would just move to reporting the strength value in 0...5
bars. Most UIs I've seen report bars in their UIs, and this way these
clients will get woken up much more infrequently.

In addition if percentage is really required, we could offer that as a
separate signal, but to instruct to use with caution. Or put it in a
plugin. :)

Cheers,
Aki

 Regards

 Marcel


 ___
 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] core: Always return success to a no-op

2011-01-20 Thread Aki Niemi
A SetProperty that doesn't actually change the Online property's state
when no change to that state is pending, should not fail. It should
always succeed regardless of the current modem state.
---
 src/modem.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index f587766..e966a6e 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -580,15 +580,15 @@ static DBusMessage *set_property_online(struct 
ofono_modem *modem,
if (modem-pending != NULL)
return __ofono_error_busy(msg);
 
+   if (modem-online == online)
+   return dbus_message_new_method_return(msg);
+
if (driver-set_online == NULL)
return __ofono_error_not_implemented(msg);
 
if (modem-modem_state  MODEM_STATE_OFFLINE)
return __ofono_error_not_available(msg);
 
-   if (modem-online == online)
-   return dbus_message_new_method_return(msg);
-
modem-pending = dbus_message_ref(msg);
 
driver-set_online(modem, online,
-- 
1.7.1

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


Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration

2011-01-19 Thread Aki Niemi
Hi Marcel,

2011/1/18 Marcel Holtmann mar...@holtmann.org:
 please don't implement org.ofono interface in timed. Just implement a
 timed specific (com.nokia.time) interface and punch the whole for that
 in the timed D-Bus policy.

I think there is some disconnect here. The intention is to implement a
similar agent interface as PushNotification and SmartMessaging already
do, with the exception that the one and only agent is known beforehand
and hard-coded to the plugin.

This is a generic interface that some other time information sink
could also implement, so it makes sense to have it in the org.ofono
namespace. Regardless of which namespace we use, though, it is oFono
that will be calling methods on this interface, and thus it needs to
have this interface opened in its D-Bus config.

 The plugin is timed specific since it monitors com.nokia.time and thus
 should also target a timed specific API. Not a generic oFono API
 description.

This is really just another agent API in oFono, just one with a
build-time registration mechanism for agents.

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


[PATCH] voicecall: Fix emergency number handling

2011-01-19 Thread Aki Niemi
If the SIM is present but doesn't contain any emergency numbers, the
set of emergency numbers needs to be reset to the default list. This
patch fixes the list shown in the SIM present case by removing numbers
from the list that are for the no-SIM case only.
---
 src/voicecall.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 77fa75a..fb51b41 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2095,11 +2095,11 @@ static void ecc_g2_read_cb(int ok, int total_length, 
int record,
DBG(%d, ok);
 
if (!ok)
-   return;
+   goto check;
 
if (total_length  3) {
ofono_error(Unable to read emergency numbers from SIM);
-   return;
+   goto check;
}
 
total_length /= 3;
@@ -2112,6 +2112,7 @@ static void ecc_g2_read_cb(int ok, int total_length, int 
record,
g_strdup(en));
}
 
+check:
if (vc-new_en_list == NULL)
return;
 
@@ -2288,6 +2289,20 @@ static void sim_state_watch(enum ofono_sim_state 
new_state, void *user)
 
switch (new_state) {
case OFONO_SIM_STATE_INSERTED:
+   /*
+* Free the currently being read EN list, since it
+* could contain ENs for the SIM not present case,
+* which will erroneously persist if the SIM contains
+* no ENs.
+*/
+   if (vc-new_en_list) {
+   g_slist_foreach(vc-new_en_list, (GFunc) g_free, NULL);
+   g_slist_free(vc-new_en_list);
+   vc-new_en_list = NULL;
+   }
+
+   add_to_en_list(vc-new_en_list, default_en_list);
+
/* Try both formats, only one or none will work */
ofono_sim_read(vc-sim, SIM_EFECC_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
-- 
1.7.1

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


Re: [PATCH] voicecall: Fix emergency number handling

2011-01-19 Thread Aki Niemi
Self,

2011/1/19 Aki Niemi aki.ni...@nokia.com:
 @@ -2095,11 +2095,11 @@ static void ecc_g2_read_cb(int ok, int total_length, 
 int record,
        DBG(%d, ok);

        if (!ok)
 -               return;
 +               goto check;

        if (total_length  3) {
                ofono_error(Unable to read emergency numbers from SIM);
 -               return;
 +               goto check;

Obviously, only one of the callbacks needs this fall-through logic in
case the read fails. Not both.

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


[PATCHv2] voicecall: Fix emergency number handling

2011-01-19 Thread Aki Niemi
If the SIM is present but doesn't contain any emergency numbers, the
set of emergency numbers needs to be reset to the default list.

This patch fixes the list shown in the SIM present case by removing
numbers from the list any ENs that are for the no-SIM case only.
---
 src/voicecall.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 77fa75a..6190b72 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2288,6 +2288,13 @@ static void sim_state_watch(enum ofono_sim_state 
new_state, void *user)
 
switch (new_state) {
case OFONO_SIM_STATE_INSERTED:
+   /*
+* If reading for ENs from the SIM card fails, or
+* results in an empty set, we must reset the EN list
+* to the default list.
+*/
+   add_to_en_list(vc-new_en_list, default_en_list);
+
/* Try both formats, only one or none will work */
ofono_sim_read(vc-sim, SIM_EFECC_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
-- 
1.7.1

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


Re: [PATCH 3/5] doc: Add documentation for 'forced-mode'

2011-01-19 Thread Aki Niemi
Hi Denis,

2011/1/18 Denis Kenzior denk...@gmail.com:
 I'm fine with forced-auto, but we might want to add a new error type to
 ofono.h (maybe something like ManualRegistrationNotAllowed) and return
 that error when trying to use Scan or NetworkOperator.Register.

I was reusing the __ofono_error_access_denied(), which I think came
with the lockdown feature.

 Regards,
 -Denis
 ___
 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 0/6] Deprecate the Deregister() method

2011-01-19 Thread Aki Niemi
Hi All,

This set of patches removes the Deregister() method from the netreg
atom. This method serves no purpose, since the Online property is used
to control oFono's radio on/off state.

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


[PATCH 2/6] isimodem: Remove deregister implementation

2011-01-19 Thread Aki Niemi
---
 drivers/isimodem/network-registration.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/drivers/isimodem/network-registration.c 
b/drivers/isimodem/network-registration.c
index 47aaeb1..6518968 100644
--- a/drivers/isimodem/network-registration.c
+++ b/drivers/isimodem/network-registration.c
@@ -663,14 +663,6 @@ error:
g_free(cbd);
 }
 
-static void isi_deregister(struct ofono_netreg *netreg,
-   ofono_netreg_register_cb_t cb,
-   void *data)
-{
-   DBG(Not implemented.);
-   CALLBACK_WITH_FAILURE(cb, data);
-}
-
 static void rssi_ind_cb(const GIsiMessage *msg, void *data)
 {
struct ofono_netreg *netreg = data;
@@ -859,7 +851,6 @@ static struct ofono_netreg_driver driver = {
.list_operators = isi_list_operators,
.register_auto  = isi_register_auto,
.register_manual= isi_register_manual,
-   .deregister = isi_deregister,
.strength   = isi_strength,
 };
 
-- 
1.7.1

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


[PATCH 1/6] netreg: Deprecate the deregister method

2011-01-19 Thread Aki Niemi
---
 src/network.c |   37 ++---
 1 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/src/network.c b/src/network.c
index ae0f334..1f66f34 100644
--- a/src/network.c
+++ b/src/network.c
@@ -43,8 +43,6 @@
 enum network_registration_mode {
NETWORK_REGISTRATION_MODE_AUTO =0,
NETWORK_REGISTRATION_MODE_MANUAL =  1,
-   NETWORK_REGISTRATION_MODE_OFF = 2,
-   NETWORK_REGISTRATION_MODE_MANUAL_AUTO = 4,
 };
 
 #define SETTINGS_STORE netreg
@@ -102,8 +100,6 @@ static const char *registration_mode_to_string(int mode)
return auto;
case NETWORK_REGISTRATION_MODE_MANUAL:
return manual;
-   case NETWORK_REGISTRATION_MODE_OFF:
-   return off;
}
 
return unknown;
@@ -845,26 +841,6 @@ static DBusMessage *network_register(DBusConnection *conn,
return NULL;
 }
 
-static DBusMessage *network_deregister(DBusConnection *conn,
-   DBusMessage *msg, void *data)
-{
-   struct ofono_netreg *netreg = data;
-
-   if (netreg-pending)
-   return __ofono_error_busy(msg);
-
-   if (netreg-driver-deregister == NULL)
-   return __ofono_error_not_implemented(msg);
-
-   netreg-pending = dbus_message_ref(msg);
-
-   netreg-driver-deregister(netreg, register_callback, netreg);
-
-   set_registration_mode(netreg, NETWORK_REGISTRATION_MODE_OFF);
-
-   return NULL;
-}
-
 static void append_operator_struct(struct ofono_netreg *netreg,
struct network_operator_data *opd,
DBusMessageIter *iter)
@@ -1016,8 +992,6 @@ static GDBusMethodTable network_registration_methods[] = {
{ GetProperties,  ,  a{sv},   network_get_properties },
{ Register,   ,  ,network_register,
G_DBUS_METHOD_FLAG_ASYNC },
-   { Deregister, ,  ,network_deregister,
-   G_DBUS_METHOD_FLAG_ASYNC },
{ GetOperators,   ,  a(oa{sv}),   network_get_operators },
{ Scan,   ,  a(oa{sv}),   network_scan,
G_DBUS_METHOD_FLAG_ASYNC },
@@ -1782,7 +1756,6 @@ struct ofono_netreg *ofono_netreg_create(struct 
ofono_modem *modem,
 static void netreg_load_settings(struct ofono_netreg *netreg)
 {
const char *imsi;
-   int mode;
 
imsi = ofono_sim_get_imsi(netreg-sim);
if (imsi == NULL)
@@ -1795,14 +1768,8 @@ static void netreg_load_settings(struct ofono_netreg 
*netreg)
 
netreg-imsi = g_strdup(imsi);
 
-   mode = g_key_file_get_integer(netreg-settings, SETTINGS_GROUP,
-   Mode, NULL);
-
-   if (mode = 0  mode = 2)
-   netreg-mode = mode;
-
-   g_key_file_set_integer(netreg-settings, SETTINGS_GROUP,
-   Mode, netreg-mode);
+   netreg-mode = g_key_file_get_integer(netreg-settings, SETTINGS_GROUP,
+   Mode, NULL);
 }
 
 void ofono_netreg_register(struct ofono_netreg *netreg)
-- 
1.7.1

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


[PATCH 4/6] api: Remove deregister from modem driver API

2011-01-19 Thread Aki Niemi
---
 include/netreg.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/netreg.h b/include/netreg.h
index a88301d..26a3442 100644
--- a/include/netreg.h
+++ b/include/netreg.h
@@ -84,8 +84,6 @@ struct ofono_netreg_driver {
void (*register_manual)(struct ofono_netreg *netreg,
const char *mcc, const char *mnc,
ofono_netreg_register_cb_t cb, void *data);
-   void (*deregister)(struct ofono_netreg *netreg,
-   ofono_netreg_register_cb_t cb, void *data);
void (*strength)(struct ofono_netreg *netreg,
ofono_netreg_strength_cb_t, void *data);
 };
-- 
1.7.1

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


[PATCH 3/6] atmodem: Remove deregister implementation

2011-01-19 Thread Aki Niemi
---
 drivers/atmodem/network-registration.c |   20 
 1 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/drivers/atmodem/network-registration.c 
b/drivers/atmodem/network-registration.c
index e11c974..4b8cc34 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -557,25 +557,6 @@ error:
CALLBACK_WITH_FAILURE(cb, data);
 }
 
-static void at_deregister(struct ofono_netreg *netreg,
-   ofono_netreg_register_cb_t cb, void *data)
-{
-   struct netreg_data *nd = ofono_netreg_get_data(netreg);
-   struct cb_data *cbd = cb_data_new(cb, data);
-
-   if (cbd == NULL)
-   goto error;
-
-   if (g_at_chat_send(nd-chat, AT+COPS=2, none_prefix,
-   register_cb, cbd, g_free)  0)
-   return;
-
-error:
-   g_free(cbd);
-
-   CALLBACK_WITH_FAILURE(cb, data);
-}
-
 static void csq_notify(GAtResult *result, gpointer user_data)
 {
struct ofono_netreg *netreg = user_data;
@@ -1342,7 +1323,6 @@ static struct ofono_netreg_driver driver = {
.list_operators = at_list_operators,
.register_auto  = at_register_auto,
.register_manual= at_register_manual,
-   .deregister = at_deregister,
.strength   = at_signal_strength,
 };
 
-- 
1.7.1

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


[PATCH 6/6] test: Remove deregister support from test script

2011-01-19 Thread Aki Niemi
---
 test/test-network-registration |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/test/test-network-registration b/test/test-network-registration
index a8bd141..0c25885 100755
--- a/test/test-network-registration
+++ b/test/test-network-registration
@@ -18,8 +18,6 @@ if __name__ == __main__:
(sys.argv[0])
print Usage: %s default - Register to default PLMN %\
(sys.argv[0])
-   print Usage: %s unregister - Unregister from all PLMNs %\
-   (sys.argv[0])
sys.exit(1)
 
canexit = False
@@ -53,14 +51,12 @@ if __name__ == __main__:
try:
if sys.argv[1] == 'default':
netreg.Register()
-   elif sys.argv[1] == 'unregister':
-   netreg.Deregister()
else:
obj = bus.get_object('org.ofono', sys.argv[1]);
op = dbus.Interface(obj, 'org.ofono.NetworkOperator')
op.Register()
except dbus.DBusException, e:
-   print Unable to register/deregister: , e
+   print Unable to register: , e
sys.exit(1)
 
canexit = True
-- 
1.7.1

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


[PATCH 5/6] doc: Remove deregister method documentation

2011-01-19 Thread Aki Niemi
---
 doc/network-api.txt |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/doc/network-api.txt b/doc/network-api.txt
index 3e705e6..75187cd 100644
--- a/doc/network-api.txt
+++ b/doc/network-api.txt
@@ -30,12 +30,6 @@ Methods  dict GetProperties()
 
Possible Errors: [service].Error.InvalidArguments
 
-   void Deregister()
-
-   Completely unregisters from the network
-
-   Possible Errors: [service].Error.InvalidArguments
-
array{object,dict} GetOperators()
 
Retrieve array of operator object and properties.
@@ -81,9 +75,6 @@ Propertiesstring Mode [readonly]
   manually. If the operator is
   currently not selected, registration
   is not attempted
-   off  Unregisters from currently selected
-  network, if any, and does not
-  attempt to register again.
 
string Status [readonly]
 
-- 
1.7.1

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


[PATCH 1/5] simutil: Add EFcsp file and service group IDs

2011-01-18 Thread Aki Niemi
---
 src/simutil.h |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/simutil.h b/src/simutil.h
index 7e386fa..61440a5 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -26,6 +26,7 @@ enum sim_fileid {
SIM_EFLI_FILEID =   0x6F05,
SIM_EF_CPHS_MWIS_FILEID =   0x6F11,
SIM_EF_CPHS_CFF_FILEID =0x6F13,
+   SIM_EF_CPHS_CSP_FILEID =0x6F15,
SIM_EF_CPHS_INFORMATION_FILEID =0x6F16,
SIM_EF_CPHS_MBDN_FILEID =   0x6F17,
SIM_EFUST_FILEID =  0x6F38,
@@ -223,6 +224,21 @@ enum sim_sst_service {
SIM_SST_SERVICE_PROVIDER_DISPLAY_INFO = 55
 };
 
+/* CPHS 4.2, Section B4.7 CSP Service Group Codes */
+enum sim_csp_entry {
+   SIM_CSP_ENTRY_CALL_OFFERING =   0x01,
+   SIM_CSP_ENTRY_CALL_RESTRICTION =0x02,
+   SIM_CSP_ENTRY_OTHER_SUPP_SERVICES = 0x03,
+   SIM_CSP_ENTRY_CALL_COMPLETION = 0x04,
+   SIM_CSP_ENTRY_TELESERVICES =0x05,
+   SIM_CSP_ENTRY_CPHS_TELESERVICES =   0x06,
+   SIM_CSP_ENTRY_CPHS_FEATURES =   0x07,
+   SIM_CSP_ENTRY_NUMBER_IDENTIFICATION =   0x08,
+   SIM_CSP_ENTRY_PHASE_2GPLUS_SERVICES =   0x09,
+   SIM_CSP_ENTRY_VALUE_ADDED_SERVICES =0xC0,
+   SIM_CSP_ENTRY_INFORMATION_NUMBERS = 0xD5,
+};
+
 #define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1
 #define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2
 
-- 
1.7.1

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


[PATCH 0/5] Implement CPHS CSP support

2011-01-18 Thread Aki Niemi
Hi All,

This patch set implements support for the PLMN mode bit found in the
CPHS EFcsp file. Based on the PLMN mode setting, the netreg atom
enables or disables manual network registration.

There is a new Mode property value of 'forced-auto' for indicating the
case when manual selection is disabled. Any attempt to manually
Register() will also fail with an error.

In addition, we add a short description of the CPHS spec in
doc/standards.txt. Unfortunately that spec is not publically
available, although people may have luck finding an unofficial version
online with the help of a search engine. ;)

Aki Niemi (5):
  simutil: Add EFcsp file and service group IDs
  netreg: Add CPHS CSP PLMN mode implementation
  doc: Add documentation for 'forced-mode'
  doc: Add short mention of CPHS under standards
  TODO: Remove completed CPHS CSP task

 TODO|   13 
 doc/network-api.txt |   24 --
 doc/standards.txt   |9 +
 src/network.c   |   85 ++-
 src/simutil.h   |   16 +
 5 files changed, 123 insertions(+), 24 deletions(-)


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


[PATCH 2/5] netreg: Add CPHS CSP PLMN mode implementation

2011-01-18 Thread Aki Niemi
---
 src/network.c |   85 -
 1 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/src/network.c b/src/network.c
index ae0f334..927f7ce 100644
--- a/src/network.c
+++ b/src/network.c
@@ -66,6 +66,7 @@ struct ofono_netreg {
int cellid;
int technology;
int mode;
+   gboolean forced_auto;
char *base_station;
struct network_operator_data *current_operator;
GSList *operator_list;
@@ -174,6 +175,36 @@ static void set_registration_mode(struct ofono_netreg 
*netreg, int mode)
Mode, DBUS_TYPE_STRING, strmode);
 }
 
+static void set_registration_forced_auto(struct ofono_netreg *netreg, gboolean 
value)
+{
+   DBusConnection *conn;
+   const char *strmode;
+   const char *path;
+
+   if (netreg-forced_auto == value)
+   return;
+
+   netreg-forced_auto = value;
+
+   if (netreg-settings) {
+   g_key_file_set_boolean(netreg-settings, SETTINGS_GROUP,
+   ForcedAuto, netreg-forced_auto);
+   storage_sync(netreg-imsi, SETTINGS_STORE, netreg-settings);
+   }
+
+   if (value)
+   strmode = forced-auto;
+   else
+   strmode = registration_mode_to_string(netreg-mode);
+
+   conn = ofono_dbus_get_connection();
+   path = __ofono_atom_get_path(netreg-atom);
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_NETWORK_REGISTRATION_INTERFACE,
+   Mode, DBUS_TYPE_STRING, strmode);
+}
+
 static void registration_status_callback(const struct ofono_error *error,
int status, int lac, int ci, int tech,
void *data)
@@ -588,6 +619,9 @@ static DBusMessage 
*network_operator_register(DBusConnection *conn,
struct network_operator_data *opd = data;
struct ofono_netreg *netreg = opd-netreg;
 
+   if (netreg-forced_auto)
+   return __ofono_error_access_denied(msg);
+
if (netreg-pending)
return __ofono_error_busy(msg);
 
@@ -757,7 +791,12 @@ static DBusMessage *network_get_properties(DBusConnection 
*conn,
 
const char *status = registration_status_to_string(netreg-status);
const char *operator;
-   const char *mode = registration_mode_to_string(netreg-mode);
+   const char *mode;
+
+   if (netreg-forced_auto)
+   mode = forced-auto;
+   else
+   mode = registration_mode_to_string(netreg-mode);
 
reply = dbus_message_new_method_return(msg);
if (reply == NULL)
@@ -1598,6 +1637,43 @@ static void sim_spn_read_cb(int ok, int length, int 
record,
}
 }
 
+static void sim_csp_read_cb(int ok, int length, int record,
+   const unsigned char *data,
+   int record_length, void *user_data)
+{
+   struct ofono_netreg *netreg = user_data;
+   int i;
+
+   if (!ok)
+   return;
+
+   if (length  18 || record_length  18 || length  record_length)
+   return;
+
+   /*
+* Acording to CPHS 4.2, EFcsp is an array of two-byte service
+* entries, each consisting of a one byte service group
+* identifier followed by 8 bits; each bit is indicating
+* availability of a specific service or feature.
+*
+* The PLMN mode bit, if present, indicates whether manual
+* operator selection should be disabled or enabled. When
+* unset, the device is forced to automatic mode; when set,
+* manual selection is to be enabled. The latter is also the
+* default.
+*/
+   for (i = 0; i  record_length / 2; i++) {
+   gboolean forced_auto;
+
+   if (data[i * 2] != SIM_CSP_ENTRY_VALUE_ADDED_SERVICES)
+   continue;
+
+   forced_auto = (data[i * 2 + 1]  0x80) == 0;
+
+   set_registration_forced_auto(netreg, forced_auto);
+   }
+}
+
 int ofono_netreg_get_location(struct ofono_netreg *netreg)
 {
if (netreg == NULL)
@@ -1803,6 +1879,10 @@ static void netreg_load_settings(struct ofono_netreg 
*netreg)
 
g_key_file_set_integer(netreg-settings, SETTINGS_GROUP,
Mode, netreg-mode);
+
+   netreg-forced_auto = g_key_file_get_boolean(netreg-settings,
+   SETTINGS_GROUP,
+   ForcedAuto, NULL);
 }
 
 void ofono_netreg_register(struct ofono_netreg *netreg)
@@ -1845,6 +1925,9 @@ void ofono_netreg_register(struct ofono_netreg *netreg)
ofono_sim_read(netreg-sim, SIM_EFSPN_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,

[PATCH 4/5] doc: Add short mention of CPHS under standards

2011-01-18 Thread Aki Niemi
---
 doc/standards.txt |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/doc/standards.txt b/doc/standards.txt
index 2b85cb0..35f2a3a 100644
--- a/doc/standards.txt
+++ b/doc/standards.txt
@@ -166,3 +166,12 @@ Describes the general background and assumption of 
wireless features.
Capability: Network Perspective
 - S.R0006-808: Wireless Features Description: Circuit Switched Call Precedence 
Over
CDMA Packet Data Session
+
+Common PCN Handset Specification (CPHS)
+===
+
+This specification includes certain pre-standard extensions to GSM
+standards. oFono implements some of the features found in the Phase 2
+specification, version 4.2.
+
+The specification itself is not publicly available.
-- 
1.7.1

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


  1   2   3   >