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

2011-01-17 Thread Antti Paila
Hi Marcel,

On Fri, 2011-01-14 at 01:22 +0100, ext Marcel Holtmann wrote:
 Hi Antti,
 
   Makefile.am|9 +++--
   src/ofono.conf |2 ++
   2 files changed, 9 insertions(+), 2 deletions(-)
 
 snip
  
 policy user=root
   allow own=org.ofono/
  +allow own=com.meego/
   allow send_destination=org.ofono/
   allow send_interface=org.ofono.SimToolkitAgent/
   allow send_interface=org.ofono.PushNotificationAgent/
   allow send_interface=org.ofono.SmartMessagingAgent/
  +allow send_interface=org.ofono.NetworkTime/
 /policy
   
 policy at_console=true
 
 I am now lost in what you are trying to achieve here. I thought we
 agreed that we send a D-Bus method to timed. For that you neither have
 to have a well known name nor have a D-Bus interface present.

Are you referring to line
'allow send_interface=org.ofono.NetworkTime/'?
This is the interface timed is supposed to implement in order for oFono
to call its Notify method. How else would you do it? 


 And surely ofonod will not claim com.meego as service name.

Yes, sure. That was just left behind from testing, since the mock timed
script needed this for D-Bus access. I'll remove it.

Best Regards,
  Antti

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


RE: Band selection issue

2011-01-17 Thread Li, Zhigang
Hi Lucas

The issue was unstable modem. I tried the 1552 modem again, now it works fine 
with 2G/3G Band, as the limitation of PCS network, did not test the PCS band.

With Emw770, it doesn't work yet, should be modem self issue.

Could you enable debug and paste the output somewhere?
...
...
ofonod[28247]: src/gprs.c:ofono_gprs_status_notify() /huawei2 status 2
ofonod[28247]: PCUI:  \r\n^BOOT:20294258,0,0,0,29\r\n
ofonod[28247]: PCUI:  AT^SYSCFG=16,3,2a0380,2,4\r
ofonod[28247]: PCUI:  \r\nERROR\r\n
ofonod[28247]: src/radio-settings.c:radio_band_set_callback() Error setting 
radio frequency band
ofonod[28247]: PCUI:  AT^SYSCFG=16,3,2a0380,2,4\r
ofonod[28247]: PCUI:  \r\nERROR\r\n
ofonod[28247]: src/radio-settings.c:radio_band_set_callback() Error setting 
radio frequency band
ofonod[28247]: PCUI:  AT^SYSCFG=16,3,2a0380,2,4\r
ofonod[28247]: PCUI:  \r\nERROR\r\n
ofonod[28247]: src/radio-settings.c:radio_band_set_callback() Error setting 
radio frequency band
^[[Aofonod[28247]: PCUI:  \r\n^BOOT:20294258,0,0,0,29\r\n
ofonod[28247]: PCUI:  AT^SYSCFG=16,3,20100,2,4\r
ofonod[28247]: PCUI:  \r\nERROR\r\n
ofonod[28247]: src/radio-settings.c:radio_band_set_callback() Error setting 
radio frequency band
ofonod[28247]: PCUI:  \r\n^BOOT:20294258,0,0,0,29\r\n
ofonod[28247]: PCUI:  AT^SYSCFG=16,3,20100,2,4\r
ofonod[28247]: PCUI:  \r\nERROR\r\n
ofonod[28247]: src/radio-settings.c:radio_band_set_callback() Error setting 
radio frequency band

Thanks
Zhigang

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


Re: [PATCH 1/2] atmodem: move USSD quirk to probe and use it also for STE modems

2011-01-17 Thread Lasse Kunnasluoto
Hi Marcel,

On Fri, 2011-01-14 at 16:20 +0200, Marcel Holtmann wrote:
 Hi Lasse,

  @@ -314,6 +305,18 @@ static int at_ussd_probe(struct ofono_ussd *ussd, 
  unsigned int vendor,
   
  ofono_ussd_set_data(ussd, data);
   
  +   switch (data-vendor) {
  +   case OFONO_VENDOR_QUALCOMM_MSM:
  +   case OFONO_VENDOR_STE:
  +   /*
  +   * Ensure that the modem is using GSM character set. It
  +   * seems it defaults to IRA and then umlauts are not
  +   * properly encoded. The modem returns some weird from
  +   * of Latin-1, but it is not really Latin-1 either.
  +   */
  +   g_at_chat_send(data-chat, AT+CSCS=\GSM\, none_prefix,
  +   NULL, NULL, NULL);
  +   break;
  +   }
  +
  g_at_chat_send(chat, AT+CSCS?, cscs_prefix, read_charset_cb, data,
  NULL);
   
 
 so we don't really wanna do it this way since other atoms like the
 phonebook can switch the character sets as well.
 
Yes, seems so. If phonebook switches the character set USSD won't get
notified and vice versa. So in general this should be somehow
centralized in ofono.
What about supporting the IRA character set in ofono? It would get us a
bit forward compared to current situation. Currently USSD functionality
is quite broken with AT modems having IRA character set, all strings
sent from NW are ignored in cusd_parse().

 The best is if the STE modem would provide access to the USSD in PDU
 mode and we can then decode it properly. Using text mode for USSD is not
 the best idea actually. Same as text mode for SMS is utterly broken ;)
Don't know if this is possible.

 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 1/1] doc: missing space

2011-01-17 Thread Rémi Denis-Courmont
---
 doc/network-api.txt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/network-api.txt b/doc/network-api.txt
index 3a53da9..c252988 100644
--- a/doc/network-api.txt
+++ b/doc/network-api.txt
@@ -80,7 +80,7 @@ Propertiesstring Mode [readonly]
manual   Network operator is selected
   manually. If the operator is
   currently not selected, registration
-  is notattempted
+  is not attempted
off  Unregisters from currently selected
   network, if any, and does not
   attempt to register again.
-- 
1.7.1

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


Re: Band selection issue

2011-01-17 Thread Lucas De Marchi
Hi Zhigang

On Mon, Jan 17, 2011 at 6:31 AM, Li, Zhigang zhigang...@intel.com wrote:
 Hi Lucas

 The issue was unstable modem. I tried the 1552 modem again, now it works fine 
 with 2G/3G Band, as the limitation of PCS network, did not test the PCS band.

 With Emw770, it doesn't work yet, should be modem self issue.

Could you enable debug and paste the output somewhere?
 ...
 ...
 ofonod[28247]: src/gprs.c:ofono_gprs_status_notify() /huawei2 status 2
 ofonod[28247]: PCUI:  \r\n^BOOT:20294258,0,0,0,29\r\n
 ofonod[28247]: PCUI:  AT^SYSCFG=16,3,2a0380,2,4\r

What frequency are you trying to set? Could you verify if it works by
setting both GSM and UMTS frequencies to 'any' ?
It might be a problem that this modem does not accept several
frequencies together (currently we keep the GSM and UMTS values by
making an OR and passing to modem)


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


[PATCH] sim: check if lock is locked after code input attempt

2011-01-17 Thread Jussi Kangas
Hi again,

This is third attempt to fix the problem where PUK required information
is not shown correctly after user tries to change pin code too many
times with wrong passwords. Basically solution is pretty much as in
original made by Marit Henriksen except it does not do the sim interface
initialization anymore and it goes to PRE_SIM state if PUK is required
except in case of PIN2. Fix is also extended to pin locking and pin
unlocking.  

Br,
-Jussi

---
 src/sim.c |   47 +++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index d627647..00f0463 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -622,6 +622,45 @@ static void sim_locked_cb(struct ofono_sim *sim,
gboolean locked)
sim_pin_retries_check(sim);
 }
 
+static void fail_reason_check_cb(const struct ofono_error *error,
+   enum ofono_sim_password_type pin_type,
+   void *data)
+{
+   struct ofono_sim *sim = data;
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(sim-atom);
+   struct ofono_modem *modem = __ofono_atom_get_modem(sim-atom);
+   const char *pin_name;
+
+   if (sim-pin_type != pin_type) {
+   sim-pin_type = pin_type;
+   pin_name = sim_passwd_name(pin_type);
+
+   if (pin_type != OFONO_SIM_PASSWORD_NONE 
+   password_is_pin(pin_type) == FALSE)
+   pin_type = puk2pin(pin_type);
+
+   if (pin_type != OFONO_SIM_PASSWORD_INVALID)
+   sim-locked_pins[pin_type] = TRUE;
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_SIM_MANAGER_INTERFACE,
+   PinRequired, DBUS_TYPE_STRING,
+   pin_name);
+
+   if ((sim-state != OFONO_SIM_STATE_READY) ||
+  ((sim-locked_pins[pin_type] == TRUE)  (
+pin_type == OFONO_SIM_PASSWORD_SIM_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHSIM_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHFSIM_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHNET_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHNETSUB_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHSP_PIN ||
+pin_type == OFONO_SIM_PASSWORD_PHCORP_PIN)))
+   ofono_modem_reset(modem);
+   }
+}
+
 static void sim_unlock_cb(const struct ofono_error *error, void *data)
 {
struct ofono_sim *sim = data;
@@ -630,6 +669,9 @@ static void sim_unlock_cb(const struct ofono_error
*error, void *data)
DBusMessage *reply = __ofono_error_failed(sim-pending);
 
__ofono_dbus_pending_reply(sim-pending, reply);
+
+   sim-driver-query_passwd_state(sim, fail_reason_check_cb, sim);
+
sim_pin_retries_check(sim);
 
return;
@@ -646,6 +688,9 @@ static void sim_lock_cb(const struct ofono_error
*error, void *data)
DBusMessage *reply = __ofono_error_failed(sim-pending);
 
__ofono_dbus_pending_reply(sim-pending, reply);
+
+   sim-driver-query_passwd_state(sim, fail_reason_check_cb, sim);
+
sim_pin_retries_check(sim);
 
return;
@@ -717,6 +762,8 @@ static void sim_change_pin_cb(const struct
ofono_error *error, void *data)
__ofono_dbus_pending_reply(sim-pending,
__ofono_error_failed(sim-pending));
 
+   sim-driver-query_passwd_state(sim, fail_reason_check_cb, sim);
+
sim_pin_retries_check(sim);
 
return;
-- 
1.7.1


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


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

2011-01-17 Thread Soum, RedouaneX
gprs: add function to handle activated context


ofono_gprs_context_activated : this function is symetric to 
ofono_gprs_context_deactivated.
This function must be call by any gprs-context driver when a context has been 
activated without explicit request.

Behavior of the function :

List all the context and try to find correct APN
If such context is not found then create a new one with Internet type only if 
we are in LTE with no Active context.

Otherwise deactivate the connection.

For the context (found or created):
Update the settings
Set to active
---
 src/gprs.c |  122 
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 0e86bdf..6506936 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -692,6 +692,10 @@ static void pri_activate_callback(const struct ofono_error 
*error,
Active, DBUS_TYPE_BOOLEAN, value);
 }
 
