Re: [PATCH 3/9] sim: Watch for changes to relevant SIM files.

2011-02-18 Thread Andrzej Zaborowski
On 17 February 2011 22:08, Denis Kenzior  wrote:
> On 02/15/2011 01:58 AM, Andrzej Zaborowski wrote:
>> +             ofono_sim_remove_file_watch(sim->context, SIM_EFMSISDN_FILEID);
>> +             ofono_sim_remove_file_watch(sim->context, SIM_EFSDN_FILEID);
>> +             ofono_sim_remove_file_watch(sim->context, SIM_EFIMG_FILEID);
>> +
>
> So two problems here.  The file_watch id is not related to the file EF.
>  So this won't really work anyway.  It also sounds like we should be
> canceling the entire context (and thus the related file watches) instead
> of trying to cancel them one by one.

Oh right.  I read the commit where ofono_sim_add_file_watch and
ofono_sim_remove_file_watch were added but I didn't notice this change
from the earlier proposed api, where this would have worked.  I'll fix
that by using a second context.

>
> What do you think of using two separate sim contexts here?  Also, this
> might really belong in sim_free_main_state instead of this function.
>
>> +             if (sim->efimg == NULL)
>> +                     return;
>> +
>> +             for (i = sim->efimg_length / 9 - 1; i >= 0; i--) {
>> +                     iidf_id = (sim->efimg[i * 9 + 3] << 8) |
>> +                             sim->efimg[i * 9 + 4];
>> +
>> +                     ofono_sim_remove_file_watch(sim->context, iidf_id);
>> +             }
>>
>> -     if (new_state != OFONO_SIM_STATE_READY)
>>               return;
>> +     }
>>
>>       sim_own_numbers_update(sim);
>> +     ofono_sim_add_file_watch(sim->context, SIM_EFMSISDN_FILEID,
>> +                                     sim_own_numbers_changed, sim, NULL);
>>
>>       ofono_sim_read(sim->context, SIM_EFSDN_FILEID,
>>                       OFONO_SIM_FILE_STRUCTURE_FIXED, sim_sdn_read_cb, sim);
>> +     ofono_sim_add_file_watch(sim->context, SIM_EFSDN_FILEID,
>> +                                     sim_service_numbers_changed, sim, 
>> NULL);
>> +
>>       ofono_sim_read(sim->context, SIM_EFIMG_FILEID,
>>                       OFONO_SIM_FILE_STRUCTURE_FIXED, sim_efimg_read_cb, 
>> sim);
>> +     ofono_sim_add_file_watch(sim->context, SIM_EFIMG_FILEID,
>> +                                     sim_efimg_changed, sim, NULL);
>>  }
>>
>>  static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
>> @@ -1873,7 +1955,11 @@ skip_efpl:
>>                                               DBUS_TYPE_STRING,
>>                                               &sim->language_prefs);
>>
>> -     sim_pin_check(sim);
>> +     /* Proceed with sim initialization if we're not merely updating */
>> +     if (!sim->language_prefs_update)
>> +             sim_pin_check(sim);
>> +
>> +     sim->language_prefs_update = FALSE;
>>  }
>>
>>  static void sim_iccid_read_cb(int ok, int length, int record,
>> @@ -1899,6 +1985,43 @@ static void sim_iccid_read_cb(int ok, int length, int 
>> record,
>>                                               &sim->iccid);
>>  }
>>
>> +static void sim_iccid_changed(int id, void *userdata)
>> +{
>> +     struct ofono_sim *sim = userdata;
>> +
>> +     if (sim->iccid) {
>> +             g_free(sim->iccid);
>> +             sim->iccid = NULL;
>> +     }
>> +
>> +     ofono_sim_read(sim->context, SIM_EF_ICCID_FILEID,
>> +                     OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
>> +                     sim_iccid_read_cb, sim);
>> +}
>> +
>> +static void sim_efli_efpl_changed(int id, void *userdata)
>> +{
>> +     struct ofono_sim *sim = userdata;
>> +
>> +     if (sim->efli != NULL) /* This shouldn't happen */
>> +             return;
>> +
>> +     if (sim->language_prefs) {
>> +             g_strfreev(sim->language_prefs);
>> +             sim->language_prefs = NULL;
>> +     }
>> +
>> +     sim->language_prefs_update = TRUE;
>> +
>> +     ofono_sim_read(sim->context, SIM_EFLI_FILEID,
>> +                     OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
>> +                     sim_efli_read_cb, sim);
>> +
>> +     ofono_sim_read(sim->context, SIM_EFPL_FILEID,
>> +                     OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
>> +                     sim_efpl_read_cb, sim);
>> +}
>> +
>>  static void sim_initialize(struct ofono_sim *sim)
>>  {
>>       /*
>> @@ -1927,10 +2050,15 @@ static void sim_initialize(struct ofono_sim *sim)
>>        * in the EFust
>>        */
>>
>> +     if (sim->context == NULL)
>> +             sim->context = ofono_sim_context_create(sim);
>> +
>>       /* Grab the EFiccid which is always available */
>>       ofono_sim_read(sim->context, SIM_EF_ICCID_FILEID,
>>                       OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
>>                       sim_iccid_read_cb, sim);
>> +     ofono_sim_add_file_watch(sim->context, SIM_EF_ICCID_FILEID,
>> +                                     sim_iccid_changed, sim, NULL);
>>
>>       /* EFecc is read by the voicecall atom */
>>
>> @@ -1945,9 +2073,14 @@ static void sim_initialize(struct ofono_sim *sim)
>>       ofono_sim_read(sim->context, SIM_EFLI_FILEID,
>>                       OFONO

Re: [PATCH 2/9] sim: Implement basic Refresh.

2011-02-18 Thread Andrzej Zaborowski
Hi Denis,

On 17 February 2011 22:03, Denis Kenzior  wrote:
> On 02/15/2011 01:58 AM, Andrzej Zaborowski wrote:
>> ---
>>  src/ofono.h |    4 ++
>>  src/sim.c   |  163 
>> ++
>>  2 files changed, 155 insertions(+), 12 deletions(-)
>>
>
> Patch has been applied, but some comments below:
>
>> +     if (reinit_naa) {
>> +             /* Force the sim state out of READY */
>> +
>> +             sim_free_main_state(sim);
>> +
>> +             sim->state = OFONO_SIM_STATE_INSERTED;
>> +             for (l = sim->state_watches->items; l; l = l->next) {
>> +                     struct ofono_watchlist_item *item = l->data;
>> +                     notify = item->notify;
>> +
>> +                     notify(sim->state, item->notify_data);
>> +             }
>
> I changed this to directly call the modem object and force it into
> pre-sim state.  I think this is a bit more clear than your proposed
> approach.

Looks good to me, maybe it would be even better if this was just a
different type of sim state change, like OFONO_SIM_STATE_NOT_READY so
it is handled in a similar way as other events.

>
> Another question here is whether we want to maintain two separate simfs
> contexts.  One for the main state and one for the early state.  This
> might make things a bit easier to implement for patch 3 in this series.

I was thinking about that too, I'll send a patch to implement this.

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


Re: [PATCH] emulator: add dialing support

2011-02-18 Thread Denis Kenzior
Hi Gustavo,

On 02/18/2011 11:27 AM, Gustavo F. Padovan wrote:
> It handles client ATD*99# request and then initiate the PPP negotiation.
> IP forward through the new ppp interface is not done yet.
> 
> Initially based on patches from Zhenhua Zhang 
> ---
>  src/emulator.c |  121 
> 
>  1 files changed, 121 insertions(+), 0 deletions(-)
> 

Patch has been applied.  You had one minor whitespace issue (mixing tab
& spaces) which I had to amend.  Lets get this tested and stabilized,
particularly the socket disconnection conditions while in PPP.

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


Re: Modem "reboots" when trying to activate a ConnectionContext

2011-02-18 Thread Antoine Reversat
I removed the finale "+ 3" in both send_context_authenticate and
link_conf_cb in drivers/isimodem/gprs-context.c which would account
for filler bytes but they don't seem to be actually put int the
message. This works but I don't know if it is the right fix.

On Fri, Feb 18, 2011 at 1:45 PM, Antoine Reversat  wrote:
> If I'm not mistaken I might have found what's wrong : it seems the
> subblock length are wrong.
>
> Fro example in GPDS_CONTEXT_CONFIGURE_REQ the second subblock
> (GPDS_APN_INFO) contains a length of 0x16 which is 22 bytes. Except
> the length is 19 bytes. Is this right or am I missing something ? It
> is also the case for GPDS_CONTEXT_AUTH_REQ.
>
> On Fri, Feb 18, 2011 at 11:55 AM, Antoine Reversat  
> wrote:
>> This is on an N900 running nitdroid gingerbread with a 2.6.35.9 kernel
>> and ofono 0.42
>>
>> When I do this :
>>
>> dbus-send --system --print-reply --dest=org.ofono /isimodem/context2
>> org.ofono.ConnectionContext.SetProperty string:"Active"
>> variant:boolean:true
>> I get back : Error org.ofono.Error.Failed: Operation failed
>>
>> /isimodem/context2 is properly defined for my operator (Fido in canada).
>>
>> And here's the log ofono gives me :
>>
>> D/ofono   (  355):
>> external/ofono/drivers/isimodem/gprs-context.c:isi_gprs_activate_primary()
>> activate: gpds = 0x002c
>> D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x00 utid=0x01 len=12]:
>> D/ofono   (  355):     * 01 00 00 01 6C 42 04 00 00 2C 04 00
>>  : .lB...,..
>> D/Tethering(  435): gprs0 is not a tetherable iface, ignoring
>> D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x01 utid=0x01 len=6]:
>> D/ofono   (  355):     * 01 01 00 00 00 00
>>  : ...
>> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0xD9,
>> id=0x01, utid=0x01]
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_REQ [id=0x02
>> utid=0x05 len=2]:
>> D/ofono   (  355):     * 05 02                                           : 
>> ...
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_RESP
>> [id=0x03 utid=0x05 len=4]:
>> D/ofono   (  355):     * 05 03 00 01                                     : 
>> .
>> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
>> id=0x03, utid=0x05]
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_REQ [id=0x00
>> utid=0x06 len=5]:
>> D/ofono   (  355):     * 06 00 00 00 02
>>  : ..
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_IND [id=0x04
>> utid=0x00 len=3]:
>> D/ofono   (  355):     * 00 04 00                                        : 
>> 
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_RESP [id=0x01
>> utid=0x06 len=4]:
>> D/ofono   (  355):     * 06 01 00 01                                     : 
>> .
>> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0x31,
>> id=0x01, utid=0x06]
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_REQ [id=0x06
>> utid=0x07 len=31]:
>> D/ofono   (  355):     * 07 06 00 21 00 00 00 02 90 04 00 00 05 16 10
>> 69 : !...i
>> D/ofono   (  355):     * 6E 74 65 72 6E 65 74 2E 66 69 64 6F 2E 63 61
>>  : nternet.fido.ca
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_RESP
>> [id=0x07 utid=0x07 len=4]:
>> D/ofono   (  355):     * 07 07 00 01                                     : 
>> .
>> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
>> id=0x07, utid=0x07]
>> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_AUTH_REQ [id=0x33
>> utid=0x08 len=18]:
>> D/ofono   (  355):     * 08 33 00 02 0B 0A 04 66 69 64 6F 0C 0A 04 66
>> 69 : ..3.fido...fi
>> D/ofono   (  355):     * 64 6F                                           : do
>> D/ofono   (  355):
>> external/ofono/plugins/nokia-gpio.c:phonet_status_cb() Link phonet0
>> (3) is down
>> D/ofono   (  355):
>> external/ofono/plugins/nokia-gpio.c:gpio_power_state_machine()
>> (POWER_EVENT_PHONET_LINK_DOWN) @ state POWER_STATE_ON
>> D/ofono   (  355):
>> external/ofono/plugins/nokia-gpio.c:gpio_power_set_state()
>> (POWER_STATE_ON_RESET) at (POWER_STATE_ON)
>> D/ofono   (  355):
>> external/ofono/plugins/nokia-gpio.c:gpio_power_set_state() Starting
>> modem restart timeout
>> D/ofono   (  355): external/ofono/plugins/n900.c:n900_power_cb() power
>> state POWER_STATE_ON_RESET
>> D/ofono   (  355): external/ofono/plugins/n900.c:report_powered() Reset
>> D/ofono   (  355): external/ofono/src/modem.c:modem_change_state() old
>> state: 3, new state: 0
>>
>>
>> Any ideas or other debug information you need ?
>>
>
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: Modem "reboots" when trying to activate a ConnectionContext

