Re: [PATCH 1/2] gprs:Add code to handle AT+CGDCONT

2011-02-16 Thread Olivier Guiter

Hi Denis and Marcel,


Hi Denis,


---
  include/gprs.h |2 +
  src/gprs.c |   63 
  2 files changed, 65 insertions(+), 0 deletions(-)

So I went in a slightly different direction with the emulator API.  Can
you please have a look?

Also, I'd really rather hold off trying to implement CGDCONT right now.
  That piece is quite nasty and generally of lower priority.  I'd like to
get the emulator a bit more hashed out first and implement the base BT
DUN  BT HFP profiles.

for the sake of testing, I would be fine with the real basic CGDCONT and
just offering IP and CID 1. And then of course accepting any APN in that
range and rejecting any other command.
The submitted code is just an how-to, and need to be updated to 
implement the complete CGDCONT (up to now, the function displays the 
existings contexts, and the default range values.
The idea behind this code was to provide the complete chain to handle AT 
commands in atoms. I m not sure the current handler mechanism fit with 
Denis's view ;)

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


[PATCH] test: fix parameter type error in 'test-advice-of-charge'-script

2011-02-16 Thread Paavo Leinonen
---
 test/test-advice-of-charge |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/test-advice-of-charge b/test/test-advice-of-charge
index d71b7c6..9f3f655 100755
--- a/test/test-advice-of-charge
+++ b/test/test-advice-of-charge
@@ -73,7 +73,7 @@ if __name__ == __main__:
else:
try:
if property == 'AccumulatedCallMeterMaximum':
-   newvalue = int(newvalue)
+   newvalue = dbus.UInt32(newvalue)
elif property == 'PricePerUnit':
newvalue = float(newvalue)
cm.SetProperty(property, newvalue, pin)
-- 
1.7.1

___
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 Andreas WESTIN

Hi Aki,

On 2011-02-16 12:16, Aki Niemi wrote:

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. ;)


Yes you're right :)


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.


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 ?


Regards
Andreas

___
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


[PATCH 1/1] src: out of bounds problem in smsutil

2011-02-16 Thread Jessica Nilsson
---

This one was exposed when wgmodem2.5 CBS was run with valgrind.

Best Regards,
Jessica Nilsson

 src/smsutil.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 5524932..b3a1ba1 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -4628,7 +4628,7 @@ char *cbs_topic_ranges_to_string(GSList *ranges)
}
 
/* Space for ranges, commas and terminator null */
-   ret = g_new(char, len + nelem);
+   ret = g_new0(char, len + nelem + 1);
 
len = 0;
 
-- 
1.7.3.5

___
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 16/18] isimodem: sms updated with wgmodem2.5

2011-02-16 Thread Andreas WESTIN

Hi,

On 2011-02-16 15:22, Aki Niemi wrote:

Hi,

2011/2/15 Andreas Westinandreas.wes...@stericsson.com:

From: Jessica Nilssonjessica.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.


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





@@ -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.


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 ?


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


Re: [PATCH 1/1] src: out of bounds problem in smsutil

2011-02-16 Thread Denis Kenzior
Hi Jessica,

On 02/16/2011 06:04 AM, Jessica Nilsson wrote:
 ---
 
 This one was exposed when wgmodem2.5 CBS was run with valgrind.
 
 Best Regards,
 Jessica Nilsson
 

Can you post the actual error and the data this happened on?

  src/smsutil.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/src/smsutil.c b/src/smsutil.c
 index 5524932..b3a1ba1 100644
 --- a/src/smsutil.c
 +++ b/src/smsutil.c
 @@ -4628,7 +4628,7 @@ char *cbs_topic_ranges_to_string(GSList *ranges)
   }
  
   /* Space for ranges, commas and terminator null */
 - ret = g_new(char, len + nelem);
 + ret = g_new0(char, len + nelem + 1);

I'm having trouble seeing how the old code was wrong.  nelem contains
the number of elements.  Since the last element does not end with a
comma, the use of nelem + 1 in g_new is not necessary.  sprintf takes
care of adding the terminating null, so using g_new0 is also less efficient.

Are you adding channels that are 5 digits long by any chance?

  
   len = 0;
  