+static void __ofono_gprs_context_activated_callback(const struct ofono_error 
*error, void *data)
+{
+}
+
 static void pri_deactivate_callback(const struct ofono_error *error, void 
*data)
 {
struct pri_context *ctx = data;
@@ -1979,6 +1983,124 @@ void ofono_gprs_add_context(struct ofono_gprs *gprs,
__ofono_atom_register(gc-atom, gprs_context_unregister);
 }
 
+void ofono_gprs_context_activated(struct ofono_gprs_context *gc,
+   const int cid, const char *apn,
+   const char *interface, ofono_bool_t static_ip,
+   const char *address, const char *netmask,
+   const char *gw, const char **dns)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   GSList *l;
+   dbus_bool_t value;
+   struct pri_context *context;
+   const char *path;
+   DBusMessage *signal;
+   GKeyFile *settings;
+   int active_context = 0;
+   int technology = 0;
+
+   if (gc-gprs == NULL)
+   return;
+
+   for (l = gc-gprs-contexts; l; l = l-next) {
+   context = l-data;
+
+   if (strcmp(context-context.apn, apn) == 0)
+   break;
+
+   if (context-active)
+   active_context = 1;
+   }
+
+
+   if (gc-gprs-netreg)
+   technology = ofono_netreg_get_technology(gc-gprs-netreg);
+
+   if (!l  !(active_context == 1  technology == 7)) {
+
+   for (l = context-gprs-context_drivers; l; l = l-next) {
+   struct ofono_gprs_context *gc = l-data;
+
+   if (gc-inuse != TRUE) {
+   gc-driver-deactivate_primary(gc, cid,
+   __ofono_gprs_context_activated_callback, 0);
+
+   return ;
+   }
+   }
+   return ;
+   }
+
+   if (!l) {
+   context = add_context(gc-gprs, Internet, 
OFONO_GPRS_CONTEXT_TYPE_INTERNET);
+   path = __ofono_atom_get_path(gc-gprs-atom);
+   signal = dbus_message_new_signal(path,
+   OFONO_CONNECTION_MANAGER_INTERFACE,
+   ContextAdded);
+
+   if (signal) {
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   dbus_message_iter_init_append(signal, iter);
+
+   path = context-path;
+   dbus_message_iter_append_basic(iter, 
DBUS_TYPE_OBJECT_PATH,
+   path);
+
+   dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+   OFONO_PROPERTIES_ARRAY_SIGNATURE,
+   dict);
+   append_context_properties(context, dict);
+   dbus_message_iter_close_container(iter, dict);
+
+   g_dbus_send_message(conn, signal);
+   }
+
+   strcpy(context-context.apn, apn);
+   settings = context-gprs-settings;
+
+   if (settings) {
+   g_key_file_set_string(settings, context-key,
+   AccessPointName, apn);
+   storage_sync(context-gprs-imsi,
+   SETTINGS_STORE, settings);
+   }
+
+   ofono_dbus_signal_property_changed(conn, context-path,
+   OFONO_CONNECTION_CONTEXT_INTERFACE,
+   AccessPointName,
+   DBUS_TYPE_STRING, apn);
+   }
+
+   context-context.cid = cid;
+   value = context-active = TRUE;
+
+   if (interface != NULL)
+   pri_update_context_settings(context, interface, static_ip,
+   address, netmask, gw, dns);
+
+   for (l 

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

2011-01-17 Thread Pekka Pessi
Hi all,

2011/1/7 Denis Kenzior denk...@gmail.com:
 Considering that from a modem standpoint the CID race condition can be 
 resolved,
 some modem implementation may not have reserved a range of CID for their own 
 purpose,
 or may not provide a mechanism to reserve a range of CID.

 If the CGDCONT race is guaranteed to be solved by the modem
 manufacturers, great.  Unfortunately that is not the only race present.
  Hint: The gatchat implementation uses non-blocking IO, select and a
 command queue.  So it is fully possible for oFono to reserve a CID, send
 out a driver activation request, but receive a network initiated context
 activation / default bearer activation before the CGDCONT was even sent.

 Having cid ranges that do not overlap seems the safest approach to me
 right now.  Unless someone has a better idea...

The 27.007 for release 9 (from version 9.3.0 onwards) says:

NOTE 1: The cids for network-initiated PDP contexts will have values
outside the ranges indicated for the
cid in the test form of the commands +CGDCONT and +CGDSCONT.

The change was proposed by STE last February.

This has some ramifications on how we use the CIDs within driver/core.

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/2] Add sim driver call for applications discovery.

2011-01-17 Thread Pekka Pessi
Hi Denis and Andrzej,

2011/1/13 Denis Kenzior denk...@gmail.com:
 +     void (*list_apps)(struct ofono_sim *sim, ofono_sim_apps_cb_t cb,
 +                     void *data);
  };

 Do you think this belongs on a separate atom?  E.g. something like
 Pekka's SimAuthentication ?

I think the applications here are things like USIM and ISIMs. For
authentication, we need the list of applications in order to find out
that there is USIM (so we can use AKA), and if there are ISIMs, which
one to use. (That is my understanding, but I'm no smart card
expert...).

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[RFC PATCH 1/3] types: change OFONO_MAX_PHONE_NUMBER_LENGTH value to 80

2011-01-17 Thread Rafael Ignacio Zurita
---
 include/types.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/types.h b/include/types.h
index 1b95eaa..e4951e4 100644
--- a/include/types.h
+++ b/include/types.h
@@ -76,7 +76,7 @@ struct ofono_error {
int error;
 };
 
