[PATCH 5/5][RfC] stk: Partially handle Refresh command.

2010-12-10 Thread Andrzej Zaborowski
Only the four "NAA initialisation" modes are handled at the moment.
---
 src/stk.c |   48 
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 09229ce..455bf35 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1951,6 +1951,10 @@ static gboolean handle_command_refresh(const struct 
stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
 {
+   struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
+   struct ofono_sim *sim = NULL;
+   struct ofono_atom *sim_atom;
+   int err;
GSList *l;
 
DBG("");
@@ -2004,6 +2008,50 @@ static gboolean handle_command_refresh(const struct 
stk_command *cmd,
cmd->refresh.icon_id.qualifier);
DBG("Alpha ID: %s", cmd->refresh.alpha_id);
 
+   sim_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+   OFONO_ATOM_TYPE_SIM);
+   if (sim_atom)
+   sim = __ofono_atom_get_data(sim_atom);
+
+   if (sim == NULL) {
+   rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   return TRUE;
+   }
+
+   if (cmd->qualifier < 4) {
+   int qualifier = stk->pending_cmd->qualifier;
+   GSList *file_list = stk->pending_cmd->refresh.file_list;
+
+   /* Don't free the list yet */
+   stk->pending_cmd->refresh.file_list = NULL;
+
+   /*
+* Queue the TERMINAL RESPONSE before triggering potential
+* file accesses.
+*/
+   err = stk_respond(stk, rsp, stk_command_cb);
+   if (err)
+   stk_command_cb(&failure, stk);
+
+   switch (qualifier) {
+   case 0:
+   __ofono_sim_refresh(sim, file_list, TRUE, TRUE);
+   break;
+   case 1:
+   __ofono_sim_refresh(sim, file_list, FALSE, FALSE);
+   break;
+   case 2:
+   case 3:
+   __ofono_sim_refresh(sim, file_list, FALSE, TRUE);
+   break;
+   }
+
+   g_slist_foreach(file_list, (GFunc) g_free, NULL);
+   g_slist_free(file_list);
+
+   return FALSE;
+   }
+
rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
return TRUE;
 }
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 4/5][RfC] sim: Watch files we keep in memory.

2010-12-10 Thread Andrzej Zaborowski
These are dummy watches on files who's state is kept in memory, just
to ensure that on a refresh affecting any of those files ofono
re-reads them from SIM.  The flow of the code in sim.c has become
a little complicated, maybe watches should be automatically set for
files that are being read and removed when the sim state changes to
a lower state or atom is removed, for example, but this wouldn't be
flexible enough for some of the corner cases.
---
 src/sim.c |   47 ++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index da098b7..2368b3d 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1192,15 +1192,28 @@ static void sim_ready(enum ofono_sim_state new_state, 
void *user)
 {
struct ofono_sim *sim = user;
 
-   if (new_state != OFONO_SIM_STATE_READY)
+   if (new_state != OFONO_SIM_STATE_READY) {
+   ofono_sim_remove_file_watch(sim, SIM_EFMSISDN_FILEID,
+   NULL, sim);
+   ofono_sim_remove_file_watch(sim, SIM_EFSDN_FILEID, NULL, sim);
+   ofono_sim_remove_file_watch(sim, SIM_EFIMG_FILEID, NULL, sim);
+
return;
+   }
 
sim_own_numbers_update(sim);
+   ofono_sim_add_file_watch(sim, SIM_EFMSISDN_FILEID,
+   OFONO_SIM_STATE_READY, NULL, sim);
 
ofono_sim_read(sim, SIM_EFSDN_FILEID, OFONO_SIM_FILE_STRUCTURE_FIXED,
sim_sdn_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFSDN_FILEID,
+   OFONO_SIM_STATE_READY, NULL, sim);
+
ofono_sim_read(sim, SIM_EFIMG_FILEID, OFONO_SIM_FILE_STRUCTURE_FIXED,
sim_efimg_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFIMG_FILEID,
+   OFONO_SIM_STATE_READY, NULL, sim);
 }
 
 static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
@@ -1464,6 +1477,9 @@ static void sim_efust_read_cb(int ok, int length, int 
record,
ofono_sim_read(sim, SIM_EFEST_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efest_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFEST_FILEID,
+   OFONO_SIM_STATE_INSERTED,
+   NULL, sim);
 
return;
}
@@ -1525,6 +1541,9 @@ static void sim_efphase_read_cb(int ok, int length, int 
record,
ofono_sim_read(sim, SIM_EFUST_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efust_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFUST_FILEID,
+   OFONO_SIM_STATE_INSERTED,
+   NULL, sim);
 
return;
}
@@ -1547,6 +1566,8 @@ static void sim_efphase_read_cb(int ok, int length, int 
record,
ofono_sim_read(sim, SIM_EFSST_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efsst_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFSST_FILEID,
+   OFONO_SIM_STATE_INSERTED, NULL, sim);
 }
 
 static void sim_initialize_after_pin(struct ofono_sim *sim)
@@ -1554,10 +1575,14 @@ static void sim_initialize_after_pin(struct ofono_sim 
*sim)
ofono_sim_read(sim, SIM_EFPHASE_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efphase_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFPHASE_FILEID,
+   OFONO_SIM_STATE_INSERTED, NULL, sim);
 
ofono_sim_read(sim, SIM_EFAD_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_ad_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EFAD_FILEID,
+   OFONO_SIM_STATE_INSERTED, NULL, sim);
 