Regards,
-Denis
___
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 Andreas WESTIN



On 2011-02-16 15:26, Aki Niemi wrote:

Hi,

2011/2/15 Andreas Westinandreas.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.



Yes this should not be there, but maybe I misunderstood you regarding 
the version handling. I was under the impression that we checked the 
version we get from doing PN_MTC or PN_MODEM_MCE ?


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


Re: [PATCH] plugins/ofono.rules: add ID for Sierra Wireless MC8790

2011-02-16 Thread Denis Kenzior
Hi Jan,

On 02/16/2011 09:34 AM, Jan Luebbe wrote:
 ---
  plugins/ofono.rules |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH 1/1] src: out of bounds problem in smsutil

2011-02-16 Thread Andreas WESTIN



On 2011-02-16 16:25, Denis Kenzior wrote:

Hi Jessica,

On 02/16/2011 06:04 AM, Jessica Nilsson wrote:

---

This one was exposed when wgmodem2.5 CBS was run with valgrind.

Best Regards,
Jessica Nilsson



Can you post the actual error and the data this happened on?


  src/smsutil.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 5524932..b3a1ba1 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -4628,7 +4628,7 @@ char *cbs_topic_ranges_to_string(GSList *ranges)
}

/* Space for ranges, commas and terminator null */
-   ret = g_new(char, len + nelem);
+   ret = g_new0(char, len + nelem + 1);


I'm having trouble seeing how the old code was wrong.  nelem contains
the number of elements.  Since the last element does not end with a
comma, the use of nelem + 1 in g_new is not necessary.  sprintf takes
care of adding the terminating null, so using g_new0 is also less efficient.

Are you adding channels that are 5 digits long by any chance?


Valgrind complains that we step outside the allocated memory by 1 byte 
since we loop the string with:


while (*topics != '\0')

the allocated memory is the size of the string and any \0 ends up 
outside. At least that's my interpretation.


I saw it in isimodem/cbs.c in the patches sent in.

This is the output from valgrind:


==2450== Invalid read of size 1
==2450==at 0x3427C: get_topics_len (cbs.c:112)
==2450==by 0x347CF: isi_set_topics (cbs.c:223)
==2450==by 0xE6343: cbs_set_powered (cbs.c:466)
==2450==by 0xE6E4B: cbs_got_file_contents (cbs.c:752)
==2450==by 0xE74BF: sim_cbmid_read_cb (cbs.c:889)
==2450==by 0x103017: sim_fs_op_read_block_cb (simfs.c:388)
==2450==by 0x375C3: isi_read_file_transparent_resp (sim.c:1013)
==2450==by 0x19B5B: pending_remove_and_dispatch (modem.c:171)
==2450==by 0x19C87: service_dispatch (modem.c:218)
==2450==by 0x1A0D7: isi_callback (modem.c:334)
==2450==by 0x48D1A4B: g_io_unix_dispatch (giounix.c:162)
==2450==by 0x4898117: g_main_context_dispatch (gmain.c:1960)
==2450==  Address 0x4c031b2 is 0 bytes after a block of size 10 alloc'd
==2450==at 0x4833F58: malloc (vg_replace_malloc.c:236)
==2450==by 0x48D614F: g_malloc (gmem.c:132)
==2450==by 0xCE887: cbs_topic_ranges_to_string (smsutil.c:4631)
==2450==by 0xE5DC7: cbs_topics_to_str (cbs.c:329)
==2450==by 0xE631F: cbs_set_powered (cbs.c:465)
==2450==by 0xE6E4B: cbs_got_file_contents (cbs.c:752)
==2450==by 0xE74BF: sim_cbmid_read_cb (cbs.c:889)
==2450==by 0x103017: sim_fs_op_read_block_cb (simfs.c:388)
==2450==by 0x375C3: isi_read_file_transparent_resp (sim.c:1013)
==2450==by 0x19B5B: pending_remove_and_dispatch (modem.c:171)
==2450==by 0x19C87: service_dispatch (modem.c:218)
==2450==by 0x1A0D7: isi_callback (modem.c:334)
==2450==
==2450== Invalid read of size 1
==2450==at 0x34588: parse_topics (cbs.c:153)
==2450==by 0x34957: isi_set_topics (cbs.c:257)
==2450==by 0xE6343: cbs_set_powered (cbs.c:466)
==2450==by 0xE6E4B: cbs_got_file_contents (cbs.c:752)
==2450==by 0xE74BF: sim_cbmid_read_cb (cbs.c:889)
==2450==by 0x103017: sim_fs_op_read_block_cb (simfs.c:388)
==2450==by 0x375C3: isi_read_file_transparent_resp (sim.c:1013)
==2450==by 0x19B5B: pending_remove_and_dispatch (modem.c:171)
==2450==by 0x19C87: service_dispatch (modem.c:218)
==2450==by 0x1A0D7: isi_callback (modem.c:334)
==2450==by 0x48D1A4B: g_io_unix_dispatch (giounix.c:162)
==2450==by 0x4898117: g_main_context_dispatch (gmain.c:1960)
==2450==  Address 0x4c031b2 is 0 bytes after a block of size 10 alloc'd
==2450==at 0x4833F58: malloc (vg_replace_malloc.c:236)
==2450==by 0x48D614F: g_malloc (gmem.c:132)
==2450==by 0xCE887: cbs_topic_ranges_to_string (smsutil.c:4631)
==2450==by 0xE5DC7: cbs_topics_to_str (cbs.c:329)
==2450==by 0xE631F: cbs_set_powered (cbs.c:465)
==2450==by 0xE6E4B: cbs_got_file_contents (cbs.c:752)
==2450==by 0xE74BF: sim_cbmid_read_cb (cbs.c:889)
==2450==by 0x103017: sim_fs_op_read_block_cb (simfs.c:388)
==2450==by 0x375C3: isi_read_file_transparent_resp (sim.c:1013)
==2450==by 0x19B5B: pending_remove_and_dispatch (modem.c:171)
==2450==by 0x19C87: service_dispatch (modem.c:218)
==2450==by 0x1A0D7: isi_callback (modem.c:334)