-#define OFONO_MAX_PHONE_NUMBER_LENGTH 20
+#define OFONO_MAX_PHONE_NUMBER_LENGTH 80
 #define OFONO_MAX_CALLER_NAME_LENGTH 80
 
 struct ofono_phone_number {
-- 
1.7.2.3

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


[RFC PATCH 2/3] common: split valid_phone_number_format and adapt atoms

2011-01-17 Thread Rafael Ignacio Zurita
---
 src/call-forwarding.c |4 
 src/common.c  |   20 ++--
 src/common.h  |2 ++
 src/message-waiting.c |   14 ++
 src/sim.c |2 +-
 src/sms.c |5 +++--
 6 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 512f223..9fdfeb5 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -260,6 +260,10 @@ static void sim_set_cf_indicator(struct 
ofono_call_forwarding *cf)
data[0] = 0x01;
 
if (cfu_voice) {
+   if (!valid_short_phone_number_format(
+   cond-phone_number.number))
+   return;
+
number_len = strlen(cond-phone_number.number);
 
/* CFU indicator Status - Voice */
diff --git a/src/common.c b/src/common.c
index 4d93488..2096e79 100644
--- a/src/common.c
+++ b/src/common.c
@@ -234,7 +234,7 @@ struct error_entry ceer_errors[] = {
{ 127,  Interworking, unspecified },
 };
 
-gboolean valid_phone_number_format(const char *number)
+gboolean valid_number_format(const char *number, int length)
 {
int len = strlen(number);
int begin = 0;
@@ -246,7 +246,7 @@ gboolean valid_phone_number_format(const char *number)
if (number[0] == '+')
begin = 1;
 
-   if ((len - begin)  OFONO_MAX_PHONE_NUMBER_LENGTH)
+   if ((len - begin)  length)
return FALSE;
 
for (i = begin; i  len; i++) {
@@ -262,6 +262,22 @@ gboolean valid_phone_number_format(const char *number)
return TRUE;
 }
 
+gboolean valid_phone_number_format(const char *number)
+{
+   return valid_number_format(number, OFONO_MAX_PHONE_NUMBER_LENGTH);
+}
+
+/*
+ * According to 3GPP TS 24.011 or 3GPP TS 31.102, some
+ * addresses (or numbers), like Service Centre address,
+ * Destination address, or EFADN (Abbreviated dialling numbers),
+ * are up 20 digits.
+ */
+gboolean valid_short_phone_number_format(const char *number)
+{
+   return valid_number_format(number, 20);
+}
+
 gboolean valid_cdma_phone_number_format(const char *number)
 {
int len = strlen(number);
diff --git a/src/common.h b/src/common.h
index 64f297e..86f97f8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -131,7 +131,9 @@ enum pin_type {
 
 const char *telephony_error_to_str(const struct ofono_error *error);
 
+gboolean valid_number_format(const char *number, int length);
 gboolean valid_phone_number_format(const char *number);
+gboolean valid_short_phone_number_format(const char *number);
 const char *phone_number_to_string(const struct ofono_phone_number *ph);
 void string_to_phone_number(const char *str, struct ofono_phone_number *ph);
 
diff --git a/src/message-waiting.c b/src/message-waiting.c
index d8bfe34..5322f96 100644
--- a/src/message-waiting.c
+++ b/src/message-waiting.c
@@ -192,6 +192,13 @@ static DBusMessage *set_cphs_mbdn(struct 
ofono_message_waiting *mw,
return NULL;
}
 
+   if (!valid_short_phone_number_format(number)) {
+   if (msg)
+   return __ofono_error_invalid_format(msg);
+
+   return NULL;
+   }
+
req = g_new0(struct mbdn_set_request, 1);
 
req-mw = mw;
@@ -291,6 +298,13 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting 
*mw, int mailbox,
return NULL;
}
 
+   if (!valid_short_phone_number_format(number)) {
+   if (msg)
+   return __ofono_error_invalid_format(msg);
+
+   return NULL;
+   }
+
req = g_new0(struct mbdn_set_request, 1);
 
req-mw = mw;
diff --git a/src/sim.c b/src/sim.c
index d627647..6b3a911 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -565,7 +565,7 @@ static DBusMessage *sim_set_property(DBusConnection *conn, 
DBusMessage *msg,
 
dbus_message_iter_get_basic(var_elem, value);
 
-   if (!valid_phone_number_format(value))
+   if (!valid_short_phone_number_format(value))
goto error;
 
own = g_new0(struct ofono_phone_number, 1);
diff --git a/src/sms.c b/src/sms.c
index 9bb5c93..a6134bd 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -654,7 +654,8 @@ static DBusMessage *sms_set_property(DBusConnection *conn, 
DBusMessage *msg,
 
dbus_message_iter_get_basic(var, value);
 
-   if (strlen(value) == 0 || !valid_phone_number_format(value))
+   if (strlen(value) == 0 ||
+   !valid_short_phone_number_format(value))
return __ofono_error_invalid_format(msg);
 
if (sms-driver-sca_set == NULL ||
@@ -983,7 +984,7 @@ static DBusMessage *sms_send_message(DBusConnection *conn, 
DBusMessage *msg,
DBUS_TYPE_INVALID))
  

[RFC PATCH 0/3] Long phone numbers

2011-01-17 Thread Rafael Ignacio Zurita
This is a proposal for the long phone number task (80 digits max length).
It changes OFONO_MAX_PHONE_NUMBER_LENGTH and splits
common:valid_phone_number_format(), to make sure long numbers are handled
appropriately for functions that need manage shorter numbers, like
numbers written to the SIM, or sms SCA.

Rafael Ignacio Zurita (3):
  types: change OFONO_MAX_PHONE_NUMBER_LENGTH value to 80
  common: split valid_phone_number_format and adapt atoms
  smart-messaging: Adapt to use new number format validation function

 include/types.h   |2 +-
 plugins/smart-messaging.c |4 ++--
 src/call-forwarding.c |4 
 src/common.c  |   20 ++--
 src/common.h  |2 ++
 src/message-waiting.c |   14 ++
 src/sim.c |2 +-
 src/sms.c |5 +++--
 8 files changed, 45 insertions(+), 8 deletions(-)

-- 
1.7.2.3

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


[RFC PATCH 3/3] smart-messaging: Adapt to use new validation function

2011-01-17 Thread Rafael Ignacio Zurita
---
 plugins/smart-messaging.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index 40af89f..5b77263 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -200,7 +200,7 @@ static DBusMessage 
*smart_messaging_send_vcard(DBusConnection *conn,
bytes, len, DBUS_TYPE_INVALID))
return __ofono_error_invalid_args(msg);
 
-   if (valid_phone_number_format(to) == FALSE)
+   if (valid_short_phone_number_format(to) == FALSE)
return __ofono_error_invalid_format(msg);
 
ref = __ofono_sms_get_next_ref(sm-sms);
@@ -243,7 +243,7 @@ static DBusMessage 
*smart_messaging_send_vcal(DBusConnection *conn,
bytes, len, DBUS_TYPE_INVALID))
return __ofono_error_invalid_args(msg);
 
-   if (valid_phone_number_format(to) == FALSE)
+   if (valid_short_phone_number_format(to) == FALSE)
return __ofono_error_invalid_format(msg);
 
ref = __ofono_sms_get_next_ref(sm-sms);
-- 
1.7.2.3

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


Re: Segmentation fault on Downlink data transfer

2011-01-17 Thread Pargada, Carlos
Hi Denis,

 What is the exact setup that you're using?  Are you using GAtMux or the 
 kernel mux?

Actually the mux was the internal to oFono, Kernel MUX is planned for further 
versions.


 Can you check whether using synchronous writes to the TUN device fix your 
 problem?  E.g. in new_bytes of gatrawip.c.

Changing priority from G_PRIORITY_NORMAL to G_PRIORITY_HIGH avoid the issue of 
ring buffer overflow.
However  the ring buffer usage is at 2/3. This mean that 2 packets of 1420 are 
stored. A 3 one crash the system.

In Mobile data transfer, it is often the cases that  latency of packets can be 
much more greater that in wired network (RLC layer in Modem buffers incoming 
packet to reassemble its and deliver packet in right order of reception). In 
this case,  several packet can be delivered by the Modem in burst. If another 
packet are to closed, we get a new ring buffer overflow. This is why  I believe 
that this buffer need to be increase to avoid this situation.
Taking some logs (tcpdump, ofono and internal Modem logs) show that burst of 
packets often occurs.

So to Fix this issue 2 actions is required:


-  Set the G_PRIORITY_HIGH instead of NORMAL  in g_io_add_watch_full  
in g_io_set_write_handler function (avoid to change mechanism to synchronous 
mode)

-  Secure the ring buffer overflow increasing the size (for example to 
7100: capacity to store 5 Packets of 1420 bytes seems enough).

 For the dlc disconnection after a ring buffer overflow, I continue to suggest 
 to change the behavior. At the end user side, a shutdown of the Modem is not 
 the solution. There is not a Modem issue and  all others functionalities of 
 the Modem not need to be deactivate (ongoing Call drop if ongoing, No  
 Emergency Call available during reinitialisation, etc ...)

Give me your feedback for the fix and tell me If you want me to submit a patch 
with this proposition.

Regards

Carlos










-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] sim: fix issue with sizeof call

2011-01-17 Thread Jeevaka Badrappan
In some compilers, sizeof the functional argument is
not returning the actual sizeof the argument.
---
 src/sim.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index d627647..62e 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -423,7 +423,7 @@ static void sim_pin_retries_query_cb(const struct 
ofono_error *error,
return;
}
 
-   if (!memcmp(retries, sim-pin_retries, sizeof(retries)))
+   if (!memcmp(retries, sim-pin_retries, sizeof(sim-pin_retries)))
return;
 
memcpy(sim-pin_retries, retries, sizeof(sim-pin_retries));
-- 
1.7.0.4

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


Re: [PATCH 1/1] doc: Typo

2011-01-17 Thread Marcel Holtmann
Hi Remi,

  doc/network-api.txt |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


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


Re: [PATCH 1/1] doc: missing space

2011-01-17 Thread Marcel Holtmann
Hi Remi,

  doc/network-api.txt |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


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


Re: [PATCH] doc: Add Bluetooth Dial-up Networking Profile specs

2011-01-17 Thread Marcel Holtmann
Hi Olivier,

  doc/standards.txt |   49 +
  1 files changed, 49 insertions(+), 0 deletions(-)
 
 diff --git a/doc/standards.txt b/doc/standards.txt
 index 2b85cb0..773300e 100644
 --- a/doc/standards.txt
 +++ b/doc/standards.txt
 @@ -166,3 +166,52 @@ 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
 +
 +Bluetooth Specifications
 +
 +- Dial-up Networking Profile - Bluetooth specification version 1.1 - 22 
 February 2001

this is fine ...

 +Bluetooth Dial-up Networking Profile Features Description
 +=
 +- AT COMMAND SET USED:
 +Commands:

..., but I thin this should be a separate file.

Regards

Marcel


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


Re: [PATCH] sim: fix issue with sizeof call

2011-01-17 Thread Marcel Holtmann
Hi Jeevaka,

 In some compilers, sizeof the functional argument is
 not returning the actual sizeof the argument.
 ---
  src/sim.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


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


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

2011-01-17 Thread Marcel Holtmann
Hi Antti,

Makefile.am|9 +++--
src/ofono.conf |2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
  
  snip
   
  policy user=root
allow own=org.ofono/
   +allow own=com.meego/
allow send_destination=org.ofono/
allow send_interface=org.ofono.SimToolkitAgent/
allow send_interface=org.ofono.PushNotificationAgent/
allow send_interface=org.ofono.SmartMessagingAgent/
   +allow send_interface=org.ofono.NetworkTime/
  /policy

  policy at_console=true
  
  I am now lost in what you are trying to achieve here. I thought we
  agreed that we send a D-Bus method to timed. For that you neither have
  to have a well known name nor have a D-Bus interface present.
 
 Are you referring to line
 'allow send_interface=org.ofono.NetworkTime/'?
 This is the interface timed is supposed to implement in order for oFono
 to call its Notify method. How else would you do it? 

actually timed has to expose a proper interface for this. Don't intermix
this with org.ofono. This is a timed details.

And the D-Bus rules to be part of timed and not oFono.

Regards

Marcel


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


Re: [RFC] magic numbers (145,129)

2011-01-17 Thread Denis Kenzior
Hi George,

On 01/16/2011 12:39 PM, George Matveev wrote:
 Hi,
 
 this is proposal for a patch series which would replace
 magic numbers 145 and 129 with well defined enumeration.
 
 Currently we have the following (eliminating sms and CAIF related code):
 
 geo@fermat:/home/work/ofono/ofono$ grep -nr 145 drivers src|grep -v
 sms|grep -v CAIF
 drivers/huaweimodem/voicecall.c:123:  if (ph-type == 145)
 drivers/stemodem/voicecall.c:195: if (ph-type == 145)
 drivers/atmodem/voicecall.c:374:  if (ph-type == 145)
 drivers/calypsomodem/voicecall.c:88:  if (ph-type == 145)
 drivers/hfpmodem/voicecall.c:369: if (ph-type == 145)
 drivers/ifxmodem/voicecall.c:313: if (ph-type == 145)
 src/phonebook.c:41:#define TYPE_INTERNATIONAL 145
 src/common.c:74:  { 145,  Message class not supported },
 src/common.c:408: if (ph-type == 145  (strlen(ph-number)  0) 
 src/common.c:425: ph-type = 145; /* International */
 geo@fermat:/home/work/ofono/ofono$
 
 Even though TYPE_INTERNATIONAL is defined it is used only once:
 
 geo@fermat:/home/work/ofono/ofono$ grep -nr _INTERNATIONAL .|grep -v SMS
 ./src/phonebook.c:41:#define TYPE_INTERNATIONAL 145
 ./src/phonebook.c:179:if ((type == TYPE_INTERNATIONAL)  (number[0] 
 !=
 '+'))
 geo@fermat:/home/work/ofono/ofono$
 
 And for magic number 129 we have:
 
 geo@fermat:/home/work/ofono/ofono$ grep -nr 129 drivers src|grep -v
 sms|grep -v CAIF
 drivers/atmodem/call-forwarding.c:92: list[num].phone_number.type = 
 129;
 drivers/atmodem/atutil.c:115: int number_type = 129;
 drivers/atmodem/ssn.c:72: ph.type = 129;
 drivers/calypsomodem/voicecall.c:298: type = 129;
 src/call-forwarding.c:794:ph.type = 129;
 src/common.c:70:  { 129,  Short message type 0 not supported },
 src/common.c:428: ph-type = 129; /* Local */
 geo@fermat:/home/work/ofono/ofono$
 
 
 So if we introduce enum phone_number_type in src/common.h
 similar to sms_number_type defined in smsutils.h:
 
 enum phone_number_type {
   PHONE_NUMBER_TYPE_LOCAL = 0,
   PHONE_NUMBER_TYPE_INTER = 1
 };
 
 and use it consistently with phone type then we may avoid magic numbers
 and need to guess what they mean.
 

As Rajesh mentions in the other reply you at least have to assign proper
values to the enum.  Assigning 0 and 1 is not going to work.  Also,
please use proper naming.  PHONE_NUMBER_TYPE_INTER makes no sense to me.
 If you mean INTERNATIONAL then please spell that out.

Refer to 24.008 Section 10.5.4.7 for more details.

 Also if we do so there will be no need to include any new headers in
 voicecall.c files in case of
 stemodem and hfpmodem drivers. Only voicecall.c for atmodem, calypsomodem,
 and ifxmodem drivers will have to include common.h.
 
 If project maintainers agree that such patch (series) might make oFono
 code more structured
 and easier to understand (no need to comment on each line) I'll submit a
 patch series shortly.

Personally I don't really consider these as 'magic numbers'.  They're so
widely used in 27.007 that if you don't know what type 145/128/129 is,
you have bigger problems ;)  However, if you really feel this makes
things better I'm okay with accepting such a patch series.

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


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

2011-01-17 Thread Mika.Liljeberg
Hi,

On a side topic, the policy seems a bit broken to begin with.

   snip

   policy user=root
 allow own=org.ofono/
 allow send_destination=org.ofono/

This alone already allows root access to all interfaces behind a connection 
named org.ofono.

 allow send_interface=org.ofono.SimToolkitAgent/
 allow send_interface=org.ofono.PushNotificationAgent/
 allow send_interface=org.ofono.SmartMessagingAgent/

So these are redundant, unless the whole thing is rewritten as:

allow send_destination=org.ofono 
send_interface=org.ofono.SimToolkitAgent/
allow send_destination=org.ofono 
send_interface=org.ofono.PushNotificationAgent/
allow send_destination=org.ofono 
send_interface=org.ofono.SmartMessagingAgent/

   /policy

Br,

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


[PATCH] Fix crash in isimodem call forwarding.

2011-01-17 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 drivers/isimodem/call-forwarding.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/isimodem/call-forwarding.c 
b/drivers/isimodem/call-forwarding.c
index 2fafb26..89a03dc 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -143,6 +143,14 @@ static gboolean 
decode_gsm_forwarding_info(GIsiSubBlockIter *parent,
info-numlen * 2,
2 + len))
return FALSE;
+
+   if (number)
+   *number = tag;
+   else
+   g_free(tag);
+   } else {
+   if (number)
+   *number = g_strdup();
}
 
if (status)
@@ -154,11 +162,6 @@ static gboolean 
decode_gsm_forwarding_info(GIsiSubBlockIter *parent,
if (noreply)
*noreply = info-noreply;
 
-   if (number)
-   *number = tag;
-   else
-   g_free(tag);
-
return TRUE;
}
return FALSE;
-- 
1.7.1

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


Re: [PATCH] Fix crash in isimodem call forwarding.

2011-01-17 Thread Marcel Holtmann
Hi Pekka,

  drivers/isimodem/call-forwarding.c |   13 -
  1 files changed, 8 insertions(+), 5 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


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


[PATCH 1/1] atmodem: add ifx support for pin retries query

2011-01-17 Thread Jeevaka Badrappan
Adds ifx support for the remaining pin retries query
---
 drivers/atmodem/sim.c |   83 +++-
 1 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index c5f4a44..3f81249 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -56,6 +56,7 @@ static const char *crsm_prefix[] = { +CRSM:, NULL };
 static const char *cpin_prefix[] = { +CPIN:, NULL };
 static const char *clck_prefix[] = { +CLCK:, NULL };
 static const char *huawei_cpin_prefix[] = { ^CPIN:, NULL };
+static const char *xpincnt_prefix[] = { +XPINCNT:, NULL };
 static const char *none_prefix[] = { NULL };
 
 static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -522,40 +523,90 @@ error:
CALLBACK_WITH_FAILURE(cb, NULL, cbd-data);
 }
 
