Handling of new parameter (file status) from the driver added.
This commit doesn't store EF-info into cache yet.
---
src/simfs.c | 29 +++++++++++++++++++++++++----
src/simfs.h | 1 +
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/simfs.c b/src/simfs.c
index fd768ef..ea09536 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -61,6 +61,7 @@ struct sim_fs_op {
unsigned char *buffer;
enum ofono_sim_file_structure structure;
unsigned short offset;
+ gboolean info_only;
int num_bytes;
int length;
int record_length;
@@ -433,7 +434,9 @@ static gboolean sim_fs_op_read_record(gpointer user)
static void sim_fs_op_info_cb(const struct ofono_error *error, int length,
enum ofono_sim_file_structure structure,
int record_length,
- const unsigned char access[3], void *data)
+ const unsigned char access[3],
+ const unsigned char file_status,
+ void *data)
{
struct sim_fs *fs = data;
struct sim_fs_op *op = g_queue_peek_head(fs->op_q);
@@ -445,6 +448,7 @@ static void sim_fs_op_info_cb(const struct ofono_error *error, int
length,
unsigned char fileinfo[SIM_CACHE_HEADER_SIZE];
gboolean cache;
char *path;
+ ofono_sim_file_read_cb_t cb = op->cb;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
sim_fs_op_error(fs);
@@ -480,11 +484,26 @@ static void sim_fs_op_info_cb(const struct ofono_error *error, int
length,
op->record_length = length;
op->current = op->offset / 256;
- fs->op_source = g_idle_add(sim_fs_op_read_block, fs);
+
+ if (!op->info_only)
+ fs->op_source = g_idle_add(sim_fs_op_read_block, fs);
} else {
op->record_length = record_length;
op->current = 1;
- fs->op_source = g_idle_add(sim_fs_op_read_record, fs);
+
+ if (!op->info_only)
+ fs->op_source = g_idle_add(sim_fs_op_read_record, fs);
+ }
+
+ if (op->info_only) {
+ /*
+ * It's info-only request. So there is no need to request
+ * actual contents of the EF-files. Just return the EF-info.
+ */
+ cb(1, op->length, op->current,
+ &file_status, op->record_length, op->userdata);
+
+ sim_fs_end_current(fs);
}
if (imsi == NULL || cache == FALSE)
@@ -529,7 +548,7 @@ static gboolean sim_fs_op_check_cached(struct sim_fs *fs)
enum ofono_sim_file_structure structure;
int record_length;
- if (!imsi)
+ if (!imsi || !op->info_only)
return FALSE;
path = g_strdup_printf(SIM_CACHE_PATH, imsi, phase, op->id);
@@ -642,6 +661,7 @@ static gboolean sim_fs_op_next(gpointer user_data)
int sim_fs_read(struct sim_fs *fs, int id,
enum ofono_sim_file_structure expected_type,
+ gboolean info_only,
unsigned short offset, unsigned short num_bytes,
ofono_sim_file_read_cb_t cb, void *data)
{
@@ -668,6 +688,7 @@ int sim_fs_read(struct sim_fs *fs, int id,
op->is_read = TRUE;
op->offset = offset;
op->num_bytes = num_bytes;
+ op->info_only = info_only;
g_queue_push_tail(fs->op_q, op);
diff --git a/src/simfs.h b/src/simfs.h
index c0b4c51..40f00d4 100644
--- a/src/simfs.h
+++ b/src/simfs.h
@@ -26,6 +26,7 @@ struct sim_fs *sim_fs_new(struct ofono_sim *sim,
int sim_fs_read(struct sim_fs *fs, int id,
enum ofono_sim_file_structure expected_type,
+ gboolean info_only,
unsigned short offset, unsigned short num_bytes,
ofono_sim_file_read_cb_t cb, void *data);
--
1.6.3.3