/*
 * Read CPHS-support bits, this is still part of the SIM
@@ -1566,6 +1591,8 @@ static void sim_initialize_after_pin(struct ofono_sim 
*sim)
ofono_sim_read(sim, SIM_EF_CPHS_INFORMATION_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_cphs_information_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EF_CPHS_INFORMATION_FILEID,
+   OFONO_SIM_STATE_INSERTED, NULL, sim);
 }
 
 static void sim_pin_query_cb(const struct ofono_error *error,
@@ -1856,6 +1883,8 @@ static void sim_initialize(struct ofono_sim *sim)
ofono_sim_read(sim, SIM_EF_ICCID_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_iccid_read_cb, sim);
+   ofono_sim_add_file_watch(sim, SIM_EF_ICCID_FILEID,
+ 

[PATCH 3/5][RfC] sim: Implement file watching and basic refresh.

2010-12-10 Thread Andrzej Zaborowski
---
 src/ofono.h |4 ++
 src/sim.c   |  175 +++
 2 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index 792134b..6c660b6 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -296,6 +296,10 @@ ofono_bool_t __ofono_sim_service_available(struct 
ofono_sim *sim,
int ust_service,
int sst_service);
 
+void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
+   ofono_bool_t full_file_change,
+   ofono_bool_t naa_init);
+
 #include 
 
 typedef void (*__ofono_sms_sim_download_cb_t)(ofono_bool_t ok,
diff --git a/src/sim.c b/src/sim.c
index c523982..da098b7 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -92,6 +92,7 @@ struct ofono_sim {
struct ofono_watchlist *state_watches;
 
struct sim_fs *simfs;
+   GSList *fs_watches;
 
unsigned char *iidf_image;
 
@@ -113,6 +114,13 @@ struct service_number {
struct ofono_phone_number ph;
 };
 
+struct fs_watch {
+   int id;
+   enum ofono_sim_state reset_state;
+   ofono_sim_file_notify_t notify;
+   void *notify_data;
+};
+
 static const char *const passwd_name[] = {
[OFONO_SIM_PASSWORD_NONE] = "none",
[OFONO_SIM_PASSWORD_SIM_PIN] = "pin",
@@ -2172,6 +2180,12 @@ static void sim_remove(struct ofono_atom *atom)
sim->simfs = NULL;
}
 
+   if (sim->fs_watches != NULL) {
+   g_slist_foreach(sim->fs_watches, (GFunc) g_free, NULL);
+   g_slist_free(sim->fs_watches);
+   sim->fs_watches = NULL;
+   }
+
g_free(sim);
 }
 
@@ -2253,3 +2267,164 @@ void *ofono_sim_get_data(struct ofono_sim *sim)
 {
return sim->driver_data;
 }
+
+static gint fs_watch_compare_by_id(gconstpointer a, gconstpointer b)
+{
+   const struct fs_watch *w = a;
+   const int *id = b;
+
+   return w->id - *id;
+}
+
+int ofono_sim_add_file_watch(struct ofono_sim *sim, int id,
+   enum ofono_sim_state reset_state,
+   ofono_sim_file_notify_t notify, void *userdata)
+{
+   struct fs_watch *item;
+
+   DBG("%p", sim);
+
+   if (sim == NULL)
+   return 0;
+
+   if (notify == NULL)
+   return 0;
+
+   /* Currently there's no need for multiple watches per file */
+   if (g_slist_find_custom(sim->fs_watches, &id, fs_watch_compare_by_id))
+   return -EEXIST;
+
+   item = g_new0(struct fs_watch, 1);
+
+   item->id = id;
+   item->notify = notify;
+   item->notify_data = userdata;
+   item->reset_state = reset_state;
+
+   sim->fs_watches = g_slist_prepend(sim->fs_watches, item);
+
+   return id;
+}
+
+void ofono_sim_remove_file_watch(struct ofono_sim *sim, int id,
+   ofono_sim_file_notify_t notify, void *userdata)
+{
+   GSList *item = g_slist_find_custom(sim->fs_watches,
+   &id, fs_watch_compare_by_id);
+   if (!item)
+   return;
+
+   g_free(item->data);
+   sim->fs_watches = g_slist_remove(sim->fs_watches, item->data);
+}
+
+void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
+   ofono_bool_t full_file_change, ofono_bool_t naa_init)
+{
+   GSList *l;
+   enum sim_reset_state {
+   RESET_STATE_NOT_PRESENT = OFONO_SIM_STATE_NOT_PRESENT,
+   RESET_STATE_INSERTED= OFONO_SIM_STATE_INSERTED,
+   RESET_STATE_READY   = OFONO_SIM_STATE_READY,
+   RESET_STATE_NONE,
+   } reset_state = RESET_STATE_NONE;
+
+   /* Flush cached content for affected files */
+   if (full_file_change)
+   sim_fs_cache_flush(sim->simfs, 0);
+   else
+   for (l = file_list; l; l = l->next) {
+   struct stk_file *file = l->data;
+   int id = (file->file[file->len - 2] << 8) |
+   (file->file[file->len - 1] << 0);
+
+   sim_fs_cache_flush(sim->simfs, id);
+   }
+
+   if (naa_init)
+   reset_state = RESET_STATE_INSERTED;
+
+   /*
+* Check if we have file change handlers for all of the affected
+* files.  If not, we will fall back to re-initialising the
+* application which ensures that all files are re-read.
+*/
+   for (l = sim->fs_watches; l; l = l->next) {
+   struct fs_watch *w = l->data;
+
+   if (full_file_change) {
+   if (w->notify)
+   continue;
+
+   if (w->reset_state < reset_state)
+   reset_state = reset_state;
+
+   continue;
+   }
+
+   for (l = file_list; l; l = l->next) {

[PATCH 1/5] simfs: Cache flushing functions.

2010-12-10 Thread Andrzej Zaborowski
---
 src/simfs.c |   35 +++
 src/simfs.h |2 ++
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/simfs.c b/src/simfs.c
index 8e52f7b..2f58d9b 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -903,17 +903,39 @@ void sim_fs_check_version(struct sim_fs *fs)
const char *imsi = ofono_sim_get_imsi(fs->sim);
enum ofono_sim_phase phase = ofono_sim_get_phase(fs->sim);
unsigned char version;
-   struct dirent **entries;
-   int len;
-   char *path;
 
if (read_file(&version, 1, SIM_CACHE_VERSION, imsi, phase) == 1)
if (version == SIM_FS_VERSION)
return;
 
-   path = g_strdup_printf(SIM_CACHE_BASEPATH, imsi, phase);
+   sim_fs_cache_flush(fs,  0);
+
+   version = SIM_FS_VERSION;
+   write_file(&version, 1, SIM_CACHE_MODE, SIM_CACHE_VERSION, imsi, phase);
+}
+
+void sim_fs_cache_flush(struct sim_fs *fs, int id)
+{
+   const char *imsi = ofono_sim_get_imsi(fs->sim);
+   enum ofono_sim_phase phase = ofono_sim_get_phase(fs->sim);
+   int len;
+   char *path;
+   struct dirent **entries;
+
+   /* Id of 0 flushes all cache content */
+   if (id > 0) {
+   path = g_strdup_printf(SIM_CACHE_PATH, imsi, phase, id);
+   remove(path);
+   g_free(path);
+
+   path = g_strdup_printf(SIM_IMAGE_CACHE_PATH, imsi, phase, id);
+   remove(path);
+   g_free(path);
+
+   return;
+   }
 
-   ofono_info("Detected old simfs version in %s, removing", path);
+   path = g_strdup_printf(SIM_CACHE_BASEPATH, imsi, phase);
len = scandir(path, &entries, NULL, alphasort);
g_free(path);
 
@@ -940,7 +962,4 @@ void sim_fs_check_version(struct sim_fs *fs)
 
g_free(entries);
}
-
-   version = SIM_FS_VERSION;
-   write_file(&version, 1, SIM_CACHE_MODE, SIM_CACHE_VERSION, imsi, phase);
 }
diff --git a/src/simfs.h b/src/simfs.h
index ef962db..ace25bf 100644
--- a/src/simfs.h
+++ b/src/simfs.h
@@ -47,4 +47,6 @@ char *sim_fs_get_cached_image(struct sim_fs *fs, int id);
 
 void sim_fs_cache_image(struct sim_fs *fs, const char *image, int id);
 
+void sim_fs_cache_flush(struct sim_fs *fs, int id);
+
 void sim_fs_free(struct sim_fs *fs);
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 2/5][RfC] Add SIM filesystem watch api.

2010-12-10 Thread Andrzej Zaborowski
This allows code that reads files from the SIM card to also watch for
changes in these files signalled in a Refresh command by the SIM.
---
 include/sim.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 7860e24..aab981c 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -114,6 +114,8 @@ typedef void (*ofono_sim_lock_unlock_cb_t)(const struct 
ofono_error *error,
 typedef void (*ofono_sim_locked_cb_t)(const struct ofono_error *error,
int locked, void *data);
 
+typedef void (*ofono_sim_file_notify_t)(int id, void *userdata);
+
 struct ofono_sim_driver {
const char *name;
int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data);
@@ -207,6 +209,14 @@ int ofono_sim_write(struct ofono_sim *sim, int id,
 int ofono_sim_read_bytes(struct ofono_sim *sim, int id,
unsigned short offset, unsigned short num_bytes,
ofono_sim_file_read_cb_t cb, void *data);
+
+int ofono_sim_add_file_watch(struct ofono_sim *sim, int id,
+   enum ofono_sim_state reset_state,
+   ofono_sim_file_notify_t notify, void *userdata);
+
+void ofono_sim_remove_file_watch(struct ofono_sim *sim, int id,
+   ofono_sim_file_notify_t notify, void *userdata);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 3/3 v2] sms: restore pending tx messages from backup

2010-12-10 Thread Kristen Carlson Accardi
---
 src/ofono.h   |1 +
 src/sms.c |   75 ++
 src/smsutil.c |  143 +
 src/smsutil.h |8 +++
 4 files changed, 227 insertions(+), 0 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index 792134b..c8e6cf0 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -243,6 +243,7 @@ enum ofono_sms_submit_flag {
OFONO_SMS_SUBMIT_FLAG_RECORD_HISTORY =  0x2,
OFONO_SMS_SUBMIT_FLAG_RETRY =   0x4,
OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS = 0x8,
+   OFONO_SMS_SUBMIT_FLAG_REUSE_UUID =  0x10,
 };
 
 typedef void (*ofono_sms_txq_submit_cb_t)(gboolean ok, void *data);
diff --git a/src/sms.c b/src/sms.c
index dd4d27c..42ca034 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -929,6 +929,9 @@ static struct tx_queue_entry *tx_queue_entry_new(GSList 
*msg_list,
pdu->pdu_len, pdu->tpdu_len);
}
 
+   if (flags & OFONO_SMS_SUBMIT_FLAG_REUSE_UUID)
+   return entry;
+
if (sms_uuid_from_pdus(entry->pdus, entry->num_pdus, &entry->uuid))
return entry;
 
@@ -1808,6 +1811,77 @@ static void bearer_init_callback(const struct 
ofono_error *error, void *data)
ofono_error("Error bootstrapping SMS Bearer Preference");
 }
 