+static void xpincnt_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_sim_pin_retries_cb_t cb = cbd-cb;
+   const char *final = g_at_result_final_response(result);
+   GAtResultIter iter;
+   struct ofono_error error;
+   int retries[OFONO_SIM_PASSWORD_INVALID];
+   size_t i;
+   static enum ofono_sim_password_type password_types[] = {
+   OFONO_SIM_PASSWORD_SIM_PIN,
+   OFONO_SIM_PASSWORD_SIM_PIN2,
+   OFONO_SIM_PASSWORD_SIM_PUK,
+   OFONO_SIM_PASSWORD_SIM_PUK2,
+   };
+
+   decode_at_error(error, final);
+
+   if (!ok) {
+   cb(error, NULL, cbd-data);
+   return;
+   }
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, +XPINCNT:))
+   goto error;
+
+   memset(retries, -1, sizeof(retries));
+
+   for (i = 0; i  ARRAY_SIZE(password_types); i++) {
+   int val;
+
+   if (!g_at_result_iter_next_number(iter, val))
+   goto error;
+
+   retries[password_types[i]]= val;
+
+   DBG(retry counter id=%d, val=%d, password_types[i],
+   retries[password_types[i]]);
+   }
+
+   cb(error, retries, cbd-data);
+
+   return;
+
+error:
+   CALLBACK_WITH_FAILURE(cb, NULL, cbd-data);
+}
+
 static void at_pin_retries_query(struct ofono_sim *sim,
ofono_sim_pin_retries_cb_t cb, void *data)
 {
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd;
-   int retries[OFONO_SIM_PASSWORD_INVALID];
-   int i;
 
DBG();
 
-   switch (sd-vendor) {
-   case OFONO_VENDOR_HUAWEI:
-   cbd = cb_data_new(cb, data);
+   cbd = cb_data_new(cb, data);
+   if (cbd == NULL) {
+   CALLBACK_WITH_FAILURE(cb, NULL, data);
+   return;
+   }
 
-   if (cbd == NULL) {
-   CALLBACK_WITH_FAILURE(cb, NULL, data);
+   switch (sd-vendor) {
+   case OFONO_VENDOR_IFX:
+   if (g_at_chat_send(sd-chat, AT+XPINCNT, xpincnt_prefix,
+   xpincnt_cb, cbd, g_free)  0)
return;
-   }
 
+   break;
+   case OFONO_VENDOR_HUAWEI:
if (g_at_chat_send(sd-chat, AT^CPIN?, huawei_cpin_prefix,
huawei_cpin_cb, cbd, g_free)  0)
return;
 
-   g_free(cbd);
-
-   CALLBACK_WITH_FAILURE(cb, NULL, data);
break;
-
default:
-   for(i = 0; i  OFONO_SIM_PASSWORD_INVALID; i++)
-   retries[i] = -1;
-
-   CALLBACK_WITH_SUCCESS(cb, retries, data);
+   break;
}
+
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, NULL, data);
 }
 
 static void at_cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