2011-02-18 Thread Antoine Reversat
If I'm not mistaken I might have found what's wrong : it seems the
subblock length are wrong.

Fro example in GPDS_CONTEXT_CONFIGURE_REQ the second subblock
(GPDS_APN_INFO) contains a length of 0x16 which is 22 bytes. Except
the length is 19 bytes. Is this right or am I missing something ? It
is also the case for GPDS_CONTEXT_AUTH_REQ.

On Fri, Feb 18, 2011 at 11:55 AM, Antoine Reversat  wrote:
> This is on an N900 running nitdroid gingerbread with a 2.6.35.9 kernel
> and ofono 0.42
>
> When I do this :
>
> dbus-send --system --print-reply --dest=org.ofono /isimodem/context2
> org.ofono.ConnectionContext.SetProperty string:"Active"
> variant:boolean:true
> I get back : Error org.ofono.Error.Failed: Operation failed
>
> /isimodem/context2 is properly defined for my operator (Fido in canada).
>
> And here's the log ofono gives me :
>
> D/ofono   (  355):
> external/ofono/drivers/isimodem/gprs-context.c:isi_gprs_activate_primary()
> activate: gpds = 0x002c
> D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x00 utid=0x01 len=12]:
> D/ofono   (  355):     * 01 00 00 01 6C 42 04 00 00 2C 04 00
>  : .lB...,..
> D/Tethering(  435): gprs0 is not a tetherable iface, ignoring
> D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x01 utid=0x01 len=6]:
> D/ofono   (  355):     * 01 01 00 00 00 00
>  : ...
> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0xD9,
> id=0x01, utid=0x01]
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_REQ [id=0x02
> utid=0x05 len=2]:
> D/ofono   (  355):     * 05 02                                           : ...
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_RESP
> [id=0x03 utid=0x05 len=4]:
> D/ofono   (  355):     * 05 03 00 01                                     : 
> .
> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
> id=0x03, utid=0x05]
> D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_REQ [id=0x00
> utid=0x06 len=5]:
> D/ofono   (  355):     * 06 00 00 00 02
>  : ..
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_IND [id=0x04
> utid=0x00 len=3]:
> D/ofono   (  355):     * 00 04 00                                        : 
> 
> D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_RESP [id=0x01
> utid=0x06 len=4]:
> D/ofono   (  355):     * 06 01 00 01                                     : 
> .
> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0x31,
> id=0x01, utid=0x06]
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_REQ [id=0x06
> utid=0x07 len=31]:
> D/ofono   (  355):     * 07 06 00 21 00 00 00 02 90 04 00 00 05 16 10
> 69 : !...i
> D/ofono   (  355):     * 6E 74 65 72 6E 65 74 2E 66 69 64 6F 2E 63 61
>  : nternet.fido.ca
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_RESP
> [id=0x07 utid=0x07 len=4]:
> D/ofono   (  355):     * 07 07 00 01                                     : 
> .
> D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
> id=0x07, utid=0x07]
> D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_AUTH_REQ [id=0x33
> utid=0x08 len=18]:
> D/ofono   (  355):     * 08 33 00 02 0B 0A 04 66 69 64 6F 0C 0A 04 66
> 69 : ..3.fido...fi
> D/ofono   (  355):     * 64 6F                                           : do
> D/ofono   (  355):
> external/ofono/plugins/nokia-gpio.c:phonet_status_cb() Link phonet0
> (3) is down
> D/ofono   (  355):
> external/ofono/plugins/nokia-gpio.c:gpio_power_state_machine()
> (POWER_EVENT_PHONET_LINK_DOWN) @ state POWER_STATE_ON
> D/ofono   (  355):
> external/ofono/plugins/nokia-gpio.c:gpio_power_set_state()
> (POWER_STATE_ON_RESET) at (POWER_STATE_ON)
> D/ofono   (  355):
> external/ofono/plugins/nokia-gpio.c:gpio_power_set_state() Starting
> modem restart timeout
> D/ofono   (  355): external/ofono/plugins/n900.c:n900_power_cb() power
> state POWER_STATE_ON_RESET
> D/ofono   (  355): external/ofono/plugins/n900.c:report_powered() Reset
> D/ofono   (  355): external/ofono/src/modem.c:modem_change_state() old
> state: 3, new state: 0
>
>
> Any ideas or other debug information you need ?
>
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/2] ste: Add support for multiple pdp contexts.