Regards
Andreas

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


Re: [PATCH 1/1] src: out of bounds problem in smsutil

2011-02-16 Thread Denis Kenzior
Hi Andreas,

   }

   /* Space for ranges, commas and terminator null */
 -ret = g_new(char, len + nelem);
 +ret = g_new0(char, len + nelem + 1);

 I'm having trouble seeing how the old code was wrong.  nelem contains
 the number of elements.  Since the last element does not end with a
 comma, the use of nelem + 1 in g_new is not necessary.  sprintf takes
 care of adding the terminating null, so using g_new0 is also less
 efficient.

 Are you adding channels that are 5 digits long by any chance?
 
 Valgrind complains that we step outside the allocated memory by 1 byte
 since we loop the string with:
 
 while (*topics != '\0')
 
 the allocated memory is the size of the string and any \0 ends up
 outside. At least that's my interpretation.
 

It might be your loop is actually going past the end, not that the
terminating NULL is not within bounds returned from
cbs_topic_ranges_to_string.  If the original code was wrong then we
should be seeing valgrind report errors on the cbs code used in
unit/test-sms.c.  I'm not seeing this at all.

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


Re: [PATCH 17/18] isimodem: CBS for wgmodem2.5

2011-02-16 Thread Denis Kenzior
Hi Andreas,

 +static void reset_buf(char *buf, char *buf_2, int buf_len)
 +{
 + memset(buf, '\0', buf_len);
 + memset(buf_2, '\0', buf_len);
 +}
 +
 +static int get_topics_len(const char *topics)
 +{
 + int i = 0;
 + int k = 0;
 + int length = 0;
 + char buf[6];
 + char buf_2[6];
 +
 + reset_buf(buf, buf_2, 6);
 +
 + while (*topics != '\0') {
 + if (*topics == ',') {
 + reset_buf(buf, buf_2, 6);
 + k = 0;
 + length++;
 + } else if (*topics != ','  *topics != '-') {
 + buf[k] = *topics;
 + k++;
 + } else if (*topics == '-') {
 + topics++;
 + i++;
 + k = 0;
 +
 + while (*topics != ','  *topics != '\0') {
 + buf_2[k] = *topics;
 + topics++;
 + i++;
 + k++;
 + }
 +
 + length = length + atoi(buf_2) - atoi(buf) + 1;
 + k = 0;
 + }
 +
 + topics++;
 + i++;
 + }
 +
 + topics = topics - i;
 + return length;
 +}
 +
 +static void parse_topics(const char *topics, gint16 *topics_parsed)
 +{
 + int j = 0;
 + int k = 0;
 + char buf[6];
 + char buf_2[6];
 +
 + reset_buf(buf, buf_2, 6);
 +
 + while (*topics != '\0') {
 + if (*topics != ','  *topics != '-') {
 + buf[j] = *topics;
 + j++;
 + } else if (*topics == '-') {
 + topics++;
 + j = 0;
 +
 + while (*topics != ','  *topics != '\0') {
 + buf_2[j] = *topics;
 + topics++;
 + j++;
 + }
 +
 + for (j = 0; j = (atoi(buf_2) - atoi(buf)); j++) {
 + topics_parsed[k] = atoi(buf) + j;
 + topics_parsed[k] = g_ntohs(topics_parsed[k]);
 + k++;
 + }
 +
 + j = 0;
 + } else if (*topics == ',') {
 + topics_parsed[k] = atoi(buf);
 + topics_parsed[k] = g_ntohs(topics_parsed[k]);
 + reset_buf(buf, buf_2, 6);
 + j = 0;
 + k++;
 + }
 +
 + topics++;
 + }
 +}
 +