+static void sms_restore_tx_queue(struct ofono_sms *sms)
+{
+   GQueue *backupq;
+   struct txq_backup_entry *backup_entry;
+   struct ofono_uuid ofono_uuid;
+
+   DBG("");
+
+   backupq = sms_tx_queue_load(sms->imsi);
+
+   while ((backup_entry = g_queue_pop_head(backupq))) {
+   struct message *m;
+   struct tx_queue_entry *txq_entry;
+
+   decode_hex_own_buf(backup_entry->uuid, -1, NULL, 0,
+   ofono_uuid.uuid);
+
+   backup_entry->flags |= OFONO_SMS_SUBMIT_FLAG_REUSE_UUID;
+
+   txq_entry = tx_queue_entry_new(backup_entry->msg_list,
+   backup_entry->flags);
+
+   if (txq_entry == NULL)
+   goto loop_out;
+
+   txq_entry->flags &= ~OFONO_SMS_SUBMIT_FLAG_REUSE_UUID;
+
+   memcpy(&txq_entry->uuid, &ofono_uuid, sizeof(ofono_uuid));
+
+   m = message_create(&txq_entry->uuid);
+
+   if (m == NULL) {
+   tx_queue_entry_destroy(txq_entry);
+   goto loop_out;
+   }
+
+   if (message_dbus_register(sms, m) == FALSE) {
+   tx_queue_entry_destroy(txq_entry);
+   goto loop_out;
+   }
+
+   g_hash_table_insert(sms->messages, &m->uuid, m);
+   m->entry = txq_entry;
+
+   if (backup_entry->msg_list->next != NULL) {
+   if (sms->ref == 65536)
+   sms->ref = 1;
+   else
+   sms->ref = sms->ref + 1;
+   }
+
+   txq_entry->id = sms->tx_counter++;
+
+   g_queue_push_tail(sms->txq, txq_entry);
+
+   if (g_queue_get_length(sms->txq) == 1)
+   sms->tx_source = g_timeout_add(0, tx_next, sms);
+
+   if (backup_entry->flags & OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS)
+   emit_message_added(sms, m);
+loop_out:
+   g_slist_foreach(backup_entry->msg_list, (GFunc)g_free, NULL);
+   g_slist_free(backup_entry->msg_list);
+
+   g_free(backup_entry->uuid);
+   g_free(backup_entry);
+   }
+
+   g_queue_free(backupq);
+}
+
 /*
  * Indicate oFono that a SMS driver is ready for operation
  *
@@ -1871,6 +1945,7 @@ void ofono_sms_register(struct ofono_sms *sms)
if (sms->driver->bearer_set)
sms->driver->bearer_set(sms, sms->bearer,
bearer_init_callback, sms);
+   sms_restore_tx_queue(sms);
 
sms->text_handlers = __ofono_watchlist_new(g_free);
sms->datagram_handlers = __ofono_watchlist_new(g_free);
diff --git a/src/smsutil.c b/src/smsutil.c
index 09da657..3d33a54 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -2327,6 +2327,15 @@ static gboolean sms_deserialize(const unsigned char *buf,
return sms_decode(buf + 1, len - 1, FALSE, buf[0], sms);
 }
 
+static gboolean sms_deserialize_outgoing(const unsigned char *buf,
+   struct sms *sms, int len)
+{
+   if (len < 1)
+   return FALSE;
+
+   return sms_decode(buf + 1, len - 1, TRUE, buf[0], sms);
+}
+
 static gboolean sms_assembly_extract_address(const char *straddr,
struct sms_address *out)
 {
@@ -3147,6 +3156,140 @@ void status_report_assembly_expire(struct 
status_report_assembly *assembly,
}
 }
 
+/*
+ * Each directory contains a file per pdu.
+ */
+static GSList *sms_tx_load(const char *im

[PATCH 2/3 v2] sms: delete sent sms messages from backup

2010-12-10 Thread Kristen Carlson Accardi
---
 src/sms.c |7 +++
 src/smsutil.c |   45 +
 src/smsutil.h |5 +
 3 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index e5e06db..dd4d27c 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -766,6 +766,10 @@ static void tx_finished(const struct ofono_error *error, 
int mr, void *data)
goto next_q;
}
 
+   sms_tx_backup_remove(sms->imsi, entry->id, entry->flags,
+   ofono_uuid_to_str(&entry->uuid),
+   entry->cur_pdu);
+
entry->cur_pdu += 1;
entry->retry = 0;
 
@@ -810,6 +814,9 @@ next_q:
message_set_state(sms, &entry->uuid, ms);
}
 
+   sms_tx_backup_free(sms->imsi, entry->id, entry->flags,
+   ofono_uuid_to_str(&entry->uuid));
+
tx_queue_entry_destroy(entry);
 