2011-02-18 Thread Marcel Holtmann
Hi Marit,

> 
> Is this approach ok, and has anyone had the chance to look at these
> pathces? (this one plus [PATCH 2/2] stemodem: Add support for multiple
> pdp contexts)

it is fine with me. Just re-send them with the warning fixed.

Regards

Marcel



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


Re: [PATCH 2/2] stemodem: Add support for multiple pdp contexts.

2011-02-18 Thread Marcel Holtmann
Hi Marit,

> Redesigned, there will be only one contexts for each instance of
> the driver and only one CAIF interface, no longer need the list
> of caif devices.
> ---
>  drivers/stemodem/gprs-context.c |  273 
> ---
>  1 files changed, 57 insertions(+), 216 deletions(-)

it does not compile cleanly.

  CC drivers/stemodem/gprs-context.o
cc1: warnings being treated as errors
drivers/stemodem/gprs-context.c: In function ‘ste_gprs_context_probe’:
drivers/stemodem/gprs-context.c:382:20: error: cast from pointer to integer of 
different size

Regards

Marcel


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


Re: Problem with SIM lock states not showing correctly in Ofono API.

2011-02-18 Thread Denis Kenzior
Hi Jussi,

On 02/18/2011 01:56 AM, Jussi Kangas wrote:
> Hi,
> 
> I would like to get rid of this problem. It's been on TODO list since
> November. I haven't received any feedback about mail 
> 
> [RFC] sim: check if lock is locked after code changing attempt
> 
> I sent 4th of February. Could somebody check it? 
> 