-- 
1.7.0.4

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


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

2011-01-17 Thread Denis Kenzior
Hi Mika,

 So these are redundant, unless the whole thing is rewritten as:
 
   allow send_destination=org.ofono 
 send_interface=org.ofono.SimToolkitAgent/
   allow send_destination=org.ofono 
 send_interface=org.ofono.PushNotificationAgent/
   allow send_destination=org.ofono 
 send_interface=org.ofono.SmartMessagingAgent/
 

The agents are registered by the application, not ofono.  So the
destination is in fact not org.ofono but a system bus connection owned
by the application.  Hence the need to punch holes here.

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


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

2011-01-17 Thread Sjur Brændeland
Hi,

Pekka Pessi ppe...@gmail.com wrote:
 The 27.007 for release 9 (from version 9.3.0 onwards) says:

 NOTE 1: The cids for network-initiated PDP contexts will have values
 outside the ranges indicated for the
 cid in the test form of the commands +CGDCONT and +CGDSCONT.

 The change was proposed by STE last February.

 This has some ramifications on how we use the CIDs within driver/core.

I'm not sure we have any problems with Network Initiated Connection in oFono,
unless someone is planning to add support for Network Initiated
Primary Contexts /
PDN Connections. Because the Network Initiated Contexts we are dealing with
will be Secondary PDP Contexts / Dedicated Bearers.

If we need to expose information about the Network Initiated Dedicated Bearers,
I don't think we should model this as separate Connection-Contexts (with CID),
but rather as a dictionary within the primary context object containing
the necessary information about the QoS available.

I guess we need to hear from IMS-folks the minimum information they
need about the QoS, and provide just that information.

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


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

2011-01-17 Thread Sjur Brændeland
Hi,

So far we have been discussing CID races, but if we solve the CID issue,
we still might end up with two identical Connections activated with the same
connection properties (APN, Username, Password), one initiated by the modem
in the LTE Combined Attach procedure and the other being a normal Context
Activation, right?

How do we protect against establishing two contexts with the same properties?

Also: what is the likelihood of not having information the initial PDN
defined in the
provisioning database, would this be an exceptional case only?

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


Re: [PATCH 1/1] atmodem: add ifx support for pin retries query

2011-01-17 Thread Lucas De Marchi
Hi Jeevaka