Have you thought of adapting cbs_extract_topic_ranges function for all
of this somehow?

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


Re: [PATCH 1/1] src: out of bounds problem in smsutil

2011-02-16 Thread Andreas WESTIN

Hi,


Valgrind complains that we step outside the allocated memory by 1 byte
since we loop the string with:

while (*topics != '\0')

the allocated memory is the size of the string and any \0 ends up
outside. At least that's my interpretation.



It might be your loop is actually going past the end, not that the
terminating NULL is not within bounds returned from
cbs_topic_ranges_to_string.  If the original code was wrong then we
should be seeing valgrind report errors on the cbs code used in
unit/test-sms.c.  I'm not seeing this at all.


Yes you absolutely correct, we step it an extra time in one case.

Please disregard the patch.

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


[PATCH] bluetooth: disconnect HFP AG clients

2011-02-16 Thread Frédéric Danis
Clients should be disconnected when VoiceCall atom is unregistered
---
 plugins/hfp_ag.c |   22 +-
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/plugins/hfp_ag.c b/plugins/hfp_ag.c
index cbf3ccd..5fba13d 100644
--- a/plugins/hfp_ag.c
+++ b/plugins/hfp_ag.c
@@ -40,7 +40,7 @@
 static struct server *server;
 static guint modemwatch_id;
 static GList *modems;
-static guint channel_watch;
+static GSList *client_io;
 
 static const gchar *hfp_ag_record =
 ?xml version=\1.0\ encoding=\UTF-8\ ?\n
@@ -89,6 +89,8 @@ static const gchar *hfp_ag_record =
 static gboolean hfp_ag_disconnect_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
 {
+   client_io = g_slist_remove(client_io, io);
+
return FALSE;
 }
 
@@ -118,8 +120,9 @@ static void hfp_ag_connect_cb(GIOChannel *io, GError *err, 
gpointer user_data)
fd = g_io_channel_unix_get_fd(io);
ofono_emulator_register(em, fd);
 
-   channel_watch = g_io_add_watch(io, G_IO_NVAL | G_IO_HUP | G_IO_ERR,
+   g_io_add_watch(io, G_IO_NVAL | G_IO_HUP | G_IO_ERR,
hfp_ag_disconnect_cb, NULL);
+   client_io = g_slist_append(client_io, io);
 
return;
 
@@ -143,9 +146,18 @@ static void voicecall_watch(struct ofono_atom *atom,
NULL);
} else {
modems = g_list_remove(modems, modem);
-   if (modems == NULL   server != NULL) {
-   bluetooth_unregister_server(server);
-   server = NULL;
+   if (modems == NULL) {
+   if (server != NULL) {
+   bluetooth_unregister_server(server);
+   server = NULL;
+   }
+
+   while (client_io) {
+   g_io_channel_shutdown(client_io-data, TRUE,
+   NULL);
+   client_io = g_slist_remove(client_io,
+   client_io-data);
+   }
}
}
 }