I have pushed experimental patch
e8553f53376a33504dd18c4d7bb6d6f309973e0a to take care of this.  Let me
know if this works for you.

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


[PATCH] emulator: add dialing support

2011-02-18 Thread Gustavo F. Padovan
It handles client ATD*99# request and then initiate the PPP negotiation.
IP forward through the new ppp interface is not done yet.

Initially based on patches from Zhenhua Zhang 
---
 src/emulator.c |  121 
 1 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 101b33d..cb9e88f 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -29,11 +29,19 @@
 
 #include "ofono.h"
 #include "gatserver.h"
+#include "gatppp.h"
+
+#define DUN_SERVER_ADDRESS "192.168.1.1"
+#define DUN_PEER_ADDRESS   "192.168.1.2"
+#define DUN_DNS_SERVER_1   "10.10.10.10"
+#define DUN_DNS_SERVER_2   "10.10.10.11"
 
 struct ofono_emulator {
struct ofono_atom *atom;
enum ofono_emulator_type type;
GAtServer *server;
+   GAtPPP *ppp;
+   guint source;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -50,12 +58,122 @@ static void emulator_disconnect(gpointer user_data)
ofono_emulator_remove(em);
 }
 
+static void ppp_connect(const char *iface, const char *local,
+   const char *remote,
+   const char *dns1, const char *dns2,
+   gpointer user_data)
+{
+   DBG("Network Device: %s\n", iface);
+   DBG("IP Address: %s\n", local);
+   DBG("Remote IP Address: %s\n", remote);
+   DBG("Primary DNS Server: %s\n", dns1);
+   DBG("Secondary DNS Server: %s\n", dns2);
+}
+
+static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
+{
+   struct ofono_emulator *em = user_data;
+
+   DBG("");
+
+   g_at_ppp_unref(em->ppp);
+   em->ppp = NULL;
+
+   if (em->server == NULL)
+   return;
+
+   g_at_server_resume(em->server);
+}
+
+static gboolean setup_ppp(gpointer user_data)
+{
+   struct ofono_emulator *em = user_data;
+   GAtIO *io;
+
+   DBG("");
+
+   em->source = 0;
+
+   io = g_at_server_get_io(em->server);
+
+   g_at_server_suspend(em->server);
+
+   em->ppp = g_at_ppp_server_new_from_io(io, DUN_SERVER_ADDRESS);
+   if (em->ppp == NULL) {
+   g_at_server_resume(em->server);
+   return FALSE;
+   }
+
+   g_at_ppp_set_server_info(em->ppp, DUN_PEER_ADDRESS,
+   DUN_DNS_SERVER_1, DUN_DNS_SERVER_2);
+
+   g_at_ppp_set_credentials(em->ppp, "", "");
+   g_at_ppp_set_debug(em->ppp, emulator_debug, "PPP");
+
+   g_at_ppp_set_connect_function(em->ppp, ppp_connect, em);
+   g_at_ppp_set_disconnect_function(em->ppp, ppp_disconnect, em);
+
+   return FALSE;
+}
+
+static gboolean dial_call(struct ofono_emulator *em, const char *dial_str)
+{
+   char c = *dial_str;
+
+   DBG("dial call %s", dial_str);
+
+   if (c == '*' || c == '#' || c == 'T' || c == 't') {
+   g_at_server_send_intermediate(em->server, "CONNECT");
+   em->source = g_idle_add(setup_ppp, em);
+   }
+
+   return TRUE;
+}
+
+static void dial_cb(GAtServer *server, GAtServerRequestType type,
+GAtResult *result, gpointer user_data)
+{
+   struct ofono_emulator *em = user_data;
+   GAtResultIter iter;
+   const char *dial_str;
+
+   DBG("");
+
+   if (type != G_AT_SERVER_REQUEST_TYPE_SET)
+   goto error;
+
+   g_at_result_iter_init(&iter, result);
+
+   if (!g_at_result_iter_next(&iter, ""))
+   goto error;
+
+   dial_str = g_at_result_iter_raw_line(&iter);
+   if (!dial_str)
+   goto error;
+
+   if (em->ppp)
+   goto error;
+
+   if (!dial_call(em, dial_str))
+   goto error;
+
+   return;
+
+error:
+   g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
+}
+
 static void emulator_unregister(struct ofono_atom *atom)
 {
struct ofono_emulator *em = __ofono_atom_get_data(atom);
 
DBG("%p", em);
 
+   if (em->source) {
+   g_source_remove(em->source);
+   em->source = 0;
+   }
+
g_at_server_unref(em->server);
em->server = NULL;
 }