On Mon, Jan 17, 2011 at 4:29 PM, Jeevaka Badrappan
jeevaka.badrap...@elektrobit.com wrote:
 Adds ifx support for the remaining pin retries query
 ---
  drivers/atmodem/sim.c |   83 +++-
  1 files changed, 67 insertions(+), 16 deletions(-)

 diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
 index c5f4a44..3f81249 100644
 --- a/drivers/atmodem/sim.c
 +++ b/drivers/atmodem/sim.c
 @@ -56,6 +56,7 @@ static const char *crsm_prefix[] = { +CRSM:, NULL };
  static const char *cpin_prefix[] = { +CPIN:, NULL };
  static const char *clck_prefix[] = { +CLCK:, NULL };
  static const char *huawei_cpin_prefix[] = { ^CPIN:, NULL };
 +static const char *xpincnt_prefix[] = { +XPINCNT:, NULL };
  static const char *none_prefix[] = { NULL };

  static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer 
 user_data)
 @@ -522,40 +523,90 @@ error:
        CALLBACK_WITH_FAILURE(cb, NULL, cbd-data);
  }

 +static void xpincnt_cb(gboolean ok, GAtResult *result, gpointer user_data)
 +{
 +       struct cb_data *cbd = user_data;
 +       ofono_sim_pin_retries_cb_t cb = cbd-cb;
 +       const char *final = g_at_result_final_response(result);
 +       GAtResultIter iter;
 +       struct ofono_error error;
 +       int retries[OFONO_SIM_PASSWORD_INVALID];
 +       size_t i;
 +       static enum ofono_sim_password_type password_types[] = {
 +               OFONO_SIM_PASSWORD_SIM_PIN,
 +               OFONO_SIM_PASSWORD_SIM_PIN2,
 +               OFONO_SIM_PASSWORD_SIM_PUK,
 +               OFONO_SIM_PASSWORD_SIM_PUK2,
 +       };
 +
 +       decode_at_error(error, final);
 +
 +       if (!ok) {
 +               cb(error, NULL, cbd-data);
 +               return;
 +       }
 +
 +       g_at_result_iter_init(iter, result);
 +
 +       if (!g_at_result_iter_next(iter, +XPINCNT:))
 +               goto error;
 +
 +       memset(retries, -1, sizeof(retries));

this happens to work for -1, but bear in mind memset fills  the
first  n bytes of the memory area. Considering sizeof(int) == 4, it
will set each byte to -1, which happens to be -1 considering all 4
bytes too. But imo this is just being lucky.

In my first version I had the same as you and Denis asked me to use a for loop.


snip

  static void at_pin_retries_query(struct ofono_sim *sim,
                                ofono_sim_pin_retries_cb_t cb, void *data)
  {
        struct sim_data *sd = ofono_sim_get_data(sim);
        struct cb_data *cbd;
 -       int retries[OFONO_SIM_PASSWORD_INVALID];
 -       int i;

        DBG();

 -       switch (sd-vendor) {
 -       case OFONO_VENDOR_HUAWEI:
 -               cbd = cb_data_new(cb, data);
 +       cbd = cb_data_new(cb, data);
 +       if (cbd == NULL) {
 +               CALLBACK_WITH_FAILURE(cb, NULL, data);
 +               return;
 +       }

 -               if (cbd == NULL) {
 -                       CALLBACK_WITH_FAILURE(cb, NULL, data);
 +       switch (sd-vendor) {
 +       case OFONO_VENDOR_IFX:
 +               if (g_at_chat_send(sd-chat, AT+XPINCNT, xpincnt_prefix,
 +                                       xpincnt_cb, cbd, g_free)  0)
                        return;
 -               }

 +               break;
 +       case OFONO_VENDOR_HUAWEI:
                if (g_at_chat_send(sd-chat, AT^CPIN?, huawei_cpin_prefix,
                                        huawei_cpin_cb, cbd, g_free)  0)
                        return;

 -               g_free(cbd);
 -
 -               CALLBACK_WITH_FAILURE(cb, NULL, data);
                break;
 -
        default:
 -               for(i = 0; i  OFONO_SIM_PASSWORD_INVALID; i++)
 -                       retries[i] = -1;
 -
 -               CALLBACK_WITH_SUCCESS(cb, retries, data);
 +               break;
        }
 +
 +       g_free(cbd);
 +
 +       CALLBACK_WITH_FAILURE(cb, NULL, data);

If vendor is not huawei nor ifx, why are we bothering to allocate cbd
and free it afterwards without using?

This also changes the semantics to return a failure if it's not
implemented. I'm not against since this version seems to be clearer.
However you might want to change src/sim.c:sim_pin_retries_query_cb()
so it doesn't call ofono_error() in this case.



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


RE: [PATCH 1/1] atmodem: add ifx support for pin retries query

2011-01-17 Thread Jeevaka.Badrappan
Hi Lucas,

Lucas De Marchi wrote:
 this happens to work for -1, but bear in mind memset fills
 the first  n bytes of the memory area. Considering
 sizeof(int) == 4, it will set each byte to -1, which happens
 to be -1 considering all 4 bytes too. But imo this is just
 being lucky.
 
 In my first version I had the same as you and Denis asked me
 to use a for loop.

I'll use for loop instead of using memset.

 +       if (cbd == NULL) {
 +               CALLBACK_WITH_FAILURE(cb, NULL, data); +            
 return; +       }
 
 -               if (cbd == NULL) {
 -                       CALLBACK_WITH_FAILURE(cb, NULL, data); +    
 switch (sd-vendor) { +       case OFONO_VENDOR_IFX:
 +               if (g_at_chat_send(sd-chat, AT+XPINCNT, +
 xpincnt_prefix, +                                       xpincnt_cb,
 cbd, g_free)  0)                        return;
 -               }
 
 +               break;
 +       case OFONO_VENDOR_HUAWEI:
                if (g_at_chat_send(sd-chat, AT^CPIN?,
 huawei_cpin_prefix,                                      
 huawei_cpin_cb, cbd, g_free)  0)                        return;
 
 -               g_free(cbd);
 -
 -               CALLBACK_WITH_FAILURE(cb, NULL, data);
                break;
 -
        default:
 -               for(i = 0; i  OFONO_SIM_PASSWORD_INVALID; i++)
 -                       retries[i] = -1;
 -
 -               CALLBACK_WITH_SUCCESS(cb, retries, data); +        
 break;        }
 +
 +       g_free(cbd);
 +
 +       CALLBACK_WITH_FAILURE(cb, NULL, data);
 
 If vendor is not huawei nor ifx, why are we bothering to
 allocate cbd and free it afterwards without using?
 

Most of the vendors provide own commands for reading the sim pin
retry count. Currently, we are handling 2vendors. If the number grows,
then we will end up in having allocation code for each case. If its not
going to be the case, then I can move the code inside each case.

 This also changes the semantics to return a failure if it's
 not implemented. I'm not against since this version seems to
 be clearer.
 However you might want to change src/sim.c:sim_pin_retries_query_cb()
 so it doesn't call ofono_error() in this case.
 

If its not implemented, then we should term it as error. I don't see
any change needed in the current src/sim.c:sim_pin_retries_query_cb() code.

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


Re: [RFC] magic numbers (145,129)

2011-01-17 Thread George Matveev
Rajesh and Denis, thank you for your comments.

It is really comforting to know that project maintainer knows about
specifications and could provide guidance to other developers.
This is what most contributors have come to expect from them.

What makes me wonder is why don't we use those specs consistently?

Instead of relying on sporadic attempts to define number types ad hock,
in different parts of project (see grep results) and using inconsistent
or simply wrong comments, wouldn't it be more logical to use spec?

Denis, you may be surprised to know that such an attempt had already
been made in the past (though possibly in a wrong place - src/driver.h)
and that patch was accepted by someone called Denis Kenzior :-)

Just have a look into oFono archive here:

http://lists.ofono.org/pipermail/ofono/2009-June/000130.html

Since other developers seem to agree that it'll make project code
more organized and readable I think I'll submit a patch using all
those values defined in 3GPP TS 24.008, section 10.5.4.7
Called party BCD number, Table 10.5.118.

What I am not entirely sure though is a name of new enumeration,
possibly *called_number_type* would be more appropriate
and also more in line with the spec?

Best regards,
George

 Hi George,

 On 01/16/2011 12:39 PM, George Matveev wrote:
 Hi,

 this is proposal for a patch series which would replace
 magic numbers 145 and 129 with well defined enumeration.

 Currently we have the following (eliminating sms and CAIF related code):

 geo@fermat:/home/work/ofono/ofono$ grep -nr 145 drivers src|grep -v
 sms|grep -v CAIF
 drivers/huaweimodem/voicecall.c:123: if (ph-type == 145)
 drivers/stemodem/voicecall.c:195:if (ph-type == 145)
 drivers/atmodem/voicecall.c:374: if (ph-type == 145)
 drivers/calypsomodem/voicecall.c:88: if (ph-type == 145)
 drivers/hfpmodem/voicecall.c:369:if (ph-type == 145)
 drivers/ifxmodem/voicecall.c:313:if (ph-type == 145)
 src/phonebook.c:41:#define TYPE_INTERNATIONAL 145
 src/common.c:74: { 145,  Message class not supported },
 src/common.c:408:if (ph-type == 145  (strlen(ph-number)  0) 
 src/common.c:425:ph-type = 145; /* International */
 geo@fermat:/home/work/ofono/ofono$

 Even though TYPE_INTERNATIONAL is defined it is used only once:

 geo@fermat:/home/work/ofono/ofono$ grep -nr _INTERNATIONAL .|grep -v SMS
 ./src/phonebook.c:41:#define TYPE_INTERNATIONAL 145
 ./src/phonebook.c:179:   if ((type == TYPE_INTERNATIONAL)  (number[0] 
 !=
 '+'))
 geo@fermat:/home/work/ofono/ofono$

 And for magic number 129 we have:

 geo@fermat:/home/work/ofono/ofono$ grep -nr 129 drivers src|grep -v
 sms|grep -v CAIF
 drivers/atmodem/call-forwarding.c:92:
 list[num].phone_number.type =
 129;
 drivers/atmodem/atutil.c:115:int number_type = 129;
 drivers/atmodem/ssn.c:72:ph.type = 129;
 drivers/calypsomodem/voicecall.c:298:type = 129;
 src/call-forwarding.c:794:   ph.type = 129;
 src/common.c:70: { 129,  Short message type 0 not supported },
 src/common.c:428:ph-type = 129; /* Local */
 geo@fermat:/home/work/ofono/ofono$


 So if we introduce enum phone_number_type in src/common.h
 similar to sms_number_type defined in smsutils.h:

 enum phone_number_type {
  PHONE_NUMBER_TYPE_LOCAL = 0,
  PHONE_NUMBER_TYPE_INTER = 1
 };

 and use it consistently with phone type then we may avoid magic numbers
 and need to guess what they mean.


 As Rajesh mentions in the other reply you at least have to assign proper
 values to the enum.  Assigning 0 and 1 is not going to work.  Also,
 please use proper naming.  PHONE_NUMBER_TYPE_INTER makes no sense to me.
  If you mean INTERNATIONAL then please spell that out.

 Refer to 24.008 Section 10.5.4.7 for more details.

 Also if we do so there will be no need to include any new headers in
 voicecall.c files in case of
 stemodem and hfpmodem drivers. Only voicecall.c for atmodem,
 calypsomodem,
 and ifxmodem drivers will have to include common.h.

 If project maintainers agree that such patch (series) might make oFono
 code more structured
 and easier to understand (no need to comment on each line) I'll submit a
 patch series shortly.

 Personally I don't really consider these as 'magic numbers'.  They're so
 widely used in 27.007 that if you don't know what type 145/128/129 is,
 you have bigger problems ;)  However, if you really feel this makes
 things better I'm okay with accepting such a patch series.

 Regards,
 -Denis



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


Re: [RFC PATCH 0/3] Long phone numbers

2011-01-17 Thread Pekka Pessi
Hi Rafael,

2011/1/17 Rafael Ignacio Zurita rafael.zur...@profusion.mobi:
 This is a proposal for the long phone number task (80 digits max length).
 It changes OFONO_MAX_PHONE_NUMBER_LENGTH and splits
 common:valid_phone_number_format(), to make sure long numbers are handled
 appropriately for functions that need manage shorter numbers, like
 numbers written to the SIM, or sms SCA.

Perhaps a validator and type for long phone numbers is better than for
short numbers? I guess long numbers are mostly used when reporting an
outgoing call back to oFono.

BTW, with call forwarding you could have numbers up to 16 digits or if
longForwardedToNumber is supported (by modem and both home and visited
networks) even 28 digits. See TS 29.002 for merry details.

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


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

2011-01-17 Thread Pekka Pessi
Hi Sjur,

2011/1/17 Sjur Brændeland sjurb...@gmail.com:
 The 27.007 for release 9 (from version 9.3.0 onwards) says:

 NOTE 1: The cids for network-initiated PDP contexts will have values
 outside the ranges indicated for the
 cid in the test form of the commands +CGDCONT and +CGDSCONT.

 The change was proposed by STE last February.

 This has some ramifications on how we use the CIDs within driver/core.

 I'm not sure we have any problems with Network Initiated Connection in oFono,
 unless someone is planning to add support for Network Initiated
 Primary Contexts / PDN Connections.

AFAIK the initial LTE default bearer context can be network-initiated,
and the CID 0 falls outside the range from +CGDCONT.

 If we need to expose information about the Network Initiated Dedicated 
 Bearers,
 I don't think we should model this as separate Connection-Contexts (with CID),
 but rather as a dictionary within the primary context object containing
 the necessary information about the QoS available.

 I guess we need to hear from IMS-folks the minimum information they
 need about the QoS, and provide just that information.

Uh, on one hand, the IMS Signaling flag for signaling. For
audio/video, we need QCI, a GBR rate, and TFT.

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


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

2011-01-17 Thread Sjur Brændeland
Hi Pekka.

Pekka Pessi ppe...@gmail.com wrote:
 I'm not sure we have any problems with Network Initiated Connection in oFono,
 unless someone is planning to add support for Network Initiated
 Primary Contexts / PDN Connections.

 AFAIK the initial LTE default bearer context can be network-initiated,
 and the CID 0 falls outside the range from +CGDCONT.

If I am not mistaken the initial LTE default bearer is initiated by the
ME in a combined attach procedure, and not by the Network.
(but the Dedicated bearers / Secondary PDPs are activated by the Network).

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


Re: [RFC] magic numbers (145,129)

2011-01-17 Thread Denis Kenzior
Hi George,

Kind reminder to please not top on this mailing list.

On 01/17/2011 03:10 PM, George Matveev wrote:
 Rajesh and Denis, thank you for your comments.
 
 It is really comforting to know that project maintainer knows about
 specifications and could provide guidance to other developers.
 This is what most contributors have come to expect from them.
 
 What makes me wonder is why don't we use those specs consistently?
 
 Instead of relying on sporadic attempts to define number types ad hock,
 in different parts of project (see grep results) and using inconsistent
 or simply wrong comments, wouldn't it be more logical to use spec?
 

Careful there, certainly we are extremely anal about using the specs and
the appropriate enums when it is... appropriate.  However, we break this
rule if it is prudent or makes the code look ugly.  If an enumeration
can be localized to a single function, then don't bother creating an
enum as this only makes the code harder to read.  It is fine to use
magic values if they are localized and you wouldn't understand the
function without the spec in hand.  Browse through stkutil.c, simutil.c
for plenty of examples of this.

There maybe parts that have suffered from bit-rot more than others, but
in general your criticism is a little misplaced.  I consider 145/129
thing to be border-line and can see it both ways.

 Denis, you may be surprised to know that such an attempt had already
 been made in the past (though possibly in a wrong place - src/driver.h)
 and that patch was accepted by someone called Denis Kenzior :-)
 
 Just have a look into oFono archive here:
 
 http://lists.ofono.org/pipermail/ofono/2009-June/000130.html

Yes, and I wonder where this code is now? Oh yes, it was refactored out
by the same guy because it was not actually used in the end ;)

 
 Since other developers seem to agree that it'll make project code
 more organized and readable I think I'll submit a patch using all
 those values defined in 3GPP TS 24.008, section 10.5.4.7
 Called party BCD number, Table 10.5.118.
 
 What I am not entirely sure though is a name of new enumeration,
 possibly *called_number_type* would be more appropriate
 and also more in line with the spec?