-- 
1.7.1

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


[PATCH] TODO: Add STK class 'e' tasks

2011-02-16 Thread Philippe Nunes
---
 TODO |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 9bd21d6..80b68fb 100644
--- a/TODO
+++ b/TODO
@@ -337,6 +337,36 @@ Sim Toolkit
   Priority: High
   Complexity: C8
 
+- Support of the BIP (Bearer Independent Protocol) proactive commands.
+  The specification defines several bearer types. For now, only the packet data
+  service bearer is considered.
+
+   - OPEN CHANNEL: requests the terminal to open a data channel with
+   parameters indicated in the command. A user confirmation may be
+   requested by the SimToolkitAgent.
+   - CLOSE CHANNEL:requests the terminal to close the specified data
+   channel.
+   - RECEIVE DATA:requests the terminal to return to the UICC data
+   received on the specified channel.
+   - SEND DATA:requests the terminal to send on the specified channel data
+   provided by the UICC.
+   - GET CHANNEL STATUS: requests the terminal to return the current
+   status of all available data channels.
+
+  Priority: Medium
+  Complexity: C4
+  Owner: Philippe Nunes philippe.nu...@linux.intel.com
+
+- Support Setup Event List proactive command.
+  To fully support the class 'e', the following events
+   -Data Available event
+   -Channel status event
+  shall be monitored by oFono if part of the current event list.
+  This list is supplied by the last SETUP EVENT LIST command.
+
+  Priority: Medium
+  Complexity: C2
+  Owner: Philippe Nunes philippe.nu...@linux.intel.com
 
 Emergency Calls
 ===
-- 
1.7.1

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


Re: [PATCH] bluetooth: rename hfp.c in hpf_hf.c

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

On 02/16/2011 10:25 AM, Frédéric Danis wrote:
 ---
  Makefile.am  |2 +-
  plugins/hfp.c|  719 
 --
  plugins/hfp_hf.c |  719 
 ++
  3 files changed, 720 insertions(+), 720 deletions(-)
  delete mode 100644 plugins/hfp.c
  create mode 100644 plugins/hfp_hf.c
 

Patch has been applied, thanks.

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


Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

2011-02-16 Thread Denis Kenzior
Hi Martin,

On 02/15/2011 01:03 AM, Xu, Martin wrote:
 Denis/Marcel:
 -Original Message-
 From: Denis Kenzior [mailto:denk...@gmail.com]
 Sent: Tuesday, February 15, 2011 4:28 AM
 To: ofono@ofono.org
 Cc: Xu, Martin
 Subject: Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

 Hi Martin,

 On 02/12/2011 03:41 AM, martin...@intel.com wrote:
 From: Martin Xu martin...@intel.com

 Device 00 is ppp port. Setting it as 01, my Huawei EM770W modem PPP
 connection can't work
 ---
  plugins/ofono.rules |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


 This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.
 I can't quite understand why Dietrich needs to this commit. We formal 
 configure can just make EM770W works.
 Could you help on this?

The Huawei firmware is funny, it can actually reconfigure the modem and
pcui ports (e.g. swap them).  So we might have to be a bit smarter and
figure out which ports are actually being used for what inside the modem
driver.

Talk to Marcel, I believe he has played with the Huawei hardware the
most and might have ideas on how to fix this.

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


[PATCH 1/2] gsmdial: add option for Bluetooth DUN dialing

2011-02-16 Thread Gustavo F. Padovan
---
 gatchat/gsmdial.c |   19 ---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 1be80e3..bae5efb 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -56,6 +56,7 @@ static gboolean option_legacy = FALSE;
 static gchar *option_username = NULL;
 static gchar *option_password = NULL;
 static gchar *option_pppdump = NULL;
+static gboolean option_bluetooth = 0;
 
 static GAtPPP *ppp;
 static GAtChat *control;
@@ -266,6 +267,11 @@ static void no_carrier_notify(GAtResult *result, gpointer 
user_data)
 {
char buf[64];
 
+   if (option_bluetooth) {
+   g_main_loop_quit(event_loop);
+   return;
+   }
+
sprintf(buf, AT+CFUN=%u, option_offmode);
g_at_chat_send(control, buf, none_prefix, power_down, NULL, NULL);
 }