@@ -82,6 +200,9 @@ void ofono_emulator_register(struct ofono_emulator *em, int 
fd)
emulator_disconnect, em);
 
__ofono_atom_register(em->atom, emulator_unregister);
+
+   if (em->type == OFONO_EMULATOR_TYPE_DUN)
+   g_at_server_register(em->server, "D", dial_cb, em, NULL);
 }
 
 static void emulator_remove(struct ofono_atom *atom)
-- 
1.7.4

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


Modem "reboots" when trying to activate a ConnectionContext

2011-02-18 Thread Antoine Reversat
This is on an N900 running nitdroid gingerbread with a 2.6.35.9 kernel
and ofono 0.42

When I do this :

dbus-send --system --print-reply --dest=org.ofono /isimodem/context2
org.ofono.ConnectionContext.SetProperty string:"Active"
variant:boolean:true
I get back : Error org.ofono.Error.Failed: Operation failed

/isimodem/context2 is properly defined for my operator (Fido in canada).

And here's the log ofono gives me :

D/ofono   (  355):
external/ofono/drivers/isimodem/gprs-context.c:isi_gprs_activate_primary()
activate: gpds = 0x002c
D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x00 utid=0x01 len=12]:
D/ofono   (  355): * 01 00 00 01 6C 42 04 00 00 2C 04 00
  : .lB...,..
D/Tethering(  435): gprs0 is not a tetherable iface, ignoring
D/ofono   (  355): PN_ (0xD9): UNKNOWN [id=0x01 utid=0x01 len=6]:
D/ofono   (  355): * 01 01 00 00 00 00
  : ...
D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0xD9,
id=0x01, utid=0x01]
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_REQ [id=0x02
utid=0x05 len=2]:
D/ofono   (  355): * 05 02   : ...
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_RESP
[id=0x03 utid=0x05 len=4]:
D/ofono   (  355): * 05 03 00 01 : .
D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
id=0x03, utid=0x05]
D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_REQ [id=0x00
utid=0x06 len=5]:
D/ofono   (  355): * 06 00 00 00 02
  : ..
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_ID_CREATE_IND [id=0x04
utid=0x00 len=3]:
D/ofono   (  355): * 00 04 00: 
D/ofono   (  355): PN_GPDS (0x31): GPDS_LL_CONFIGURE_RESP [id=0x01
utid=0x06 len=4]:
D/ofono   (  355): * 06 01 00 01 : .
D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x54af8 [res=0x31,
id=0x01, utid=0x06]
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_REQ [id=0x06
utid=0x07 len=31]:
D/ofono   (  355): * 07 06 00 21 00 00 00 02 90 04 00 00 05 16 10
69 : !...i
D/ofono   (  355): * 6E 74 65 72 6E 65 74 2E 66 69 64 6F 2E 63 61
  : nternet.fido.ca
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_CONFIGURE_RESP
[id=0x07 utid=0x07 len=4]:
D/ofono   (  355): * 07 07 00 01 : .
D/ofono   (  355): gisi: Unknown error: 0 RESP to 0x521b8 [res=0x31,
id=0x07, utid=0x07]
D/ofono   (  355): PN_GPDS (0x31): GPDS_CONTEXT_AUTH_REQ [id=0x33
utid=0x08 len=18]:
D/ofono   (  355): * 08 33 00 02 0B 0A 04 66 69 64 6F 0C 0A 04 66
69 : ..3.fido...fi
D/ofono   (  355): * 64 6F   : do
D/ofono   (  355):
external/ofono/plugins/nokia-gpio.c:phonet_status_cb() Link phonet0
(3) is down
D/ofono   (  355):
external/ofono/plugins/nokia-gpio.c:gpio_power_state_machine()
(POWER_EVENT_PHONET_LINK_DOWN) @ state POWER_STATE_ON
D/ofono   (  355):
external/ofono/plugins/nokia-gpio.c:gpio_power_set_state()
(POWER_STATE_ON_RESET) at (POWER_STATE_ON)
D/ofono   (  355):
external/ofono/plugins/nokia-gpio.c:gpio_power_set_state() Starting
modem restart timeout
D/ofono   (  355): external/ofono/plugins/n900.c:n900_power_cb() power
state POWER_STATE_ON_RESET
D/ofono   (  355): external/ofono/plugins/n900.c:report_powered() Reset
D/ofono   (  355): external/ofono/src/modem.c:modem_change_state() old
state: 3, new state: 0


Any ideas or other debug information you need ?
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/4] emulator: add network signal support for HFP

2011-02-18 Thread Frédéric Danis
---
 src/emulator.c |   37 +++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index d8cd32f..6835f96 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -38,8 +38,10 @@ struct ofono_emulator {
struct ofono_netreg *netreg;
unsigned int netreg_watch;
unsigned int status_watch;
+   unsigned int strength_watch;
gboolean net_registered;
gboolean roaming;
+   int strength;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -84,12 +86,29 @@ static void net_status_changed(int status, int lac, int ci, 
int tech,
}
 }
 