Depends on whether you want to separate the number type from the
numbering plan or keep it as a single enum.

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


Re: [PATCH] test: add Retries property to list-modems

2011-01-17 Thread Denis Kenzior
Hi Jeevaka,

On 01/17/2011 11:49 AM, Jeevaka Badrappan wrote:
 ---
  test/list-modems |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

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


[PATCH 1/5] Add SIM authentication atom's driver definitions.

2011-01-17 Thread Andrzej Zaborowski
Structures and function declarations for the SIM authentication
atom as proposed by Pekka Pessi, with just one method at the moment.
---
 Makefile.am|2 +-
 include/sim-auth.h |   64 
 include/types.h|6 +
 3 files changed, 71 insertions(+), 1 deletions(-)
 create mode 100644 include/sim-auth.h

diff --git a/Makefile.am b/Makefile.am
index ce4799e..ada0a51 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
-   include/cdma-sms.h
+   include/cdma-sms.h include/sim-auth.h
 
 nodist_include_HEADERS = include/version.h
 
diff --git a/include/sim-auth.h b/include/sim-auth.h
new file mode 100644
index 000..98c3dfc
--- /dev/null
+++ b/include/sim-auth.h
@@ -0,0 +1,64 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_SIM_AUTH_H
+#define __OFONO_SIM_AUTH_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_sim_auth;
+
+typedef void (*ofono_sim_list_apps_cb_t)(const struct ofono_error *error,
+   struct ofono_sim_app_record *list,
+   int count, void *data);
+
+struct ofono_sim_auth_driver {
+   const char *name;
+   int (*probe)(struct ofono_sim_auth *sa, unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_sim_auth *sa);
+
+   void (*list_apps)(struct ofono_sim_auth *sa,
+   ofono_sim_list_apps_cb_t cb, void *data);
+};
+
+int ofono_sim_auth_driver_register(const struct ofono_sim_auth_driver *d);
+void ofono_sim_auth_driver_unregister(const struct ofono_sim_auth_driver *d);
+
+struct ofono_sim_auth *ofono_sim_auth_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data);
+
+void ofono_sim_auth_register(struct ofono_sim_auth *sa);
+void ofono_sim_auth_remove(struct ofono_sim_auth *sa);
+
+void ofono_sim_auth_set_data(struct ofono_sim_auth *sa, void *data);
+void *ofono_sim_auth_get_data(struct ofono_sim_auth *sa);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_SIM_AUTH_H */
diff --git a/include/types.h b/include/types.h
index 1b95eaa..7f3634e 100644
--- a/include/types.h
+++ b/include/types.h
@@ -122,6 +122,12 @@ struct ofono_uuid {
 
 const char *ofono_uuid_to_str(const struct ofono_uuid *uuid);
 
+struct ofono_sim_app_record {
+   unsigned char aid[16];
+   int aid_len;
+   char *label;
+};
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 2/5] simutil: SIM applications directory decoding utils.

2011-01-17 Thread Andrzej Zaborowski
---
 src/simutil.c |   57 +
 src/simutil.h |2 ++
 2 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/src/simutil.c b/src/simutil.c
index 8abf3d5..b3e2f52 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -1465,3 +1465,60 @@ gboolean sim_sst_is_active(unsigned char *efsst, 
unsigned char len,
 
return (efsst[index / 4]  (((index % 4) * 2) + 1))  1;
 }
+
+GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len)
+{
+   GSList *ret = NULL;
+   const unsigned char *dataobj;
+   int dataobj_len;
+
+   /* Find all the application entries */
+   while ((dataobj = ber_tlv_find_by_tag(buffer, 0x61, len,
+   dataobj_len)) != NULL) {
+   struct ofono_sim_app_record app;
+   const unsigned char *aid, *label;
+   int label_len;
+
+   /* Find the aid (mandatory) */
+   aid = ber_tlv_find_by_tag(dataobj, 0x4f, dataobj_len,
+   app.aid_len);
+   if (!aid || app.aid_len  0x01 || app.aid_len  0x10)
+   goto error;
+
+   memcpy(app.aid, aid, app.aid_len);
+
+   /* Find the label (optional) */
+   label = ber_tlv_find_by_tag(dataobj, 0x50, dataobj_len,
+   label_len);
+   if (label) {
+   /*
+* Label field uses the extra complicated
+* encoding in 102.221 Annex A
+*/
+   app.label = sim_string_to_utf8(label, label_len);
+
+   if (app.label == NULL)
+   goto error;
+   } else
+   app.label = NULL;
+
+   ret = g_slist_prepend(ret, g_memdup(app, sizeof(app)));
+
+   len -= (dataobj - buffer) + dataobj_len;
+   buffer = dataobj + dataobj_len;
+   }
+
+   return ret;
+
+error:
+   while (ret) {
+   GSList *t = ret;
+
+   g_free(((struct ofono_sim_app_record *) ret-data)-label);
+
+   ret = ret-next;
+   g_slist_free_1(t);
+   }
+
+   return NULL;
+}
diff --git a/src/simutil.h b/src/simutil.h
index ad84907..4418ec9 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -446,3 +446,5 @@ gboolean sim_sst_is_available(unsigned char *service_sst, 
unsigned char len,
enum sim_sst_service index);
 gboolean sim_sst_is_active(unsigned char *service_sst, unsigned char len,
enum sim_sst_service index);
+
+GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len);
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 3/5] unit: Add a test for applications directory decoding utility.

2011-01-17 Thread Andrzej Zaborowski
---
 unit/test-simutil.c |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/unit/test-simutil.c b/unit/test-simutil.c
index 7cb5c10..1f350f6 100644
--- a/unit/test-simutil.c
+++ b/unit/test-simutil.c
@@ -444,6 +444,36 @@ static void test_3g_status_data(void)
g_free(response);
 }
 
+static char *at_cuad_response = 611B4F10A000871002890508
+   FF611F4F0CA00063504B43532D
+   313550094D49445066696C657351043F007F80;
+
+static void test_application_entry_decode(void) {
+   unsigned char *ef_dir;
+   long len;
+   GSList *entries;
+   struct ofono_sim_app_record *app[2];
+
+   ef_dir = decode_hex(at_cuad_response, -1, len, 0);
+   entries = sim_parse_app_template_entries(ef_dir, len);
+
+   g_assert(g_slist_length(entries) == 2);
+
+   app[0] = entries-next-data;
+   app[1] = entries-data;
+
+   g_assert(app[0]-aid_len == 0x10);
+   g_assert(!memcmp(app[0]-aid, ef_dir[4], 0x10));
+   g_assert(app[0]-label == NULL);
+
+   g_assert(app[1]-aid_len == 0x0c);
+   g_assert(!memcmp(app[1]-aid, ef_dir[37], 0x0c));
+   g_assert(app[1]-label != NULL);
+   g_assert(!strcmp(app[1]-label, MIDPfiles));
+
+   g_free(ef_dir);
+}
+
 int main(int argc, char **argv)
 {
g_test_init(argc, argv, NULL);
@@ -458,6 +488,8 @@ int main(int argc, char **argv)
g_test_add_func(/testsimutil/EONS Handling, test_eons);
g_test_add_func(/testsimutil/Elementary File DB, test_ef_db);
g_test_add_func(/testsimutil/3G Status response, test_3g_status_data);
+   g_test_add_func(/testsimutil/Application entries decoding,
+   test_application_entry_decode);
 
return g_test_run();
 }
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 5/5] atmodem: sim-auth atom driver.

2011-01-17 Thread Andrzej Zaborowski
At the moment implementing only application discovery.
---
 Makefile.am|3 +-
 drivers/atmodem/atmodem.c  |2 +
 drivers/atmodem/atmodem.h  |3 +
 drivers/atmodem/sim-auth.c |  173 
 4 files changed, 180 insertions(+), 1 deletions(-)
 create mode 100644 drivers/atmodem/sim-auth.c