if (g_queue_peek_head(sms->txq)) {
diff --git a/src/smsutil.c b/src/smsutil.c
index 9c6596f..09da657 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -3169,6 +3169,51 @@ gboolean sms_tx_store(const char *imsi, unsigned long 
id, unsigned long flags,
return TRUE;
 }
 
+void sms_tx_backup_free(const char *imsi, unsigned long id,
+   unsigned long flags, const char *uuid)
+{
+   char *path;
+   struct dirent **entries;
+   int len;
+
+   path = g_strdup_printf(SMS_TX_BACKUP_PATH_DIR,
+   imsi, id, flags, uuid);
+
+   len = scandir(path, &entries, NULL, versionsort);
+
+   if (len < 0)
+   return;
+
+   while (len--) {
+   struct dirent *dir = entries[len];
+   char *file = g_strdup_printf("%s/%s", path, dir->d_name);
+
+   unlink(file);
+
+   g_free(file);
+   g_free(entries[len]);
+   }
+
+   g_free(entries);
+
+   rmdir(path);
+
+   g_free(path);
+}
+
+void sms_tx_backup_remove(const char *imsi, unsigned long id,
+   unsigned long flags, const char *uuid,
+   guint8 seq)
+{
+   char *path;
+
+   path = g_strdup_printf(SMS_TX_BACKUP_PATH_FILE,
+   imsi, id, flags, uuid, seq);
+   unlink(path);
+
+   g_free(path);
+}
+
 static inline GSList *sms_list_append(GSList *l, const struct sms *in)
 {
struct sms *sms;
diff --git a/src/smsutil.h b/src/smsutil.h
index 46084ab..fa4e453 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -519,6 +519,11 @@ void status_report_assembly_expire(struct 
status_report_assembly *assembly,
 
 gboolean sms_tx_store(const char *imsi, unsigned long id, unsigned long flags,
const char *uuid, struct sms *s, guint8 seq);
+void sms_tx_backup_remove(const char *imsi, unsigned long id,
+   unsigned long flags, const char *uuid,
+   guint8 seq);
+void sms_tx_backup_free(const char *imsi, unsigned long id,
+   unsigned long flags, const char *uuid);
 
 GSList *sms_text_prepare(const char *to, const char *utf8, guint16 ref,
gboolean use_16bit,
-- 
1.7.2.3

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


[PATCH 1/3 v2] sms: store pending tx pdus on disk

2010-12-10 Thread Kristen Carlson Accardi
---
 src/sms.c |   15 +++
 src/smsutil.c |   26 ++
 src/smsutil.h |3 +++
 3 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index 163eab0..e5e06db 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -77,6 +77,7 @@ struct ofono_sms {
struct sms_assembly *assembly;
guint ref;
GQueue *txq;
+   unsigned long tx_counter;
guint tx_source;
struct ofono_message_waiting *mw;
unsigned int mw_watch;
@@ -111,6 +112,7 @@ struct tx_queue_entry {
ofono_sms_txq_submit_cb_t cb;
void *data;
ofono_destroy_func destroy;
+   unsigned long id;
 };
 
 static gboolean uuid_equal(gconstpointer v1, gconstpointer v2)
@@ -1896,6 +1898,8 @@ int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList 
*list,
 {
struct message *m = NULL;
struct tx_queue_entry *entry;
+   int i;
+   GSList *l;
 
entry = tx_queue_entry_new(list, flags);
if (entry == NULL)
@@ -1920,6 +1924,8 @@ int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList 
*list,
sms->ref = sms->ref + 1;
}
 
+   entry->id = sms->tx_counter++;
+
g_queue_push_tail(sms->txq, entry);
 
if (g_queue_get_length(sms->txq) == 1)
@@ -1928,6 +1934,15 @@ int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList 
*list,
if (uuid)
memcpy(uuid, &entry->uuid, sizeof(*uuid));
 
+   if (flags & OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS) {
+   for (i = 0, l = list; l; i++, l = l->next) {
+   struct sms *s = l->data;
+   sms_tx_store(sms->imsi, entry->id, entry->flags,
+   ofono_uuid_to_str(&entry->uuid),
+   s, i);
+   }
+   }
+
if (cb)
cb(sms, &entry->uuid, data);
 
diff --git a/src/smsutil.c b/src/smsutil.c
index 5e1d233..9c6596f 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -48,6 +48,10 @@
 #define SMS_SR_BACKUP_PATH STORAGEDIR "/%s/sms_sr"
 #define SMS_SR_BACKUP_PATH_FILE SMS_SR_BACKUP_PATH "/%s-%s"
 
+#define SMS_TX_BACKUP_PATH STORAGEDIR "/%s/tx_queue"
+#define SMS_TX_BACKUP_PATH_DIR SMS_TX_BACKUP_PATH "/%lu-%lu-%s"
+#define SMS_TX_BACKUP_PATH_FILE SMS_TX_BACKUP_PATH_DIR "/%03i"
+
 #define SMS_ADDR_FMT "%24[0-9A-F]"
 #define SMS_MSGID_FMT "%40[0-9A-F]"
 
@@ -3143,6 +3147,28 @@ void status_report_assembly_expire(struct 
status_report_assembly *assembly,
}
 }
 
+gboolean sms_tx_store(const char *imsi, unsigned long id, unsigned long flags,
+   const char *uuid, struct sms *s, guint8 seq)
+{
+   int len;
+   unsigned char buf[177];
+
+   if (!imsi)
+   return FALSE;
+
+   len = sms_serialize(buf, s);
+
+   /*
+* file name is: imsi/order in tx_queue-flags-uuid/order of pdus
+*/
+   if (write_file(buf, len, SMS_BACKUP_MODE,
+   SMS_TX_BACKUP_PATH_FILE, imsi, id, flags, uuid,
+   seq) != len)
+   return FALSE;
+
+   return TRUE;
+}
+
 static inline GSList *sms_list_append(GSList *l, const struct sms *in)
 {
struct sms *sms;
diff --git a/src/smsutil.h b/src/smsutil.h
index 4b6159f..46084ab 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -517,6 +517,9 @@ void status_report_assembly_add_fragment(struct 
status_report_assembly
 void status_report_assembly_expire(struct status_report_assembly *assembly,
time_t before);
 
+gboolean sms_tx_store(const char *imsi, unsigned long id, unsigned long flags,
+   const char *uuid, struct sms *s, guint8 seq);
+
 GSList *sms_text_prepare(const char *to, const char *utf8, guint16 ref,
gboolean use_16bit,
gboolean use_delivery_reports);
-- 
1.7.2.3

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


Re: [PATCH 0/5] Call Counters (2nd)

2010-12-10 Thread Rémi Denis-Courmont
On Friday 10 December 2010 20:34:47 ext Marcel Holtmann, you wrote:
> Hi Remi,
> 
> > > > Personally I think the every-10sec interval is too short.
> > > > It's also highly system specific when wakeups start to get
> > > > too costly, so picking up one value seems difficult.
> > > 
> > > My take here is that a granularity of 1 minute is enough.
> > 
> > There are definitely call fares with sub-minute granularity. The minute
> > is definitely INSUFFICIENT.
> 
> let me repeat my question here. Does this suppose to be represent spent
> time on calls (what I called talk time) or actual billing minutes.

As said earlier, this is about the talk time. The scenario is a user ejects 
the battery during an already long-standing call or gets the device to crash 
or reset, gets billed, and comes and complain to its operator that (s)he gets 
overcharged. The counters will be much more wrong if we do not flush them to 
disk frequently.

We do not need to "implement" the billing policy for that. This is only about 
the total talk time.

> If we talk about correct billing minutes then you are just opening
> pandora's box. Since we don't know the billing. And difference between
> air time, incoming/outgoing calls, multiparty calls, hold calls etc. and
> their billing schemes make this just insane.

Sure. We don't wants this.

> So what is the actual requirement here. So far ever single answer was
> not satisfying. And that is why I proposed to just make this count the
> talk time.

The requirement is that the user cannot deduct (much) talk time from the call 
counters.

> > > Doing this every 10 seconds and displaying it on a per second level
> > > sounds insane to me.
> > 
> > So I made a lengthy call to my mum this morning, using a desk phone. And
> > it was showing minute:second, not just minutes. I have never seen a
> > phone that does not show seconds and it would look pretty dumb to me.
> 
> You do realize that this is NOT the feature we are talking about here.
> 
> The actual display of the duration of a call is pretty simple and
> currently easy to handle inside the UI. And that can be done up to the
> millisecond display if you or your UI designer wants it.
> 
> The proposed call counters here are long term counters showing your
> overall time. So showing minutes seems to be precise enough.

Showing minutes, as in flushing the counters every 60 seconds might work, but 
I'd rather make this a configurable knob.

That said, I do believe the stored value has to be more precise than minutes. 
Otherwise per call "error" may add up far too quickly.

-- 
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle
---
 TODO |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 8d771d6..cbcdac5 100644
--- a/TODO
+++ b/TODO
@@ -484,3 +484,61 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
   Owner: Sjur Brændeland 
+
+CDMA Voicecall
+==
+
+- Add support for Mobile Originated and Mobile Terminated Voice Call over
+  a CDMA network. This includes management of call state and providing
+  appropriate values for the LineIdentification in each case.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Three-Way Calling over a CDMA network. Three-Way Calling
+  provides the subscriber with the capability to add a third party to an
+  established two-party call, so that all three parties may communicate in a
+  three-way call.
+
+  In CDMA mode, the originating subscriber of a current conversation can
+  request for a third party to be added to a conversation by sending a Flash
+  With Information Message (FWIM) with dialed digits to the network. Upon
+  setting up a two-way conversation with the added party, the originating
+  subscriber can request to establish a three-way conversation by sending
+  another Flash With Information Message. Upon receiving the second Flash With
+  Information Message, the MSC reconnects the original party to the
+  conversation thus completing the setup of a three-way conversation.
+
+  CDMA Three-Way Calling is described by Figure B-5 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
+  notification of an incoming call to an originating subscriber, while the
+  subscriber's call is in the 2-way state. Subsequently, the originating
+  subscriber can either answer or ignore the incoming call. If the originating
+  subscriber answers the second call, it may alternate between the two calls.
+
+  In CDMA mode, the originating subscriber of a current conversation will
+  receive either a Flash With Information Message or an Alert With Information
+  Message from the network if there is an additional mobile terminated voice
+  call incoming. The originating subscriber can change conversation parties by
+  sending a Flash With Information Message to the network and the MSC will
+  toggle the speech path between the two conversations.
+
+  CDMA Call Waiting is described by Figure B-6 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Support sending DTMF tones over CDMA network.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
-- 
1.7.0.4

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


Re: [PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle

On Fri, 2010-12-10 at 23:44 +0100, Spieker-Doyle Dara
(Nokia-MS/SanDiego) wrote:
> ---
>  TODO |   58 ++
>  1 files changed, 58 insertions(+), 0 deletions(-)
> 

Apologies for the versioning error on this patch, please ignore this and
I will send a correct version.

Thank you
Dara

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


[PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle
---
 TODO |   58 ++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 8d771d6..cbcdac5 100644
--- a/TODO
+++ b/TODO
@@ -484,3 +484,61 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
   Owner: Sjur Brændeland 
+
+CDMA Voicecall
+==
+
+- Add support for Mobile Originated and Mobile Terminated Voice Call over
+  a CDMA network. This includes management of call state and providing
+  appropriate values for the LineIdentification in each case.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Three-Way Calling over a CDMA network. Three-Way Calling
+  provides the subscriber with the capability to add a third party to an
+  established two-party call, so that all three parties may communicate in a
+  three-way call.
+
+  In CDMA mode, the originating subscriber of a current conversation can
+  request for a third party to be added to a conversation by sending a Flash
+  With Information Message (FWIM) with dialed digits to the network. Upon
+  setting up a two-way conversation with the added party, the originating
+  subscriber can request to establish a three-way conversation by sending
+  another Flash With Information Message. Upon receiving the second Flash With
+  Information Message, the MSC reconnects the original party to the
+  conversation thus completing the setup of a three-way conversation.
+
+  CDMA Three-Way Calling is described by Figure B-5 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Add support for Call Waiting over a CDMA network. Call Waiting (CW) provides
+  notification of an incoming call to an originating subscriber, while the
+  subscriber's call is in the 2-way state. Subsequently, the originating
+  subscriber can either answer or ignore the incoming call. If the originating
+  subscriber answers the second call, it may alternate between the two calls.
+
+  In CDMA mode, the originating subscriber of a current conversation will
+  receive either a Flash With Information Message or an Alert With Information
+  Message from the network if there is an additional mobile terminated voice
+  call incoming. The originating subscriber can change conversation parties by
+  sending a Flash With Information Message to the network and the MSC will
+  toggle the speech path between the two conversations.
+
+  CDMA Call Waiting is described by Figure B-6 in 3GPP2 C.S0005-E Version
+  2.0.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
+
+- Support sending DTMF tones over CDMA network.
+
+  Priority: High
+  Complexity: C2
+  Owner: Dara Spieker-Doyle 
-- 
1.7.0.4

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


Re: [PATCH 3/5] cdma-atmodem: Add CDMA MO Call Support

2010-12-10 Thread Dara Spieker-Doyle
Hi Denis

On Thu, 2010-12-09 at 09:43 +0100, ext Denis Kenzior wrote:

> 
> >  drivers/cdma-atmodem/atutil.c|   45 +
> >  drivers/cdma-atmodem/atutil.h|   65 +
> 
> Are these verbatim copies of atmodem/atutil.[ch]?  If so, then there's
> no reason why you can't re-use those.  No need to copy them.

No, they are not verbatim copies as e.g. error decoding is different.
Would you prefer we clarify this by renaming the files cdmautil.(ch)?

> > +
> > + ofono_cdma_voicecall_manager_disconnected(req->vc,
> > + OFONO_DISCONNECT_REASON_LOCAL_HANGUP, NULL);
> > + CALLBACK_WITH_SUCCESS(req->cb, req->data);
> > +
> 
> Why the extra empty line?
> 
> How do we handle remote side hanging up?

This is future work as part of the overall design of call state
management with transitions initiated from the modem.
Our current hardware has limitations where such notifications are not
supported.

Cheers
Dara


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


Re: [PATCH 2/5] cdma-voicecall: Add CDMA MO Call Support

2010-12-10 Thread Dara Spieker-Doyle
Hi Denis

Thank you for reviewing this series of patches. We shall submit new
versions according to your comments. Please find any other clarifying
points inline.

On Thu, 2010-12-09 at 09:36 +0100, ext Denis Kenzior wrote:

> > +
> > +static void voicecall_set_call_status(struct ofono_cdma_voicecall_manager 
> > *vc,
> > + enum cdma_call_status status)
> > +{
> > + DBusConnection *conn = ofono_dbus_get_connection();
> > + const char *path;
> > + const char *status_str;
> > + enum cdma_call_status old_status;
> > +
> > + if (vc->status == status)
> > + return;
> > +
> > + old_status = vc->status;
> > +
> > + vc->status = status;
> > +
> > + status_str = cdma_call_status_to_string(status);
> > + path = voicecall_build_path(vc);
> > +
> > + ofono_dbus_signal_property_changed(conn, path,
> > + 
> > OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
> > + "State", DBUS_TYPE_STRING,
> > + &status_str);
> > +
> > + if (status == CDMA_CALL_STATUS_ACTIVE &&
> > + old_status == CDMA_CALL_STATUS_DIALING) {
> > + const char *timestr;
> > +
> > + vc->start_time = time(NULL);
> > + timestr = time_to_str(&vc->start_time);
> 
> So in GSM we only timestamp the call once it moves to the active state.
>  Do you really want to timestamp it in the dialing stage?

I'm not sure what you mean here? We are carrying out the timestamp when
the status is active having previously been dialing in a similar way to
GSM. 
In this patch, setting of the state to active is not supported yet due
to our current hardware limitations, so the time implementation has been
provided but is untested. If you would prefer us to remove the
timestamping altogether from this patch, we can do?

> 
> > +
> > + ofono_dbus_signal_property_changed(conn, path,
> > + 
> > OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
> > + "StartTime", DBUS_TYPE_STRING,
> > + ×tr);
> > + }
> > +}
> > +
> > +static void voicecall_set_call_lineid(struct ofono_cdma_voicecall_manager 
> > *v)
> > +{
> > + DBusConnection *conn = ofono_dbus_get_connection();
> > + const char *path;
> > + const char *lineid_str;
> > +
> > + path = voicecall_build_path(v);
> > +
> > + /* For MO calls, LineID is the dialed phone number */
> > + lineid_str = cdma_phone_number_to_string(&v->phone_number);
> > +
> > + ofono_dbus_signal_property_changed(conn, path,
> > + 
> > OFONO_CDMA_VOICECALL_MANAGER_INTERFACE,
> > + "LineIdentification",
> > + DBUS_TYPE_STRING, &lineid_str);
> > +}
> > +
> > +static void manager_dial_callback(const struct ofono_error *error, void 
> > *data)
> > +{
> > + struct ofono_cdma_voicecall_manager *vc = data;
> > + DBusMessage *reply;
> > +
> > + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
> > + reply = __ofono_error_failed(vc->pending);
> > + } else {
> > + const char *path = voicecall_build_path(vc);
> 
> what path are you returning here?  This is not in the API proposal...

This was an oversight, thank you for catching it- I will remove this.

> 
> > +
> > + reply = dbus_message_new_method_return(vc->pending);
> > +
> > + dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
> > + DBUS_TYPE_INVALID);
> > + }
> 
> In general the preferred style is:
> 
> if (foo) {
> bar
> } else
> blah
> 
> > +
> > + __ofono_dbus_pending_reply(&vc->pending, reply);
> > +}
> > +
> > +static DBusMessage *voicecall_manager_dial(DBusConnection *conn,
> > + DBusMessage *msg, void *data)
> > +{
> > + struct ofono_cdma_voicecall_manager *vc = data;
> > + const char *number;
> > +
> > + if (vc->pending)
> > + return __ofono_error_busy(msg);
> > +
> > + if (vc->status != CDMA_CALL_STATUS_DISCONNECTED)
> > + return __ofono_error_failed(msg);
> > +
> > + if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &number,
> > + DBUS_TYPE_INVALID) == FALSE)
> > + return __ofono_error_invalid_args(msg);
> > +
> > + if (!valid_cdma_phone_number_format(number))
> > + return __ofono_error_invalid_format(msg);
> > +
> > + if (vc->driver->dial == NULL)
> > + return __ofono_error_not_implemented(msg);
> > +
> > + vc->pending = dbus_message_ref(msg);
> > +
> > + string_to_cdma_phone_number(number, &vc->phone_number);
> > + voicecall_set_call_lineid(vc);
> > + vc->direction = CALL_DIRECTION_MOBILE_ORIGINATED;
> > + voicecall_set_call

Re: [PATCH] TODO: Add CDMA Voicecall Support Tasks

2010-12-10 Thread Dara Spieker-Doyle
Hi Denis

On Thu, 2010-12-09 at 09:04 +0100, ext Denis Kenzior wrote:

> 
> Patch looks good to me, however it does not apply:
> 
> fatal: cannot convert from unknown-8bit to UTF-8
> 
Thank you. We are currently investigating this format issue and will
submit a new version once resolved.

Cheers
Dara


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


Re: [PATCH 04/14] TODO: Add onwer to CNAP task

2010-12-10 Thread Denis Kenzior
Hi Gustavo,

On 12/06/2010 02:12 PM, Gustavo F. Padovan wrote:
> ---
>  TODO |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 

Patch seems to be no longer necessary.

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


Re: [PATCH 02/14] atmodem: use macros for CLIP validity

2010-12-10 Thread Denis Kenzior
Hi Gustavo,

On 12/06/2010 02:12 PM, Gustavo F. Padovan wrote:
> ---
>  drivers/atmodem/voicecall.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [PATCH 03/14] atmodem: cleanup DBG messages

2010-12-10 Thread Denis Kenzior
Hi Gustavo,

On 12/06/2010 02:12 PM, Gustavo F. Padovan wrote:
> ---
>  drivers/atmodem/call-settings.c |8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [PATCH 01/14] test: fix bug in test-ss-control-cs

2010-12-10 Thread Denis Kenzior
Hi Gustavo,

On 12/06/2010 02:12 PM, Gustavo F. Padovan wrote:
> ---
>  test/test-ss-control-cs |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

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


[PATCH 7/7] TODO: Marking the Read/Write EFcfis task as done

2010-12-10 Thread Jeevaka Badrappan
---
 TODO |9 -
 doc/features.txt |5 +
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/TODO b/TODO
index 8d771d6..45c3577 100644
--- a/TODO
+++ b/TODO
@@ -92,15 +92,6 @@ SMS
 SIM / SIM File system
 =
 
-- Read / Write EFcfis.  Call forwarding settings can be bootstrapped on the
-  SIM for faster notification of the user that call forwarding is active.
-  These settings are stored in EFcfis.  oFono should read these settings and
-  update the call forwarding atom appropriately.
-
-  Priority: Low
-  Complexity: C2
-  Owner: Jeevaka Badrappan 
-
 - SIM Call History plugin.  New UICCs support four new SIM elementary files
   for storing call history information on the SIM: EFici, EFict, EFoci, EFoct.
   A plugin should be developed for oFono that will write to these files.
diff --git a/doc/features.txt b/doc/features.txt
index 950ec9a..6850d0b 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -222,6 +222,11 @@ SIM
   oFono halts the SIM initialization procedure and the modem remains in the
   PRESIM state.  In this state oFono will only allow emergency calls.
 
+- Read / Write EFcfis / EFcphs-cff.  oFono reads EFcfis/EFcphs-cff SIM files
+  to check if VoiceUnconditional call forwarding rule is enabled.  If enabled,
+  ForwardingFlagOnSim will be set and VoiceUnconditional may contain the
+  "forwarded to" number if the number is available.
+
 Radio settings
 ==
 
-- 
1.7.0.4

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


[PATCH 6/7] doc: Add new property to call forwarding

2010-12-10 Thread Jeevaka Badrappan
---
 doc/call-forwarding-api.txt |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/doc/call-forwarding-api.txt b/doc/call-forwarding-api.txt
index 067531a..e8b4b9f 100644
--- a/doc/call-forwarding-api.txt
+++ b/doc/call-forwarding-api.txt
@@ -57,3 +57,8 @@ Propertiesstring VoiceUnconditional [readwrite]
 
Contains the value of the voice "Not Reachable" call
forwarding rule.
+
+   boolean ForwardingFlagOnSim [readonly]
+
+   Boolean representing the voice unconditional call
+   forwarding rule status.
-- 
1.7.0.4

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


[PATCH 5/7] phonesim: Move call forwarding to post sim

2010-12-10 Thread Jeevaka Badrappan
---
 plugins/phonesim.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/plugins/phonesim.c b/plugins/phonesim.c
index c7ef0d7..b4795f2 100644
--- a/plugins/phonesim.c
+++ b/plugins/phonesim.c
@@ -635,6 +635,8 @@ static void phonesim_post_sim(struct ofono_modem *modem)
if (!data->calypso)
ofono_stk_create(modem, OFONO_VENDOR_PHONESIM,
"atmodem", data->chat);
+
+   ofono_call_forwarding_create(modem, 0, "atmodem", data->chat);
 }
 
 static void phonesim_post_online(struct ofono_modem *modem)
@@ -647,7 +649,6 @@ static void phonesim_post_online(struct ofono_modem *modem)
DBG("%p", modem);
 
ofono_ussd_create(modem, 0, "atmodem", data->chat);
-   ofono_call_forwarding_create(modem, 0, "atmodem", data->chat);
ofono_call_settings_create(modem, 0, "atmodem", data->chat);
 
if (data->calypso)
-- 
1.7.0.4

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


[PATCH 4/7] plugins/n900: Move call forwarding to post sim

2010-12-10 Thread Jeevaka Badrappan
---
 plugins/n900.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/n900.c b/plugins/n900.c
index 7619821..9b16f4d 100644
--- a/plugins/n900.c
+++ b/plugins/n900.c
@@ -491,6 +491,7 @@ static void n900_post_sim(struct ofono_modem *modem)
DBG("");
 
ofono_phonebook_create(isi->modem, 0, "isimodem", isi->idx);
+   ofono_call_forwarding_create(isi->modem, 0, "isimodem", isi->idx);
 }
 
 static void n900_post_online(struct ofono_modem *modem)
@@ -506,7 +507,6 @@ static void n900_post_online(struct ofono_modem *modem)
ofono_cbs_create(isi->modem, 0, "isimodem", isi->idx);
ofono_ssn_create(isi->modem, 0, "isimodem", isi->idx);
ofono_ussd_create(isi->modem, 0, "isimodem", isi->idx);
-   ofono_call_forwarding_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_settings_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_barring_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_meter_create(isi->modem, 0, "isimodem", isi->idx);
-- 
1.7.0.4

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


[PATCH 1/7] call-forwarding: Read/Write cfis/cphs-cff

2010-12-10 Thread Jeevaka Badrappan
---
 src/call-forwarding.c |  246 -
 1 files changed, 245 insertions(+), 1 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index bb8aa37..69427a8 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -34,6 +34,7 @@
 #include "ofono.h"
 
 #include "common.h"
+#include "simutil.h"
 
 #define CALL_FORWARDING_FLAG_CACHED 0x1
 
@@ -58,6 +59,12 @@ struct ofono_call_forwarding {
int query_next;
int query_end;
struct cf_ss_request *ss_req;
+   struct ofono_sim *sim;
+   unsigned char cfis_record_id;
+   unsigned char cfis_indicator;
+   char *cfu_number;
+   ofono_bool_t cphs_cff_present;
+   ofono_bool_t status_on_sim;
struct ofono_ussd *ussd;
unsigned int ussd_watch;
const struct ofono_call_forwarding_driver *driver;
@@ -202,6 +209,94 @@ static const char *cf_type_lut[] = {
"AllConditional"
 };
 
+static void sim_cfis_update_cb(int ok, void *data)
+{
+   if (!ok)
+   ofono_info("Failed to update EFcfis");
+}
+
+static void sim_cphs_cff_update_cb(int ok, void *data)
+{
+   if (!ok)
+   ofono_info("Failed to update EFcphs-cff");
+}
+
+static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
+{
+   gboolean cfu_voice = FALSE;
+   struct ofono_call_forwarding_condition *cond = NULL;
+   GSList *l;
+   const char *number = NULL;
+
+   /*
+* For now we only support Voice, although Fax & all Data
+* basic services are applicable as well.
+*/
+   for (l = cf->cf_conditions[0]; l; l = l->next) {
+   cond = l->data;
+
+   if ((cond->cls & BEARER_CLASS_VOICE) &&
+   (strlen(cond->phone_number.number) > 0)) {
+   number = phone_number_to_string(&cond->phone_number);
+   cfu_voice = TRUE;
+   break;
+   }
+   }
+
+   if (cfu_voice == cf->status_on_sim &&
+   !g_strcmp0(number, cf->cfu_number))
+   return;
+
+   cf->status_on_sim = cfu_voice;
+
+   if (cf->cfis_record_id) {
+   unsigned char data[16];
+   int number_len;
+
+   memset(data, 0xff, sizeof(data));
+
+   /* Profile Identifier */
+   data[0] = 0x01;
+
+   if (cfu_voice) {
+   number_len = strlen(cond->phone_number.number);
+
+   /* CFU indicator Status - Voice */
+   data[1] = (cf->cfis_indicator |= 0x01);
+   number_len = (number_len + 1) / 2;
+   data[2] = number_len + 1;
+   data[3] = cond->phone_number.type;
+
+   g_free(cf->cfu_number);
+   cf->cfu_number = g_strdup(number);
+
+   sim_encode_bcd_number(cond->phone_number.number,
+   data + 4);
+   } else {
+   data[1] = (cf->cfis_indicator &= 0xFE);
+
+   g_free(cf->cfu_number);
+   cf->cfu_number = NULL;
+   }
+
+   ofono_sim_write(cf->sim, SIM_EFCFIS_FILEID,
+   sim_cfis_update_cb,
+   OFONO_SIM_FILE_STRUCTURE_FIXED,
+   cf->cfis_record_id, data,
+   sizeof(data), cf);
+   return;
+   }
+
+   if (cf->cphs_cff_present) {
+   unsigned char cff_voice = cfu_voice ? 0x0A : 0x05;
+
+   ofono_sim_write(cf->sim, SIM_EF_CPHS_CFF_FILEID,
+   sim_cphs_cff_update_cb,
+   OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+   0, &cff_voice, sizeof(cff_voice), cf);
+   }
+}
+
 static void set_new_cond_list(struct ofono_call_forwarding *cf,
int type, GSList *list)
 {
@@ -312,6 +407,9 @@ static void set_new_cond_list(struct ofono_call_forwarding 
*cf,
 
cf_list_clear(old);
cf->cf_conditions[type] = list;
+
+   if (cf->query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL)
+   sim_set_cf_indicator(cf);
 }
 
 static inline void property_append_cf_condition(DBusMessageIter *dict, int cls,
@@ -372,6 +470,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage 
*msg,
DBusMessageIter iter;
DBusMessageIter dict;
int i;
+   dbus_bool_t status;
 
reply = dbus_message_new_method_return(msg);
if (reply == NULL)
@@ -388,6 +487,10 @@ static DBusMessage *cf_get_properties_reply(DBusMessage 
*msg,
BEARER_CLASS_VOICE,
cf_type_lut[i]);
 
+   status = c

[PATCH 3/7] isigen: Move call forwarding to post sim

2010-12-10 Thread Jeevaka Badrappan
---
 plugins/isigen.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/isigen.c b/plugins/isigen.c
index 028f1b2..b7b7ab5 100644
--- a/plugins/isigen.c
+++ b/plugins/isigen.c
@@ -402,6 +402,7 @@ static void isigen_post_sim(struct ofono_modem *modem)
DBG("(%p) with %s", modem, isi->ifname);
 
ofono_phonebook_create(isi->modem, 0, "isimodem", isi->idx);
+   ofono_call_forwarding_create(isi->modem, 0, "isimodem", isi->idx);
 }
 
 static void isigen_post_online(struct ofono_modem *modem)
@@ -418,7 +419,6 @@ static void isigen_post_online(struct ofono_modem *modem)
ofono_cbs_create(isi->modem, 0, "isimodem", isi->idx);
ofono_ssn_create(isi->modem, 0, "isimodem", isi->idx);
ofono_ussd_create(isi->modem, 0, "isimodem", isi->idx);
-   ofono_call_forwarding_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_settings_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_barring_create(isi->modem, 0, "isimodem", isi->idx);
ofono_call_meter_create(isi->modem, 0, "isimodem", isi->idx);
-- 
1.7.0.4

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


[PATCH 2/7] ifx: Move call forwarding to post sim

2010-12-10 Thread Jeevaka Badrappan
---
 plugins/ifx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/ifx.c b/plugins/ifx.c
index 2f4c65b..48c985c 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -703,6 +703,7 @@ static void ifx_post_sim(struct ofono_modem *modem)
ofono_stk_create(modem, 0, "ifxmodem", data->dlcs[AUX_DLC]);
ofono_phonebook_create(modem, OFONO_VENDOR_IFX,
"atmodem", data->dlcs[AUX_DLC]);
+   ofono_call_forwarding_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
 }
 
 static void ifx_post_online(struct ofono_modem *modem)
@@ -724,7 +725,6 @@ static void ifx_post_online(struct ofono_modem *modem)
ofono_ussd_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
 
ofono_ssn_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
-   ofono_call_forwarding_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
ofono_call_settings_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
ofono_call_meter_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
ofono_call_barring_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
-- 
1.7.0.4

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


Read/Write EFcfis/EFcphs-cff files-v4

2010-12-10 Thread Jeevaka Badrappan
Hi,

This patch reads and writes the call forwarding unconditional status
from and to the SIM depending on the SIM file availability. New property
needs to be added due to the fact that number won't be available from the
cphs-cff file.

Incase of SIM, EFcphs-cff file holds call forwarding status and it is
represented as a flag. In case of USIM(EFcfis), we have the status flag
and also number.So, adding new property for status and using the existing
VoiceUnconditional with number will work for both SIM and USIM cases.

Other option is to have 2 properties, "VoiceUnconditional" and "Number". 
"VoiceUnconditional" will have the status of the call forwarding( "enabled",
"disabled") whereas the "Number" property will have the call forwared number.

offline-online state transitions results in caching the call forwaring status
every time. To avoid this, call forwarding atom is moved to the post sim and
its moved also due to the fact that call forwarding status doesn't change in 
roaming.

Regards,
Jeevaka

Jeevaka Badrappan (7):
  call-forwarding: Read/Write cfis/cphs-cff
  ifx: Move call forwarding to post sim
  isigen: Move call forwarding to post sim
  plugins/n900: Move call forwarding to post sim
  phonesim: Move call forwarding to post sim
  doc: Add new property to call forwarding
  TODO: Marking the Read/Write EFcfis task as done

 TODO|9 --
 doc/call-forwarding-api.txt |5 +
 doc/features.txt|5 +
 plugins/ifx.c   |2 +-
 plugins/isigen.c|2 +-
 plugins/n900.c  |2 +-
 plugins/phonesim.c  |3 +-
 src/call-forwarding.c   |  246 ++-
 8 files changed, 260 insertions(+), 14 deletions(-)

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


Re: [PATCH 0/5] Call Counters (2nd)

2010-12-10 Thread Marcel Holtmann
Hi Remi,

> > > Personally I think the every-10sec interval is too short.
> > > It's also highly system specific when wakeups start to get
> > > too costly, so picking up one value seems difficult.
> > 
> > My take here is that a granularity of 1 minute is enough.
> 
> There are definitely call fares with sub-minute granularity. The minute is 
> definitely INSUFFICIENT.

let me repeat my question here. Does this suppose to be represent spent
time on calls (what I called talk time) or actual billing minutes.

If we talk about correct billing minutes then you are just opening
pandora's box. Since we don't know the billing. And difference between
air time, incoming/outgoing calls, multiparty calls, hold calls etc. and
their billing schemes make this just insane.

So what is the actual requirement here. So far ever single answer was
not satisfying. And that is why I proposed to just make this count the
talk time.

> > Doing this every 10 seconds and displaying it on a per second level
> > sounds insane to me.
> 
> So I made a lengthy call to my mum this morning, using a desk phone. And it 
> was showing minute:second, not just minutes. I have never seen a phone that 
> does not show seconds and it would look pretty dumb to me.

You do realize that this is NOT the feature we are talking about here.

The actual display of the duration of a call is pretty simple and
currently easy to handle inside the UI. And that can be done up to the
millisecond display if you or your UI designer wants it.

The proposed call counters here are long term counters showing your
overall time. So showing minutes seems to be precise enough.

Regards

Marcel


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


[PATCH 2/2] fake a sim-inserted status

2010-12-10 Thread F. Gau
From: M. Dietrich 

while the sim detection does not work this patch at least allows to use
those modems. until someone has the time to work out a correct solution
this is a usefull workaround.
---
 plugins/huawei.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/plugins/huawei.c b/plugins/huawei.c
index 25dfaca..df506d3 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -586,6 +586,7 @@ static void huawei_pre_sim(struct ofono_modem *modem)
ofono_devinfo_create(modem, 0, "atmodem", data->pcui);
data->sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
"atmodem", data->pcui);
+   ofono_sim_inserted_notify(data->sim, TRUE);
 
data->sim_poll_count = 0;
query_sim_state(modem);
-- 
1.7.2.3


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


[PATCH 1/2] set huawei em770 modem device to 01 to free up 00

2010-12-10 Thread F. Gau
From: M. Dietrich 

device 00 is ppp capable while 01 is not. 01 does everything
else fine so ofono works with it flawlessly.
---
 plugins/ofono.rules |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index da8a8ef..9369566 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -30,7 +30,7 @@ ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1401", 
ENV{OFONO_IFACE_NUM}=="02", E
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1402", ENV{OFONO_IFACE_NUM}=="00", 
ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1402", ENV{OFONO_IFACE_NUM}=="02", 
ENV{OFONO_HUAWEI_TYPE}="Pcui"
 
-ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="00", 
ENV{OFONO_HUAWEI_TYPE}="Modem"
+ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="01", 
ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="02", 
ENV{OFONO_HUAWEI_TYPE}="Pcui"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_HUAWEI_VOICE}="1"
 
-- 
1.7.2.3


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


Re: [PATCH 0/5] Call Counters (2nd)

2010-12-10 Thread Rémi Denis-Courmont
On Friday 10 December 2010 00:53:19 ext Marcel Holtmann, you wrote:
> > > this is not really true. We can not wakeup ofonod every single second.
> > > You might wanna start running powertop.

Yes we can. PulseAudio is going to be waking up the CPU 10 times per seconds 
or more.

> > uhm, but I'm not claiming that. I was just stating that moving
> > the timers to e.g. pulseaudio in this case won't save much if
> > anything (the CPU will be woken up anyways, and the cost between
> > scheduling ofonod or a thread from PA, has really no difference
> > to overall consumption.. the CPU is woken up anyways and roughly
> > the same code to handle the timer is run).
> > 
> > So whether this code is in oFono or elsewhere, does not matter
> > much (to overall power consumption). The main question is of course
> > how often the counters are synced.
> 
> actually it does matter since you have no extra context switch and in
> addition you not accidentally wake up PA and then ofonod. You have one
> centralized wakeup of one thread.

No! The one extra context switch is negligible compared to the several few 
system calls that updating the call counter requires. And as Kai already said, 
the CPU will wake up anyway.

The real power consumption difference lies in the I/O, which would not happen 
if it weren't for fault-tolerant call counters. In that respect, which process 
writes, PulseAudio, oFono, or something else, is irrelevant.

> Of course this should be smart and done along with the PA audio
> processing and not async to that one.

No. PulseAudio has no business with the call counters. It might not know that 
it is a call. And even if it did know, it might not know whether the call is 
ringing or connected.

oFono on the other hand has the informations. Also, if we gave up on fault 
tolerance to save power, oFono would be the logical place to provide call 
counters (through D-Bus). So it only makes sense that oFono does this - if 
anyone.

And then, it's our nor your decision to make how often (if at all) the call 
counters need to be flushed to the memory card. That's a matter for the 
vendor's legal & liability departement. So it really just needs to be 
configurable, including the ability to disable the feature altogether if it is 
not needed.

> If we consider that the only sensible thing is to track the actual
> talking time, then PA becomes a nice choice for this.

I don't think so.

> This doesn't mean that you should be implementing it, but I am still
> maintaining that this would be a pretty damn smart way of solving this
> efficiently.
> 
> > Personally I think the every-10sec interval is too short.
> > It's also highly system specific when wakeups start to get
> > too costly, so picking up one value seems difficult.
> 
> My take here is that a granularity of 1 minute is enough.

There are definitely call fares with sub-minute granularity. The minute is 
definitely INSUFFICIENT.

> Doing this every 10 seconds and displaying it on a per second level
> sounds insane to me.

So I made a lengthy call to my mum this morning, using a desk phone. And it 
was showing minute:second, not just minutes. I have never seen a phone that 
does not show seconds and it would look pretty dumb to me.

But of course, that's a matter for UI designers, not for middleware oFono 
software engineers anyway.

-- 
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] stk: fix issue to avoid null pointer for alpha_id

2010-12-10 Thread Denis Kenzior
Hi Guillaume,

On 12/08/2010 06:33 AM, Lucas, GuillaumeX wrote:
> From: Guillaume Lucas 
> 
> If a SET UP CALL proactive command with no alpha identifier
> occurs, the alpha_id pointer will be set to NULL. This will
> generate a crash in the stkagent with dbus function. To avoid
> this we use an empty string if the alpha identifier is not
> present in the command.
> ---
>  src/stk.c |   13 ++---
>  1 files changed, 6 insertions(+), 7 deletions(-)
> 

Patch has been applied, thanks.

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


Re: [RFC PATCH] stk: add support of next action for menu

2010-12-10 Thread Denis Kenzior
Hi Guillaume,

On 12/09/2010 07:00 AM, Lucas, GuillaumeX wrote:
> From: Guillaume Lucas 
> 
> According to the 3GPP 31.124 the support of next action
> in SIM toolkit menus is mandatory.
> ---
>  doc/stk-api.txt|5 +++--
>  src/stk.c  |6 ++
>  src/stkagent.c |6 --
>  src/stkagent.h |1 +
>  test/test-stk-menu |6 +++---
>  5 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/stk-api.txt b/doc/stk-api.txt
> index 79daee6..f5bcae4 100644
> --- a/doc/stk-api.txt
> +++ b/doc/stk-api.txt
> @@ -66,13 +66,14 @@ Propertiesstring IdleModeText [readonly]
>   Contains the identifier of the icon accompanying
>   the idle mode text.
>  
> - array{struct{string, byte}} MainMenu [readonly]
> + array{struct{string, byte, byte}} MainMenu [readonly]

Can you tell me exactly what this can be used for?  What is the usecase
for the application to know this information?

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


Re: [PATCH] stkutil: fix crash issue cause by null length of text string

2010-12-10 Thread Denis Kenzior
Hi Guillaume,

On 12/07/2010 04:58 AM, Lucas, GuillaumeX wrote:
> From: Guillaume Lucas 
> 
> According to 3GPP TS 31.124 a null length for the text string
> should be allowed. An empty string must be returned to the
> user in this case.
> ---
>  src/stkutil.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 

Patch has been applied, but please re-run the unit tests when you change
stkutil.  You actually broke a few ;)

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