+static void net_strength_changed(int signal_strength, void *data)
+{
+   struct ofono_emulator *em = data;
+   int old_strength = em->strength;
+   char buf[20];
+
+   DBG("%d", signal_strength);
+
+   em->strength = (signal_strength + 20) / 21;
+
+   if (em->strength != old_strength) {
+   sprintf(buf, "+CIEV: 5,%d", em->strength);
+   g_at_server_send_info(em->server, buf, TRUE);
+   }
+}
+
 static void netreg_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
 {
struct ofono_emulator *em = data;
int status;
+   int strength;
 
DBG("%p %sregistered", atom, cond ? "un" : "");
 
@@ -98,6 +117,9 @@ static void netreg_watch(struct ofono_atom *atom,
net_status_changed(NETWORK_REGISTRATION_STATUS_NOT_REGISTERED,
0, 0, 0, NULL, NULL, em);
 
+   em->strength_watch = 0;
+   net_strength_changed(0, em);
+
em->netreg = NULL;
 
return;
@@ -110,6 +132,13 @@ static void netreg_watch(struct ofono_atom *atom,
 
em->status_watch = __ofono_netreg_add_status_watch(em->netreg,
net_status_changed, em, NULL);
+
+   strength = ofono_netreg_get_strength(em->netreg);
+   net_strength_changed(strength, em);
+
+   em->strength_watch = __ofono_netreg_add_strength_watch(em->netreg,
+   net_strength_changed, em, NULL);
+
 }
 
 static void cind_cb(GAtServer *server, GAtServerRequestType type,
@@ -120,8 +149,8 @@ static void cind_cb(GAtServer *server, GAtServerRequestType 
type,
 
switch (type) {
case G_AT_SERVER_REQUEST_TYPE_QUERY:
-   sprintf(buf, "+CIND: %d,0,0,0,0,%d,0", em->net_registered,
-   em->roaming);
+   sprintf(buf, "+CIND: %d,0,0,0,%d,%d,0", em->net_registered,
+   em->strength, em->roaming);
g_at_server_send_info(em->server, buf, FALSE);
g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
break;
@@ -161,6 +190,10 @@ static void emulator_unregister(struct ofono_atom *atom)
__ofono_netreg_remove_status_watch(em->netreg,
em->status_watch);
 
+   if (em->strength_watch)
+   __ofono_netreg_remove_strength_watch(em->netreg,
+   em->strength_watch);
+
modem = __ofono_atom_get_modem(em->atom);
__ofono_modem_remove_atom_watch(modem, em->netreg_watch);
}
-- 
1.7.1

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


[PATCH 3/4] netreg: add support for signal strength get and watch APIs

2011-02-18 Thread Frédéric Danis
---
 src/network.c |   61 +
 src/ofono.h   |   10 +
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/network.c b/src/network.c
index c059906..4a0e984 100644
--- a/src/network.c
+++ b/src/network.c
@@ -79,6 +79,7 @@ struct ofono_netreg {
GKeyFile *settings;
char *imsi;
struct ofono_watchlist *status_watches;
+   struct ofono_watchlist *strength_watches;
const struct ofono_netreg_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -1159,6 +1160,51 @@ static void notify_status_watches(struct ofono_netreg 
*netreg)
}
 }
 
+unsigned int __ofono_netreg_add_strength_watch(struct ofono_netreg *netreg,
+   ofono_netreg_strength_notify_cb_t notify,
+   void *data, ofono_destroy_func destroy)
+{
+   struct ofono_watchlist_item *item;
+
+   DBG("%p", netreg);
+
+   if (netreg == NULL)
+   return 0;
+
+   if (notify == NULL)
+   return 0;
+
+   item = g_new0(struct ofono_watchlist_item, 1);
+
+   item->notify = notify;
+   item->destroy = destroy;
+   item->notify_data = data;
+
+   return __ofono_watchlist_add_item(netreg->strength_watches, item);
+}
+
+gboolean __ofono_netreg_remove_strength_watch(struct ofono_netreg *netreg,
+   unsigned int id)
+{
+   DBG("%p", netreg);
+
+   return __ofono_watchlist_remove_item(netreg->strength_watches, id);
+}
+
+static void notify_strength_watches(struct ofono_netreg *netreg)
+{
+   struct ofono_watchlist_item *item;
+   GSList *l;
+   ofono_netreg_strength_notify_cb_t notify;
+
+   for (l = netreg->strength_watches->items; l; l = l->next) {
+   item = l->data;
+   notify = item->notify;
+
+   notify(netreg->signal_strength, item->notify_data);
+   }
+}
+
 static void reset_available(struct network_operator_data *old,
const struct ofono_network_operator *new)
 {
@@ -1400,6 +1446,8 @@ void ofono_netreg_strength_notify(struct ofono_netreg 
*netreg, int strength)
OFONO_NETWORK_REGISTRATION_INTERFACE,
"Strength", DBUS_TYPE_BYTE,
&strength);
+
+   notify_strength_watches(netreg);
}
 }
 
@@ -1599,6 +1647,14 @@ int ofono_netreg_get_status(struct ofono_netreg *netreg)
return netreg->status;
 }
 