diff --git a/Makefile.am b/Makefile.am
index a0b7264..1397170 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -170,7 +170,8 @@ builtin_sources += $(gatchat_sources) \
drivers/atmodem/atutil.h \
drivers/atmodem/atutil.c \
drivers/atmodem/gprs.c \
-   drivers/atmodem/gprs-context.c
+   drivers/atmodem/gprs-context.c \
+   drivers/atmodem/sim-auth.c
 
 builtin_modules += nwmodem
 builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c
index c88f6b2..e140281 100644
--- a/drivers/atmodem/atmodem.c
+++ b/drivers/atmodem/atmodem.c
@@ -51,12 +51,14 @@ static int atmodem_init(void)
at_call_volume_init();
at_gprs_init();
at_gprs_context_init();
+   at_sim_auth_init();
 
return 0;
 }
 
 static void atmodem_exit(void)
 {
+   at_sim_auth_exit();
at_stk_exit();
at_sim_exit();
at_sms_exit();
diff --git a/drivers/atmodem/atmodem.h b/drivers/atmodem/atmodem.h
index c7f0eed..1b7cf67 100644
--- a/drivers/atmodem/atmodem.h
+++ b/drivers/atmodem/atmodem.h
@@ -71,3 +71,6 @@ extern void at_gprs_exit(void);
 
 extern void at_gprs_context_init(void);
 extern void at_gprs_context_exit(void);
+
+extern void at_sim_auth_init(void);
+extern void at_sim_auth_exit(void);
diff --git a/drivers/atmodem/sim-auth.c b/drivers/atmodem/sim-auth.c
new file mode 100644
index 000..a7a64ed
--- /dev/null
+++ b/drivers/atmodem/sim-auth.c
@@ -0,0 +1,173 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *
+ *  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
+
+#define _GNU_SOURCE
+#include string.h
+
+#include glib.h
+
+#include ofono/modem.h
+#include ofono/sim-auth.h
+
+#include gatchat.h
+#include gatresult.h
+#include simutil.h
+#include vendor.h
+
+#include atmodem.h
+
+struct sim_auth_data {
+   GAtChat *chat;
+   unsigned int vendor;
+};
+
+static const char *cuad_prefix[] = { +CUAD:, NULL };
+
+static void at_discover_apps_cb(gboolean ok, GAtResult *result,
+   gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   GAtResultIter iter;
+   ofono_sim_list_apps_cb_t cb = cbd-cb;
+   struct ofono_error error;
+   GSList *list = NULL, *i;
+   struct ofono_sim_app_record *buffer;
+   int j, n;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok) {
+   cb(error, NULL, 0, cbd-data);
+   return;
+   }
+
+   g_at_result_iter_init(iter, result);
+
+   while (g_at_result_iter_next(iter, +CUAD:)) {
+   const guint8 *obj_str;
+   gint len;
+
+   if (!g_at_result_iter_next_hexstring(iter, obj_str, len))
+   goto error;
+
+   i = sim_parse_app_template_entries(obj_str, len);
+   if (i == NULL)
+   goto error;
+
+   list = g_slist_concat(i, list);
+   }
+
+   n = g_slist_length(list);
+   buffer = g_new(struct ofono_sim_app_record, n);
+
+   for (i = list, j = n - 1; i != NULL; i = i-next, i--)
+   memcpy(buffer[j], i-data, sizeof(*buffer));
+
+   cb(error, buffer, n, cbd-data);
+
+   g_free(buffer);
+   goto done;
+
+error:
+   CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd-data);
+
+done:
+   while (list) {
+   i = list;
+   list = list-next;
+
+   g_free(((struct ofono_sim_app_record *) i-data)-label);
+   g_free(i-data);
+   g_slist_free_1(i);
+   }
+}
+
+static void at_discover_apps(struct ofono_sim_auth *sa,
+   ofono_sim_list_apps_cb_t cb,
+   void *data)
+{
+   

[PATCH 4/5] Add the sim-auth atom.

2011-01-17 Thread Andrzej Zaborowski
Add dummy SIM authentication atom.
---
 Makefile.am|2 +-
 src/ofono.h|2 +
 src/sim-auth.c |  134 
 3 files changed, 137 insertions(+), 1 deletions(-)
 create mode 100644 src/sim-auth.c

diff --git a/Makefile.am b/Makefile.am
index ada0a51..a0b7264 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -349,7 +349,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
-   src/cdma-voicecall.c
+   src/cdma-voicecall.c src/sim-auth.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \
@BLUEZ_LIBS@ -ldl
diff --git a/src/ofono.h b/src/ofono.h
index 77567c2..9179f61 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -127,6 +127,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_NETTIME = 21,
OFONO_ATOM_TYPE_CTM = 22,
OFONO_ATOM_TYPE_CDMA_VOICECALL_MANAGER = 23,
+   OFONO_ATOM_TYPE_SIM_AUTH = 24,
 };
 
 enum ofono_atom_watch_condition {
@@ -418,3 +419,4 @@ void __ofono_nettime_info_received(struct ofono_modem 
*modem,
struct ofono_network_time *info);
 
 #include ofono/cdma-voicecall.h
+#include ofono/sim-auth.h
diff --git a/src/sim-auth.c b/src/sim-auth.c
new file mode 100644
index 000..5d2f075
--- /dev/null
+++ b/src/sim-auth.c
@@ -0,0 +1,134 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *
+ *  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
+
+#define _GNU_SOURCE
+
+#include glib.h
+#include errno.h
+#include unistd.h
+
+#include ofono.h
+
+#include simutil.h
+
+static GSList *g_drivers = NULL;
+
+struct ofono_sim_auth {
+   const struct ofono_sim_auth_driver *driver;
+   void *driver_data;
+   struct ofono_atom *atom;
+};
+
+int ofono_sim_auth_driver_register(const struct ofono_sim_auth_driver *d)
+{
+   DBG(driver: %p, name: %s, d, d-name);
+
+   if (d-probe == NULL)
+   return -EINVAL;
+
+   g_drivers = g_slist_prepend(g_drivers, (void *) d);
+
+   return 0;
+}
+
+void ofono_sim_auth_driver_unregister(const struct ofono_sim_auth_driver *d)
+{
+   DBG(driver: %p, name: %s, d, d-name);
+
+   g_drivers = g_slist_remove(g_drivers, (void *) d);
+}
+
+static void sim_auth_unregister(struct ofono_atom *atom)
+{
+}
+
+static void sim_auth_remove(struct ofono_atom *atom)
+{
+   struct ofono_sim_auth *sa = __ofono_atom_get_data(atom);
+
+   DBG(atom: %p, atom);
+
+   if (sa == NULL)
+   return;
+
+   if (sa-driver  sa-driver-remove)
+   sa-driver-remove(sa);
+
+   g_free(sa);
+}
+
+struct ofono_sim_auth *ofono_sim_auth_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver, void *data)
+{
+   struct ofono_sim_auth *sa;
+   GSList *l;
+
+   if (driver == NULL)
+   return NULL;
+
+   sa = g_try_new0(struct ofono_sim_auth, 1);
+
+   if (sa == NULL)
+   return NULL;
+
+   sa-atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_SIM_AUTH,
+   sim_auth_remove, sa);
+
+   for (l = g_drivers; l; l = l-next) {
+   const struct ofono_sim_auth_driver *drv = l-data;
+
+   if (g_strcmp0(drv-name, driver))
+   continue;
+
+   if (drv-probe(sa, vendor, data)  0)
+   continue;
+
+   sa-driver = drv;
+   break;
+   }
+
+   return sa;
+}
+
+void ofono_sim_auth_register(struct ofono_sim_auth *sa)
+{
+   __ofono_atom_register(sa-atom, sim_auth_unregister);
+}
+
+void ofono_sim_auth_remove(struct ofono_sim_auth *sa)
+{
+   __ofono_atom_free(sa-atom);
+}
+
+void ofono_sim_auth_set_data(struct ofono_sim_auth *sa, void *data)
+{
+   sa-driver_data = data;
+}
+
+void *ofono_sim_auth_get_data(struct ofono_sim_auth *sa)
+{
+   return sa-driver_data;

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

2011-01-17 Thread Aki Niemi
Hi,

2011/1/17 Denis Kenzior denk...@gmail.com:
 So these are redundant, unless the whole thing is rewritten as:

       allow send_destination=org.ofono 
 send_interface=org.ofono.SimToolkitAgent/
       allow send_destination=org.ofono 
 send_interface=org.ofono.PushNotificationAgent/
       allow send_destination=org.ofono 
 send_interface=org.ofono.SmartMessagingAgent/


 The agents are registered by the application, not ofono.  So the
 destination is in fact not org.ofono but a system bus connection owned
 by the application.  Hence the need to punch holes here.

This means we also need punch a hole for org.ofono.NetworkTime. The
only difference there to the above agent interfaces is that it's a
singleton and comes with no registration API on oFono side. Instead,
there is a custom plugin per agent implementation, like the one for
timed.

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


Re: [PATCH] TODO: Add task for adding EFcsp support

2011-01-17 Thread Aki Niemi
Hi,

2011/1/13 Aki Niemi aki.ni...@nokia.com:
 This task will add support for CPHS Customer Service Profile (CSP),
 and specifically for the CSP PLMN mode bit therein.
 ---
  TODO |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)

Unless there are objections, I will push this.

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