Re: [PATCH] ifx: adding Infineon modem self test

2010-12-10 Thread Marcel Holtmann
Hi Robertino,

> Adding Infineon modem selftest to the plugin. It executes couple of AT
> commands, and based on the responses,  it continues with ifx modem
> enabling or powers the modem down.

didn't we conclude that the modem should do all these by itself? My
understanding is that the modem executes these. And not that we have to
trigger them.

Regards

Marcel


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


[PATCH] ifx: adding Infineon modem self test

2010-12-10 Thread Robertino Benis
Hi,

Adding Infineon modem selftest to the plugin. It executes couple of AT
commands, and based on the responses,  it continues with ifx modem
enabling or powers the modem down.

Thanks,
-- r.

---
 plugins/ifx.c |   98 +---
 1 files changed, 92 insertions(+), 6 deletions(-)

diff --git a/plugins/ifx.c b/plugins/ifx.c
index 2f4c65b..fcc57c0 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -80,6 +80,12 @@ static const char *dlc_nodes[NUM_DLC] = { "/dev/ttyGSM1", 
"/dev/ttyGSM2",
 
 static const char *none_prefix[] = { NULL };
 static const char *xdrv_prefix[] = { "+XDRV:", NULL };
+static const char *empty_prefix[] = { "", NULL };
+
+static const char *modem_self_tests[][2] = {
+   { "RTC Test", "a...@rtc:rtc_gti_test_verify_32khz()" },
+   { "Version Info Test", "a...@vers:device_version_id()" 
},
+   { NULL, NULL } };
 
 struct ifx_data {
GIOChannel *device;
@@ -99,6 +105,8 @@ struct ifx_data {
int audio_loopback;
struct ofono_sim *sim;
gboolean have_sim;
+   guint self_test_timeout;
+   int self_test_idx;
 };
 
 static void ifx_debug(const char *str, void *user_data)
@@ -545,6 +553,82 @@ static gboolean mux_timeout_cb(gpointer user_data)
return FALSE;
 }
 
+static gboolean self_test_timeout_cb(gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct ifx_data *data = ofono_modem_get_data(modem);
+
+   ofono_error("Timeout with modem self_test");
+   g_source_remove(data->self_test_timeout);
+   data->self_test_timeout = 0;
+
+   shutdown_device(data);
+   ofono_modem_set_powered(modem, FALSE);
+   return FALSE;
+}
+
+static void ifx_self_test_get_device_resp(GAtResult *result, int test_id)
+{
+   GAtResultIter iter;
+   const char *str;
+
+   ofono_info("Modem Response: %s",
+   modem_self_tests[test_id][0]);
+
+   g_at_result_iter_init(&iter, result);
+
+   while (g_at_result_iter_next(&iter, NULL)) {
+
+   if (g_at_result_iter_next_string(&iter, &str))
+   ofono_info("Modem Response: %s", str);
+   }
+}
+
+static void ifx_self_test_cb(gboolean ok, GAtResult *result,
+   gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct ifx_data *data = ofono_modem_get_data(modem);
+
+   if (ok) {
+
+   if (data->self_test_timeout > 0) {
+   g_source_remove(data->self_test_timeout);
+   data->self_test_timeout = 0;
+   }
+
+   ifx_self_test_get_device_resp(result, data->self_test_idx);
+   data->self_test_idx++;
+
+   if (modem_self_tests[data->self_test_idx][1] != NULL) {
+
+   g_at_chat_send(data->dlcs[AUX_DLC],
+   modem_self_tests[data->self_test_idx][1],
+   empty_prefix, ifx_self_test_cb, modem, NULL);
+
+   data->self_test_timeout = g_timeout_add_seconds(10,
+   self_test_timeout_cb, modem);
+   return;
+
+   } else {
+
+   /* Enable  MUX Channels */
+   data->frame_size = 1509;
+   g_at_chat_send(data->dlcs[AUX_DLC],
+   "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
+   mux_setup_cb, modem, NULL);
+
+   data->mux_init_timeout = g_timeout_add_seconds(5,
+   mux_timeout_cb, modem);
+   return;
+   }
+   }
+
+   ofono_error("Modem %s: FAIL", modem_self_tests[data->self_test_idx][0]);
+   shutdown_device(data);
+   ofono_modem_set_powered(modem, FALSE);
+}
+
 static int ifx_enable(struct ofono_modem *modem)
 {
struct ifx_data *data = ofono_modem_get_data(modem);
@@ -598,15 +682,17 @@ static int ifx_enable(struct ofono_modem *modem)
g_at_chat_send(chat, "ATE0 +CMEE=1", NULL,
NULL, NULL, NULL);
 
-   data->frame_size = 1509;
+   /* Execute Modem Self tests */
 
-   g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
-   mux_setup_cb, modem, NULL);
+   data->dlcs[AUX_DLC] = chat;
+   data->self_test_idx = 0;
 
-   data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb,
-   modem);
+   g_at_chat_send(data->dlcs[AUX_DLC],
+   modem_self_tests[data->self_test_idx][1],
+   empty_prefix, ifx_self_test_cb, modem, NULL);
 