+int ofono_netreg_get_strength(struct ofono_netreg *netreg)
+{
+   if (netreg == NULL)
+   return -1;
+
+   return netreg->signal_strength;
+}
+
 int ofono_netreg_get_technology(struct ofono_netreg *netreg)
 {
if (netreg == NULL)
@@ -1659,6 +1715,9 @@ static void netreg_unregister(struct ofono_atom *atom)
__ofono_watchlist_free(netreg->status_watches);
netreg->status_watches = NULL;
 
+   __ofono_watchlist_free(netreg->strength_watches);
+   netreg->strength_watches = NULL;
+
for (l = netreg->operator_list; l; l = l->next) {
struct network_operator_data *opd = l->data;
 
@@ -1857,6 +1916,8 @@ void ofono_netreg_register(struct ofono_netreg *netreg)
 
netreg->status_watches = __ofono_watchlist_new(g_free);
 
+   netreg->strength_watches = __ofono_watchlist_new(g_free);
+
ofono_modem_add_interface(modem, OFONO_NETWORK_REGISTRATION_INTERFACE);
 
if (netreg->driver->registration_status != NULL)
diff --git a/src/ofono.h b/src/ofono.h
index 14dcd18..f82f447 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -404,6 +404,16 @@ unsigned int __ofono_netreg_add_status_watch(struct 
ofono_netreg *netreg,
 gboolean __ofono_netreg_remove_status_watch(struct ofono_netreg *netreg,
unsigned int id);
 
+typedef void (*ofono_netreg_strength_notify_cb_t)(int signal_strength,
+   void *data);
+
+unsigned int __ofono_netreg_add_strength_watch(struct ofono_netreg *netreg,
+   ofono_netreg_strength_notify_cb_t cb,
+   void *data, ofono_destroy_func destroy);
+
+gboolean __ofono_netreg_remove_strength_watch(struct ofono_netreg *netreg,
+   unsigned int id);
+
 void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
const char *name);
 
-- 
1.7.1

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


[PATCH 2/4] netreg: add get signal strength API

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

diff --git a/include/netreg.h b/include/netreg.h
index 26a3442..871fe6d 100644
--- a/include/netreg.h
+++ b/include/netreg.h
@@ -111,6 +111,7 @@ void *ofono_netreg_get_data(struct ofono_netreg *netreg);
 int ofono_netreg_get_location(struct ofono_netreg *netreg);
 int ofono_netreg_get_cellid(struct ofono_netreg *netreg);
 int ofono_netreg_get_status(struct ofono_netreg *netreg);
+int ofono_netreg_get_strength(struct ofono_netreg *netreg);
 int ofono_netreg_get_technology(struct ofono_netreg *netreg);
 const char *ofono_netreg_get_mcc(struct ofono_netreg *netreg);
 const char *ofono_netreg_get_mnc(struct ofono_netreg *netreg);
-- 
1.7.1

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


[PATCH 1/4] emulator: add network info support for HFP

2011-02-18 Thread Frédéric Danis
Add CIND and CIEV support related to network info
---
 src/emulator.c |  129 
 1 files changed, 129 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 101b33d..d8cd32f 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -28,12 +28,18 @@
 #include 
 
 #include "ofono.h"
+#include "common.h"
 #include "gatserver.h"
 
 struct ofono_emulator {
struct ofono_atom *atom;
enum ofono_emulator_type type;
GAtServer *server;
+   struct ofono_netreg *netreg;
+   unsigned int netreg_watch;
+   unsigned int status_watch;
+   gboolean net_registered;
+   gboolean roaming;
 };
 
 static void emulator_debug(const char *str, void *data)
@@ -41,6 +47,99 @@ static void emulator_debug(const char *str, void *data)
ofono_info("%s: %s\n", (char *)data, str);
 }
 
+static void net_status_changed(int status, int lac, int ci, int tech,
+   const char *mcc, const char *mnc,
+   void *data)
+{
+   struct ofono_emulator *em = data;
+   gboolean old_registered = em->net_registered;
+   gboolean old_roaming = em->roaming;
+   char buf[20];
+
+   DBG("%d", status);
+
+   switch (status) {
+   case NETWORK_REGISTRATION_STATUS_REGISTERED:
+   em->net_registered = 1;
+   em->roaming = 0;
+   break;
+   case NETWORK_REGISTRATION_STATUS_ROAMING:
+   em->net_registered = 1;
+   em->roaming = 1;
+   break;
+   default:
+   em->net_registered = 0;
+   em->roaming = 0;
+   break;
+   }
+
+   if (em->net_registered != old_registered) {
+   sprintf(buf, "+CIEV: 1,%d", em->net_registered);
+   g_at_server_send_info(em->server, buf, TRUE);
+   }
+
+   if (em->roaming != old_roaming) {
+   sprintf(buf, "+CIEV: 6,%d", em->roaming);
+   g_at_server_send_info(em->server, buf, TRUE);
+   }
+}
+
+static void netreg_watch(struct ofono_atom *atom,
+   enum ofono_atom_watch_condition cond,
+   void *data)
+{
+   struct ofono_emulator *em = data;
+   int status;
+
+   DBG("%p %sregistered", atom, cond ? "un" : "");
+
+   if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+   em->status_watch = 0;
+   net_status_changed(NETWORK_REGISTRATION_STATUS_NOT_REGISTERED,
+   0, 0, 0, NULL, NULL, em);
+
+   em->netreg = NULL;
+
+   return;
+   }
+
+   em->netreg = __ofono_atom_get_data(atom);
+
+   status = ofono_netreg_get_status(em->netreg);
+   net_status_changed(status, 0, 0, 0, NULL, NULL, em);
+
+   em->status_watch = __ofono_netreg_add_status_watch(em->netreg,
+   net_status_changed, em, NULL);
+}
+
+static void cind_cb(GAtServer *server, GAtServerRequestType type,
+   GAtResult *result, gpointer user_data)
+{
+   struct ofono_emulator *em = user_data;
+   char buf[30];
+
+   switch (type) {
+   case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   sprintf(buf, "+CIND: %d,0,0,0,0,%d,0", em->net_registered,
+   em->roaming);
+   g_at_server_send_info(em->server, buf, FALSE);
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+   break;
+
+   case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+   g_at_server_send_info(server, "+CIND: (\"service\",(0,1)),"
+   "(\"call\",(0,1)),(\"callsetup\",(0-3)),"
+   "(\"callheld\",(0-2)),(\"signal\",(0-5)),"
+   "(\"roam\",(0,1)),(\"battchg\",(0-5))", FALSE);
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+   break;
+
+   default:
+   g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+   break;
+   }
+}
+
 static void emulator_disconnect(gpointer user_data)
 {
struct ofono_emulator *em = user_data;
@@ -53,9 +152,19 @@ static void emulator_disconnect(gpointer user_data)
 static void emulator_unregister(struct ofono_atom *atom)
 {
struct ofono_emulator *em = __ofono_atom_get_data(atom);
+   struct ofono_modem *modem;
 
DBG("%p", em);
 
+   if (em->netreg) {
+   if (em->status_watch)
+   __ofono_netreg_remove_status_watch(em->netreg,
+   em->status_watch);
+
+   modem = __ofono_atom_get_modem(em->atom);
+   __ofono_modem_remove_atom_watch(modem, em->netreg_watch);
+   }
+
g_at_server_unref(em->server);
em->server = NULL;
 }
@@ -63,6 +172,8 @@ static void emulator_unregister(

[PATCH 0/4] bluetooth: add CIND and CIEV support for HFP AG

2011-02-18 Thread Frédéric Danis
Add signal strength APIs in netreg atom
Add CIND and CIEV support in emulator atom for service,
roaming and signal indicators

Frédéric Danis (4):
  emulator: add network info support for HFP
  netreg: add get signal strength API
  netreg: add support for signal strength get and watch APIs
  emulator: add network signal support for HFP

 include/netreg.h |1 +
 src/emulator.c   |  162 ++
 src/network.c|   61 
 src/ofono.h  |   10 +++
 4 files changed, 234 insertions(+), 0 deletions(-)

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


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

2011-02-18 Thread Aki Niemi
Hi,

2011/2/15 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  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 1/2] ste: Add support for multiple pdp contexts.

2011-02-18 Thread Marit Sofie Henriksen
2011/2/9 Marit Sofie Henriksen 

>
>
> 2011/2/8 Marcel Holtmann 
>
> Hi Marit,
>>
>> > diff --git a/plugins/ste.c b/plugins/ste.c
>> > index cf8aed8..749c4f3 100644
>> > --- a/plugins/ste.c
>> > +++ b/plugins/ste.c
>> > @@ -66,6 +66,7 @@
>> >  #include 
>> >
>> >  #define NUM_CHAT 1
>> > +#define MAX_PDP_CONTEXTS 4
>> >
>> >  static const char *cpin_prefix[] = { "+CPIN:", NULL };
>> >
>> > @@ -363,6 +364,7 @@ static void ste_post_online(struct ofono_modem
>> *modem)
>> >   struct ofono_message_waiting *mw;
>> >   struct ofono_gprs *gprs;
>> >   struct ofono_gprs_context *gc;
>> > + int i;
>> >
>> >   DBG("%p", modem);
>> >
>> > @@ -378,13 +380,18 @@ static void ste_post_online(struct ofono_modem
>> *modem)
>> >
>> >   gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
>> >   "atmodem", data->chat);
>> > - gc = ofono_gprs_context_create(modem, 0, "stemodem", data->chat);
>> > -
>> > - if (gprs && gc)
>> > - ofono_gprs_add_context(gprs, gc);
>> > + if (gprs) {
>> > + for (i = 0; i < MAX_PDP_CONTEXTS; i++) {
>> > + gc = ofono_gprs_context_create(
>> > + modem, 0, "stemodem", data->chat);
>> > + if (gc == NULL)
>> > + break;
>> > +
>> > + ofono_gprs_add_context(gprs, gc);
>> > + }
>> > + }
>>
>> you do not need to create the GPRS context atom multiple times. You can
>> just add the gc multiple times.
>>
>> So I just wanna make sure that you guys wanna have multiple GPRS context
>> atom instances. For things like PPP and RawIP we have no other choice,
>> but for example ISI is a bit more flexible here. That is the reason why
>> we do allow it. Maybe CAIF is as flexible.
>>
>> It is a bit question about resources that are used. I am fine either
>> way, but I need you to at least think about it ;)
>>
>> Regards
>>
>> Marcel
>>
>>
> Hi Marcel,
> Thanks for your input. We have given this some more thought and discussed
> amongst us, and we would like to go for the solution as it is, adding
> multiple GPRS context atom instances. I hope this is OK with you.
>
> In the driver our internal gprs_context_data is associated with the
> ofono_gprs_context. If we were to have only one gc, we would have to handle
> all the activations with the same gprs_context_data, and that would bring us
> back to where we were, with a significantly more complex implementation.
>
> Br Marit
>

Hi.
Is this approach ok, and has anyone had the chance to look at these pathces?
(this one plus [PATCH 2/2] stemodem: Add support for multiple pdp contexts)

br Marit




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


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

2011-02-18 Thread Aki Niemi
Hi Andreas,

2011/2/15 Andreas Westin :
> From: Jessica Nilsson 
>
> ---
>  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",
> +                   

Problem with SIM lock states not showing correctly in Ofono API.

2011-02-18 Thread Jussi Kangas
Hi,

I would like to get rid of this problem. It's been on TODO list since
November. I haven't received any feedback about mail 

[RFC] sim: check if lock is locked after code changing attempt

I sent 4th of February. Could somebody check it? 

Br,
-Jussi

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