@@ -612,6 +618,8 @@ static GOptionEntry options[] = {
Specify CFUN offmode },
{ legacy, 'l', 0, G_OPTION_ARG_NONE, option_legacy,
Use ATD*99***cid# },
+   { bluetooth, 'b', 0, G_OPTION_ARG_NONE, option_bluetooth,
+   Use only ATD*99 },
{ username, 'u', 0, G_OPTION_ARG_STRING, option_username,
Specify PPP username },
{ password, 'w', 0, G_OPTION_ARG_STRING, option_password,
@@ -700,9 +708,14 @@ int main(int argc, char **argv)
 
event_loop = g_main_loop_new(NULL, FALSE);
 
-   g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
-   g_at_chat_send(control, AT+CFUN?, cfun_prefix,
-   check_mode, NULL, NULL);
+   if (option_bluetooth) {
+   g_at_chat_send(control, ATD*99, none_prefix, connect_cb,
+   NULL, NULL);
+   } else {
+   g_at_chat_send(control, ATE0Q0V1, NULL, NULL, NULL, NULL);
+   g_at_chat_send(control, AT+CFUN?, cfun_prefix,
+   check_mode, NULL, NULL);
+   }
 
g_main_loop_run(event_loop);
g_source_remove(signal_source);
-- 
1.7.4

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


Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

2011-02-16 Thread Marcel Holtmann
Hi Denis,

  This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.
  I can't quite understand why Dietrich needs to this commit. We formal 
  configure can just make EM770W works.
  Could you help on this?
 
 The Huawei firmware is funny, it can actually reconfigure the modem and
 pcui ports (e.g. swap them).  So we might have to be a bit smarter and
 figure out which ports are actually being used for what inside the modem
 driver.

so I did apply this patch now since in the default settings the MDM port
should be on interface 0. All other ones are tempered with.

 Talk to Marcel, I believe he has played with the Huawei hardware the
 most and might have ideas on how to fix this.

And yes, I will add auto-detection for this now. It should be be
possible to figure this out.

ofonod[908]: PCUI:  AT^GETPORTMODE\r
ofonod[908]: PCUI:  
\r\n^getportmode:type:WCDMA:Qualcomm,MDM:0,NDIS:1,DIAG:2,PCUI:3\r\n\r\nOK\r\n

All latest modules support ^GETPORTMODE command and the ones that don't
have only two ports anyway.

Regards

Marcel


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


RE: [PATCH] Enable hs 2330 MBM modem

2011-02-16 Thread Marcel Holtmann
Hi Zhigan,

  +  g_str_has_suffix(desc, Data Modem) ||
 
  I think this should be Module Data Modem.
 
 This is confusing part, with my test with this modem on MeeGo image, the 
 Module Data Modem doesn't work and only Data Modem works.
 
 So I think it should be ok.

looks wrong to me. Please get the lsusb -v out for this modem where it
lists the interface strings.

Regards

Marcel


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


RE: [PATCH] Enable hs 2330 MBM modem

2011-02-16 Thread Li, Zhigang
  I think this should be Module Data Modem.


 looks wrong to me. Please get the lsusb -v out for this modem where it
 lists the interface strings.

Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 2 Communications
  bInterfaceSubClass  2 Abstract (modem)
  bInterfaceProtocol  1 AT-commands (v.25ter)
  iInterface  6 HP hs2330 Mobile Broadband Module| Data Modem
  CDC Header:
bcdCDC   1.10
  CDC Union:
bMasterInterface1
bSlaveInterface 2 
  CDC Call Management:
bmCapabilities   0x03
  call management
  use DataInterface
bDataInterface  2
  CDC ACM:
bmCapabilities   0x07
  sends break
  line coding and serial state
  get/set/clear comm features
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x8a  EP 10 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0010  1x 16 bytes
bInterval   8
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber2
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass10 CDC Data
  bInterfaceSubClass  0 Unused
  bInterfaceProtocol  0 
  iInterface  7 HP hs2330 Mobile Broadband Module| Data Modem
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0

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