-   data->dlcs[AUX_DLC] = chat;
+   data->self_test_timeout = g_timeout_add_seconds(10,
+   self_test_timeout_cb,   

RE: [PATCH 0/3] Attach GPRS on demand

2010-12-10 Thread Mika.Liljeberg
Hi Marcel,

I somehow missed your other comments on this mail. More responses below.

> > Even if you can come up with an algorithm, testing it is 
> very very challenging. There are plenty of differences in 
> operator networks and it is very difficult to cover all 
> cases. Making sure that the algorithm works requires 
> extensive IOT and Field testing. We really don't want a case, 
> where oFono fails to re-attach for whatever reason. We also 
> don't want the case where oFono has not yet attempted to 
> re-attach (e.g. on a timer) and a PDP context activation 
> fails, even though GPRS would actually be available.
> 
> I don't think such an algorithm is hard. Either we are forbidden, then
> we wait until we switch to a new cell.

Mostly that would be just a waste of power. Some of the errors are PLMN or LA 
specific, so retrying at cell change would be redundant. A proper retry 
strategy would have to be based on the detach reason and any subsequent attach 
failure causes. In general, activating the RF all the time, when no-one has 
even requested a PDP context is simply bad idea. There are better uses for the 
battery power.

And yes, coming up with an algorithm (whatever it is) is probably easy enough. 
Making sure it works with all the networks and modems out there is the hard 
part.

> Otherwise we will just retry to attach.

That's also tricky. What do you do if the attach attempt fails? Retry again? 
How often? Use some kind of backoff?

> > For the above reasons, retrying attach on PDP context 
> activation makes sense as a safe-guard, regardless of whether 
> we have a re-attach algorithm or not. We use on-demand attach 
> in pretty much all our products (except for certain operator 
> specific variants) precisely because it is certain to work. 
> No funny business. If there is GPRS service, you get a 
> connection. It is also an approach that should work with any 
> AT modem as well.
> 
> This is really not ConnMan's problem and I don't wanna make 
> it ConnMan's
> problem.
> I am really against just pushing this problem off to someone else.

No-one is proposing to. You're actually making this ConnMan's problem by 
monitoring the GPRS attach status. If ConnMan needs a trigger, it should be 
based on network registration status alone.

> And
> in ConnMan we have even less information to decide what happens when
> context activation fails.

Unfortunately, oFono cannot hide context activation failures from ConnMan. 
ConnMan will just have to cope, regardless of what we do with attach.

> The algorithm to handle such rare error
> conditions smoothly becomes more complicated than making this easier.

As far as I can see, the approach I'm proposing is simpler than the one you and 
Denis are proposing.

> So I agree with Denis that we need to fix this inside oFono 
> and just try
> to intelligently re-attach.

As I already explained to Denis, it's not really a choise between one or the 
other. Some opearators require autoattach, some require on-demand attach and 
some require a UI to change the mode. All of these should be supported. So, by 
all means develop a re-attach algorith. It won't be easy to maturize, though. 
Using context activation requests as a triggers to retry attach simply makes a 
lot of sense as a safe-guard, even if we're in autoattach mode. If anything, it 
removes one potential failure case.

Br,

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


Re: [PATCH] TODO: Add task for NITZ name support in netreg

2010-12-10 Thread Denis Kenzior
Hi Aki,

>> Hence the reason for my pointed questions.  I'm a big proponent of
>> moving the PLMN database to the core, however this needs to work for
>> both ISI and AT modems.
> 
> Right, so you agree to this TODO item?

I agree in principle, I'm just worried about the feasibility.  Ideally
I'd like us to do a bit more due diligence first or reword the task to
include words like 'feasibility' and 'study'.

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


Re: [PATCH 0/5] Call Counters (2nd)

2010-12-10 Thread Andras Domokos

Hi,

On 12/10/2010 12:53 AM, ext Marcel Holtmann wrote:

Hi Kai,

   

I share the concern for the IO/CPU cost, but I don't think it
matters much in which daemon this is done. Especially if some slack
is>  allowed for the timers (which should be the case), ofonod will be
scheduled when the CPU is anyways woken up (e.g. modem/audio interrupts
wake up pulseaudio).
 

this is not really true. We can not wakeup ofonod every single second.
You might wanna start running powertop.
   

uhm, but I'm not claiming that. I was just stating that moving
the timers to e.g. pulseaudio in this case won't save much if
anything (the CPU will be woken up anyways, and the cost between
scheduling ofonod or a thread from PA, has really no difference
to overall consumption.. the CPU is woken up anyways and roughly
the same code to handle the timer is run).

So whether this code is in oFono or elsewhere, does not matter
much (to overall power consumption). The main question is of course
how often the counters are synced.
 

actually it does matter since you have no extra context switch and in
addition you not accidentally wake up PA and then ofonod. You have one
centralized wakeup of one thread.

Of course this should be smart and done along with the PA audio
processing and not async to that one.

If we consider that the only sensible thing is to track the actual
talking time, then PA becomes a nice choice for this.

This doesn't mean that you should be implementing it, but I am still
maintaining that this would be a pretty damn smart way of solving this
efficiently.

   

Obviously, there are many implementation options, we have to
decide only about whether we want to have this implemented
in oFono or not, or in first place, whether the feature is needed
at all or not. For the latter part I am collecting more info from
our people.

Personally I think the every-10sec interval is too short.
It's also highly system specific when wakeups start to get
too costly, so picking up one value seems difficult.
 

My take here is that a granularity of 1 minute is enough.

Doing this every 10 seconds and displaying it on a per second level
sounds insane to me.
   


That second level D-Bus query of the call counters should be forgotten,
probably is not going to happen and anyways, querying is something
that can be controlled/tuned outside ofono. In fact any method can be
"abused" in a similar way, is not oFono's responsibility to prevent such
"misuse" from happening.
There is a single value to tune, the sync interval, we can either settle
on a reasonable value, or we can make it a configurable parameter (the
default value would disable the periodic syncing), then everybody can
do whatever with its own product.


Regards

Marcel


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


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