* Handling of Fixed Dialing v3
@ 2010-10-12 15:18 Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Petteri Tikander
0 siblings, 1 reply; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 614 bytes --]
The goal of these patches is to check, if Fixed Dialing is enabled in SIM-card.
Because also invalidation/rehabilitation status of ADN has to be checked,
functionality is added for retrieving file-status of EF-files.
So general information of EF-files is returned (containing now also file status)
without starting the actual EF-content retrieving.
The FDN-enable status is checked. If FDN is enabled, SIM-initialisation routine is
interrupted (modem is left in PRE-SIM state), and FD-enabled property is signalled
over D-BUS.
oFono still trusts to EFphase value when selecting SIM/USIM access.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file
2010-10-12 15:18 Handling of Fixed Dialing v3 Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
2010-10-14 11:07 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Denis Kenzior
0 siblings, 2 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3066 bytes --]
Function reads file length, record length, file status etc,
but doesn't retrieve any EF-contents.
Request for EFadn is added, but this commit just debugs
the response.
---
include/sim.h | 11 +++++++++++
src/sim.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/include/sim.h b/include/sim.h
index 42b19bd..8dd6131 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -82,6 +82,7 @@ typedef void (*ofono_sim_file_info_cb_t)(const struct ofono_error *error,
enum ofono_sim_file_structure structure,
int recordlength,
const unsigned char access[3],
+ unsigned char file_status,
void *data);
typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
@@ -206,6 +207,16 @@ 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);
+
+/*
+ * This function reads only general info from SIM-file with
+ * requested id (file length, record length, file status etc),
+ * not any records.
+ */
+int ofono_sim_read_info(struct ofono_sim *sim, int id,
+ enum ofono_sim_file_structure expected,
+ ofono_sim_file_read_cb_t cb, void *data);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/sim.c b/src/sim.c
index 6f10d4c..f0633bb 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1183,6 +1183,15 @@ static void sim_efphase_read_cb(int ok, int length, int record,
sim->phase = data[0];
}
+static void sim_info_read_cb(int ok, int length, int record,
+ const unsigned char *file_status,
+ int record_length, void *userdata)
+{
+ DBG("OK: %d, length: %d, record: %d, \
+ file_status: %x, record_length: %d",
+ ok, length, record, file_status[0], record_length);
+}
+
static void sim_initialize_after_pin(struct ofono_sim *sim)
{
ofono_sim_read(sim, SIM_EFPHASE_FILEID,
@@ -1530,7 +1539,7 @@ int ofono_sim_read_bytes(struct ofono_sim *sim, int id,
return -1;
return sim_fs_read(sim->simfs, id, OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
- offset, num_bytes, cb, data);
+ FALSE, offset, num_bytes, cb, data);
}
int ofono_sim_read(struct ofono_sim *sim, int id,
@@ -1540,7 +1549,24 @@ int ofono_sim_read(struct ofono_sim *sim, int id,
if (sim == NULL)
return -1;
- return sim_fs_read(sim->simfs, id, expected_type, 0, 0, cb, data);
+ return sim_fs_read(sim->simfs, id, expected_type, FALSE,
+ 0, 0, cb, data);
+}
+
+int ofono_sim_read_info(struct ofono_sim *sim, int id,
+ enum ofono_sim_file_structure expected_type,
+ ofono_sim_file_read_cb_t cb, void *data)
+{
+ /*
+ * Retrieve EF-info only (file length, record length, file status etc).
+ * So this function doesn't retrieve actual EF-contents.
+ */
+
+ if (sim == NULL)
+ return -1;
+
+ return sim_fs_read(sim->simfs, id, expected_type, TRUE,
+ 0, 0, cb, data);
}
int ofono_sim_write(struct ofono_sim *sim, int id,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents
2010-10-12 15:18 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
2010-10-14 11:10 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Denis Kenzior
2010-10-14 11:07 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Denis Kenzior
1 sibling, 2 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3376 bytes --]
Handling of new parameter (file status) from the driver added.
This commit doesn't store EF-info into cache yet.
---
src/simfs.c | 27 +++++++++++++++++++++++----
src/simfs.h | 1 +
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/simfs.c b/src/simfs.c
index b5b12b4..24ce7ec 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -58,6 +58,7 @@ struct sim_fs_op {
int id;
enum ofono_sim_file_structure structure;
unsigned short offset;
+ gboolean info_only;
int num_bytes;
int length;
int record_length;
@@ -426,7 +427,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);
@@ -438,6 +441,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);
@@ -473,11 +477,24 @@ 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)
@@ -522,7 +539,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);
@@ -635,6 +652,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)
{
@@ -661,6 +679,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 6d5dded..284d15b 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
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 3/8] simutil: response-handler returns now also file-status
2010-10-12 15:18 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
2010-10-14 10:41 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Denis Kenzior
2010-10-14 11:10 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Denis Kenzior
1 sibling, 2 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]
---
src/simutil.c | 5 ++++-
src/simutil.h | 11 ++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/simutil.c b/src/simutil.c
index 65ce1ac..04ba975 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -1405,7 +1405,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
int *file_len, int *record_len,
- int *structure, unsigned char *access)
+ int *structure, unsigned char *access,
+ unsigned char *file_status)
{
if (len < 14 || response[6] != 0x04)
return FALSE;
@@ -1420,6 +1421,8 @@ gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
access[1] = response[9];
access[2] = response[10];
+ *file_status = response[11];
+
if (response[13] == 0x01 || response[13] == 0x03)
*record_len = response[14];
else
diff --git a/src/simutil.h b/src/simutil.h
index 54b99a0..bd8e4ac 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -57,6 +57,14 @@ enum sim_file_access {
SIM_FILE_ACCESS_NEVER = 15,
};
+/* 51.011 Section 9.3 */
+enum sim_file_status {
+ SIM_FILE_STATUS_INVALID = 0x00,
+ SIM_FILE_STATUS_NOT_INVALID = 0x01,
+ SIM_FILE_STATUS_INVALID_BUT_ACCESS = 0x04,
+ SIM_FILE_STATUS_NOT_AVAILABLE = 0xFF,
+};
+
/* 131.102 Section 4.2.8 */
enum sim_ust_service {
SIM_UST_SERVICE_LOCAL_PHONE_BOOK = 0,
@@ -425,7 +433,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
int *file_len, int *record_len,
- int *structure, unsigned char *access);
+ int *structure, unsigned char *access,
+ unsigned char *file_status);
gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
enum sim_ust_service index);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
` (2 more replies)
2010-10-14 10:41 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Denis Kenzior
1 sibling, 3 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2437 bytes --]
---
drivers/atmodem/sim.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d0a7148..d44b7d2 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -64,11 +64,13 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
int flen, rlen;
int str;
unsigned char access[3];
+ unsigned char file_status;
decode_at_error(&error, g_at_result_final_response(result));
if (!ok) {
- cb(&error, -1, -1, -1, NULL, cbd->data);
+ cb(&error, -1, -1, -1, NULL,
+ SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
return;
}
@@ -88,27 +90,33 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
error.type = OFONO_ERROR_TYPE_SIM;
error.error = (sw1 << 8) | sw2;
- cb(&error, -1, -1, -1, NULL, cbd->data);
+ cb(&error, -1, -1, -1, NULL,
+ SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
return;
}
DBG("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
- if (response[0] == 0x62)
+ if (response[0] == 0x62) {
ok = sim_parse_3g_get_response(response, len, &flen, &rlen,
&str, access, NULL);
+
+ file_status = SIM_FILE_STATUS_NOT_AVAILABLE;
+ }
else
ok = sim_parse_2g_get_response(response, len, &flen, &rlen,
- &str, access);
+ &str, access, &file_status);
if (!ok)
goto error;
- cb(&error, flen, str, rlen, access, cbd->data);
+ cb(&error, flen, str, rlen, access, file_status, cbd->data);
+
return;
error:
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, cbd->data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
+ SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
}
static void at_sim_read_info(struct ofono_sim *sim, int fileid,
@@ -123,7 +131,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
unsigned char access[3] = { 0x00, 0x00, 0x00 };
if (fileid == SIM_EFAD_FILEID) {
- CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, data);
+ CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, 0x01, data);
return;
}
}
@@ -142,7 +150,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
return;
error:
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0xFF, data);
}
static void at_crsm_read_cb(gboolean ok, GAtResult *result,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
2010-10-14 10:58 ` [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file Denis Kenzior
2010-10-14 10:57 ` [RFC PATCH 4/8] atmodem: " Denis Kenzior
2010-10-14 11:03 ` Denis Kenzior
2 siblings, 2 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]
---
drivers/isimodem/sim.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
index e2ea275..bd7e9d6 100644
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -54,6 +54,7 @@ struct file_info {
int structure;
int record_length;
unsigned char access[3];
+ unsigned char file_status;
};
/* Returns file info */
@@ -66,7 +67,7 @@ static gboolean fake_file_info(gpointer user)
DBG("Returning static file_info for %04x", fi->fileid);
CALLBACK_WITH_SUCCESS(cb,
fi->length, fi->structure, fi->record_length,
- fi->access, cbd->data);
+ fi->access, fi->file_status, cbd->data);
g_free(cbd);
return FALSE;
}
@@ -76,8 +77,10 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
{
int i;
static struct file_info const info[] = {
- { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff } },
- { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff } },
+ { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff },
+ SIM_FILE_STATUS_NOT_INVALID },
+ { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff },
+ SIM_FILE_STATUS_NOT_INVALID },
};
int N = sizeof(info) / sizeof(info[0]);
struct isi_cb_data *cbd;
@@ -91,7 +94,8 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
}
DBG("Not implemented (fileid = %04x)", fileid);
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
+ SIM_FILE_STATUS_NOT_AVAILABLE, data);
}
static gboolean spn_resp_cb(GIsiClient *client,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 6/8] simutil: add ID of EFadn
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
2010-10-14 10:43 ` [RFC PATCH 6/8] simutil: add ID of EFadn Denis Kenzior
2010-10-14 10:58 ` [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file Denis Kenzior
1 sibling, 2 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
---
src/simutil.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/simutil.h b/src/simutil.h
index bd8e4ac..6496146 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -32,6 +32,7 @@ enum sim_fileid {
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
SIM_EFSDN_FILEID = 0x6f49,
+ SIM_EFADN_FILEID = 0x6f3a,
SIM_EFEST_FILEID = 0x6f56,
SIM_EFAD_FILEID = 0x6fad,
SIM_EFPHASE_FILEID = 0x6fae,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card
2010-10-12 15:18 ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
` (2 more replies)
2010-10-14 10:43 ` [RFC PATCH 6/8] simutil: add ID of EFadn Denis Kenzior
1 sibling, 3 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4619 bytes --]
If FD is enabled, halt SIM initialization procedure.
New property (FixedDialing) is added. If FD is enabled,
this has been signalled via DBUS.
---
src/sim.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 72 insertions(+), 9 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index f0633bb..4836f55 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -71,6 +71,7 @@ struct ofono_sim {
unsigned char efest_length;
unsigned char *efsst;
unsigned char efsst_length;
+ gboolean fixed_dialing;
char *imsi;
@@ -307,6 +308,9 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ ofono_dbus_dict_append(&dict, "FixedDialing", DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+
if (sim->mnc_length) {
char mcc[OFONO_MAX_MCC_LENGTH + 1];
char mnc[OFONO_MAX_MNC_LENGTH + 1];
@@ -1061,12 +1065,41 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
sim->driver->read_imsi(sim, sim_imsi_cb, sim);
}
+static void sim_info_read_cb(int ok, int length, int record,
+ const unsigned char *file_status,
+ int record_length, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+
+ if (!ok)
+ goto out;
+
+ if (*file_status != SIM_FILE_STATUS_NOT_INVALID) {
+
+ sim->fixed_dialing = TRUE;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "FixedDialing",
+ DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+ return;
+ }
+
+out:
+ sim_retrieve_imsi(sim);
+}
+
static void sim_efsst_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
{
struct ofono_sim *sim = userdata;
+ sim->fixed_dialing = FALSE;
+
if (!ok)
goto out;
@@ -1078,6 +1111,21 @@ static void sim_efsst_read_cb(int ok, int length, int record,
sim->efsst = g_memdup(data, length);
sim->efsst_length = length;
+ /*
+ * Check if Fixed Dialing is enabled in the SIM-card
+ * (TS 11.11/TS 51.011, Section 9.3: FDN capability request).
+ * If FDN is activated and ADN is invalidated,
+ * don't continue initialization routine.
+ */
+ if (sim_sst_is_active(sim->efsst, sim->efsst_length,
+ SIM_SST_SERVICE_FDN)) {
+
+ ofono_sim_read_info(sim, SIM_EFADN_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_FIXED,
+ sim_info_read_cb, sim);
+ return;
+ }
+
out:
sim_retrieve_imsi(sim);
}
@@ -1087,6 +1135,8 @@ static void sim_efest_read_cb(int ok, int length, int record,
int record_length, void *userdata)
{
struct ofono_sim *sim = userdata;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
if (!ok)
goto out;
@@ -1099,6 +1149,24 @@ static void sim_efest_read_cb(int ok, int length, int record,
sim->efest = g_memdup(data, length);
sim->efest_length = length;
+ /*
+ * Check if Fixed Dialing is enabled in the USIM-card
+ * (TS 31.102, Section 5.3.2: FDN capability request).
+ * If FDN is activated, don't continue initialization routine.
+ */
+ if (sim_est_is_active(sim->efest, sim->efest_length,
+ SIM_EST_SERVICE_FDN)) {
+
+ sim->fixed_dialing = TRUE;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "FixedDialing",
+ DBUS_TYPE_BOOLEAN,
+ &sim->fixed_dialing);
+ return;
+ }
+
out:
sim_retrieve_imsi(sim);
}
@@ -1109,6 +1177,8 @@ static void sim_efust_read_cb(int ok, int length, int record,
{
struct ofono_sim *sim = userdata;
+ sim->fixed_dialing = FALSE;
+
if (!ok)
goto out;
@@ -1183,15 +1253,6 @@ static void sim_efphase_read_cb(int ok, int length, int record,
sim->phase = data[0];
}
-static void sim_info_read_cb(int ok, int length, int record,
- const unsigned char *file_status,
- int record_length, void *userdata)
-{
- DBG("OK: %d, length: %d, record: %d, \
- file_status: %x, record_length: %d",
- ok, length, record, file_status[0], record_length);
-}
-
static void sim_initialize_after_pin(struct ofono_sim *sim)
{
ofono_sim_read(sim, SIM_EFPHASE_FILEID,
@@ -1691,6 +1752,8 @@ static void sim_free_state(struct ofono_sim *sim)
sim->efimg = NULL;
sim->efimg_length = 0;
}
+
+ sim->fixed_dialing = FALSE;
}
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 8/8] doc: update sim-api
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
@ 2010-10-12 15:18 ` Petteri Tikander
2010-10-14 5:56 ` Marcel Holtmann
2010-10-14 11:22 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Denis Kenzior
2010-10-14 11:24 ` Denis Kenzior
2 siblings, 1 reply; 24+ messages in thread
From: Petteri Tikander @ 2010-10-12 15:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 491 bytes --]
---
doc/sim-api.txt | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/doc/sim-api.txt b/doc/sim-api.txt
index d5bf279..c502772 100644
--- a/doc/sim-api.txt
+++ b/doc/sim-api.txt
@@ -125,3 +125,7 @@ Properties boolean Present [readonly]
Contains the Intergrated Circuit Card Identifer (ICCID)
which is read directly from the SIM.
+
+ boolean FixedDialing [readonly]
+
+ True if a Fixed Dialing is enabled in SIM card.
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 8/8] doc: update sim-api
2010-10-12 15:18 ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
@ 2010-10-14 5:56 ` Marcel Holtmann
0 siblings, 0 replies; 24+ messages in thread
From: Marcel Holtmann @ 2010-10-14 5:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]
Hi Petteri,
> ---
> doc/sim-api.txt | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/doc/sim-api.txt b/doc/sim-api.txt
> index d5bf279..c502772 100644
> --- a/doc/sim-api.txt
> +++ b/doc/sim-api.txt
> @@ -125,3 +125,7 @@ Properties boolean Present [readonly]
>
> Contains the Intergrated Circuit Card Identifer (ICCID)
> which is read directly from the SIM.
> +
> + boolean FixedDialing [readonly]
> +
> + True if a Fixed Dialing is enabled in SIM card.
can we please make this a bit more verbose. I want to have some
description on what this is intended for. So something along the line
that you can detect that the SIM card is in fixed dialing mode. That
this means you can make emergency calls only etc. So what is the impact
for the application developers and what is expected from them todo.
Remember that these docs are not just for us, they are for the
application developers and need to be as verbose as possible. So they go
off into the right direction ;)
Regards
Marcel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
@ 2010-10-14 11:22 ` Denis Kenzior
2010-10-14 11:24 ` Denis Kenzior
2 siblings, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 11:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5454 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> If FD is enabled, halt SIM initialization procedure.
> New property (FixedDialing) is added. If FD is enabled,
> this has been signalled via DBUS.
> ---
> src/sim.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
> 1 files changed, 72 insertions(+), 9 deletions(-)
>
> diff --git a/src/sim.c b/src/sim.c
> index f0633bb..4836f55 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -71,6 +71,7 @@ struct ofono_sim {
> unsigned char efest_length;
> unsigned char *efsst;
> unsigned char efsst_length;
> + gboolean fixed_dialing;
>
> char *imsi;
>
> @@ -307,6 +308,9 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
> ofono_dbus_dict_append(&dict, "SubscriberIdentity",
> DBUS_TYPE_STRING, &sim->imsi);
>
> + ofono_dbus_dict_append(&dict, "FixedDialing", DBUS_TYPE_BOOLEAN,
> + &sim->fixed_dialing);
> +
> if (sim->mnc_length) {
> char mcc[OFONO_MAX_MCC_LENGTH + 1];
> char mnc[OFONO_MAX_MNC_LENGTH + 1];
> @@ -1061,12 +1065,41 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
> sim->driver->read_imsi(sim, sim_imsi_cb, sim);
> }
>
> +static void sim_info_read_cb(int ok, int length, int record,
> + const unsigned char *file_status,
> + int record_length, void *userdata)
> +{
> + struct ofono_sim *sim = userdata;
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = __ofono_atom_get_path(sim->atom);
I suggest moving the conn and path variable declarations into the if
statement below.
> +
> + if (!ok)
> + goto out;
> +
> + if (*file_status != SIM_FILE_STATUS_NOT_INVALID) {
> +
The empty line above is not needed
> + sim->fixed_dialing = TRUE;
> +
> + ofono_dbus_signal_property_changed(conn, path,
> + OFONO_SIM_MANAGER_INTERFACE,
> + "FixedDialing",
> + DBUS_TYPE_BOOLEAN,
> + &sim->fixed_dialing);
> + return;
> + }
> +
> +out:
> + sim_retrieve_imsi(sim);
> +}
> +
> static void sim_efsst_read_cb(int ok, int length, int record,
> const unsigned char *data,
> int record_length, void *userdata)
> {
> struct ofono_sim *sim = userdata;
>
> + sim->fixed_dialing = FALSE;
> +
Why do you reset fixed_dialing to FALSE here?
> if (!ok)
> goto out;
>
> @@ -1078,6 +1111,21 @@ static void sim_efsst_read_cb(int ok, int length, int record,
> sim->efsst = g_memdup(data, length);
> sim->efsst_length = length;
>
> + /*
> + * Check if Fixed Dialing is enabled in the SIM-card
> + * (TS 11.11/TS 51.011, Section 9.3: FDN capability request).
> + * If FDN is activated and ADN is invalidated,
> + * don't continue initialization routine.
> + */
> + if (sim_sst_is_active(sim->efsst, sim->efsst_length,
> + SIM_SST_SERVICE_FDN)) {
> +
> + ofono_sim_read_info(sim, SIM_EFADN_FILEID,
> + OFONO_SIM_FILE_STRUCTURE_FIXED,
> + sim_info_read_cb, sim);
> + return;
> + }
> +
> out:
> sim_retrieve_imsi(sim);
> }
> @@ -1087,6 +1135,8 @@ static void sim_efest_read_cb(int ok, int length, int record,
> int record_length, void *userdata)
> {
> struct ofono_sim *sim = userdata;
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = __ofono_atom_get_path(sim->atom);
I suggest moving these variable declarations to the if statement below.
>
> if (!ok)
> goto out;
> @@ -1099,6 +1149,24 @@ static void sim_efest_read_cb(int ok, int length, int record,
> sim->efest = g_memdup(data, length);
> sim->efest_length = length;
>
> + /*
> + * Check if Fixed Dialing is enabled in the USIM-card
> + * (TS 31.102, Section 5.3.2: FDN capability request).
> + * If FDN is activated, don't continue initialization routine.
> + */
> + if (sim_est_is_active(sim->efest, sim->efest_length,
> + SIM_EST_SERVICE_FDN)) {
> +
> + sim->fixed_dialing = TRUE;
> +
> + ofono_dbus_signal_property_changed(conn, path,
> + OFONO_SIM_MANAGER_INTERFACE,
> + "FixedDialing",
> + DBUS_TYPE_BOOLEAN,
> + &sim->fixed_dialing);
> + return;
> + }
> +
> out:
> sim_retrieve_imsi(sim);
> }
> @@ -1109,6 +1177,8 @@ static void sim_efust_read_cb(int ok, int length, int record,
> {
> struct ofono_sim *sim = userdata;
>
> + sim->fixed_dialing = FALSE;
> +
Again, why set this to FALSE here?
> if (!ok)
> goto out;
>
> @@ -1183,15 +1253,6 @@ static void sim_efphase_read_cb(int ok, int length, int record,
> sim->phase = data[0];
> }
>
> -static void sim_info_read_cb(int ok, int length, int record,
> - const unsigned char *file_status,
> - int record_length, void *userdata)
> -{
> - DBG("OK: %d, length: %d, record: %d, \
> - file_status: %x, record_length: %d",
> - ok, length, record, file_status[0], record_length);
> -}
> -
This seems to be unrelated to the rest of the patch.
> static void sim_initialize_after_pin(struct ofono_sim *sim)
> {
> ofono_sim_read(sim, SIM_EFPHASE_FILEID,
> @@ -1691,6 +1752,8 @@ static void sim_free_state(struct ofono_sim *sim)
> sim->efimg = NULL;
> sim->efimg_length = 0;
> }
> +
> + sim->fixed_dialing = FALSE;
And here? I suggest you simply reset fixed_dialing to FALSE inside
sim_free_state
> }
>
> void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
2010-10-14 11:22 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Denis Kenzior
@ 2010-10-14 11:24 ` Denis Kenzior
2 siblings, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 11:24 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
Hi Petteri,
> + /*
> + * Check if Fixed Dialing is enabled in the SIM-card
> + * (TS 11.11/TS 51.011, Section 9.3: FDN capability request).
Can you double check that the Section above is correct?
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 6/8] simutil: add ID of EFadn
2010-10-12 15:18 ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
@ 2010-10-14 10:43 ` Denis Kenzior
1 sibling, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 10:43 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
> src/simutil.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
@ 2010-10-14 10:58 ` Denis Kenzior
1 sibling, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 10:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
> drivers/isimodem/sim.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
> index e2ea275..bd7e9d6 100644
> --- a/drivers/isimodem/sim.c
> +++ b/drivers/isimodem/sim.c
> @@ -54,6 +54,7 @@ struct file_info {
> int structure;
> int record_length;
> unsigned char access[3];
> + unsigned char file_status;
> };
>
> /* Returns file info */
> @@ -66,7 +67,7 @@ static gboolean fake_file_info(gpointer user)
> DBG("Returning static file_info for %04x", fi->fileid);
> CALLBACK_WITH_SUCCESS(cb,
> fi->length, fi->structure, fi->record_length,
> - fi->access, cbd->data);
> + fi->access, fi->file_status, cbd->data);
> g_free(cbd);
> return FALSE;
> }
> @@ -76,8 +77,10 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
> {
> int i;
> static struct file_info const info[] = {
> - { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff } },
> - { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff } },
> + { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff },
> + SIM_FILE_STATUS_NOT_INVALID },
> + { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff },
> + SIM_FILE_STATUS_NOT_INVALID },
Using 0 instead of SIM_FILE_STATUS_NOT_INVALID seems better.
> };
> int N = sizeof(info) / sizeof(info[0]);
> struct isi_cb_data *cbd;
> @@ -91,7 +94,8 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
> }
>
> DBG("Not implemented (fileid = %04x)", fileid);
> - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
> + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, data);
> }
>
> static gboolean spn_resp_cb(GIsiClient *client,
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
@ 2010-10-14 10:57 ` Denis Kenzior
2010-10-14 16:54 ` Petteri Tikander
2010-10-14 11:03 ` Denis Kenzior
2 siblings, 1 reply; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 10:57 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2965 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
> drivers/atmodem/sim.c | 24 ++++++++++++++++--------
> 1 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
> index d0a7148..d44b7d2 100644
> --- a/drivers/atmodem/sim.c
> +++ b/drivers/atmodem/sim.c
> @@ -64,11 +64,13 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
> int flen, rlen;
> int str;
> unsigned char access[3];
> + unsigned char file_status;
>
> decode_at_error(&error, g_at_result_final_response(result));
>
> if (!ok) {
> - cb(&error, -1, -1, -1, NULL, cbd->data);
> + cb(&error, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
In the cases where an error occurs, I suggest passing in -1 for the
file_status.
> return;
> }
>
> @@ -88,27 +90,33 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
> error.type = OFONO_ERROR_TYPE_SIM;
> error.error = (sw1 << 8) | sw2;
>
> - cb(&error, -1, -1, -1, NULL, cbd->data);
> + cb(&error, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> return;
> }
>
> DBG("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
>
> - if (response[0] == 0x62)
> + if (response[0] == 0x62) {
> ok = sim_parse_3g_get_response(response, len, &flen, &rlen,
> &str, access, NULL);
> +
> + file_status = SIM_FILE_STATUS_NOT_AVAILABLE;
For this case, file_status should be 0. From what I remember of ETSI
102.221 3G sims do not return response data for invalidated files. But
please double check this, or perhaps someone on the list knows.
> + }
> else
> ok = sim_parse_2g_get_response(response, len, &flen, &rlen,
> - &str, access);
> + &str, access, &file_status);
>
> if (!ok)
> goto error;
>
> - cb(&error, flen, str, rlen, access, cbd->data);
> + cb(&error, flen, str, rlen, access, file_status, cbd->data);
> +
> return;
>
> error:
> - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, cbd->data);
> + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
> + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> }
>
> static void at_sim_read_info(struct ofono_sim *sim, int fileid,
> @@ -123,7 +131,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
> unsigned char access[3] = { 0x00, 0x00, 0x00 };
>
> if (fileid == SIM_EFAD_FILEID) {
> - CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, data);
> + CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, 0x01, data);
> return;
> }
> }
> @@ -142,7 +150,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
> return;
>
> error:
> - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
> + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0xFF, data);
> }
>
> static void at_crsm_read_cb(gboolean ok, GAtResult *result,
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file
2010-10-14 10:57 ` [RFC PATCH 4/8] atmodem: " Denis Kenzior
@ 2010-10-14 16:54 ` Petteri Tikander
0 siblings, 0 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-14 16:54 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3633 bytes --]
Hi Denis,
> Hi Petteri,
>
> On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> > ---
> > drivers/atmodem/sim.c | 24 ++++++++++++++++--------
> > 1 files changed, 16 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
> > index d0a7148..d44b7d2 100644
> > --- a/drivers/atmodem/sim.c
> > +++ b/drivers/atmodem/sim.c
> > @@ -64,11 +64,13 @@ static void at_crsm_info_cb(gboolean ok, GAtResult
> > *result, gpointer user_data) int flen, rlen;
> > int str;
> > unsigned char access[3];
> > + unsigned char file_status;
> >
> > decode_at_error(&error, g_at_result_final_response(result));
> >
> > if (!ok) {
> > - cb(&error, -1, -1, -1, NULL, cbd->data);
> > + cb(&error, -1, -1, -1, NULL,
> > + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
>
> In the cases where an error occurs, I suggest passing in -1 for the
> file_status.
What about passing in 0 (INVALID)? Because I handle file_status as an bit-field,
unsigned char-type seems to be proper type for file_status, not signed-type
(for negative values).
>
> > return;
> > }
> >
> > @@ -88,27 +90,33 @@ static void at_crsm_info_cb(gboolean ok, GAtResult
> > *result, gpointer user_data) error.type = OFONO_ERROR_TYPE_SIM;
> > error.error = (sw1 << 8) | sw2;
> >
> > - cb(&error, -1, -1, -1, NULL, cbd->data);
> > + cb(&error, -1, -1, -1, NULL,
> > + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> > return;
> > }
> >
> > DBG("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
> >
> > - if (response[0] == 0x62)
> > + if (response[0] == 0x62) {
> > ok = sim_parse_3g_get_response(response, len, &flen, &rlen,
> > &str, access, NULL);
> > +
> > + file_status = SIM_FILE_STATUS_NOT_AVAILABLE;
>
> For this case, file_status should be 0. From what I remember of ETSI
> 102.221 3G sims do not return response data for invalidated files. But
> please double check this, or perhaps someone on the list knows.
>
I didn't find file-status in the 3G-response encoding either. Well, status byte-
coding gives similar return-value ('Selected file invalidated'). OK, for FDN-
support I need to check the ADN-file status only from 2G-response. But later
this issue can be implemented more properly.
> > + }
> > else
> > ok = sim_parse_2g_get_response(response, len, &flen, &rlen,
> > - &str, access);
> > + &str, access, &file_status);
> >
> > if (!ok)
> > goto error;
> >
> > - cb(&error, flen, str, rlen, access, cbd->data);
> > + cb(&error, flen, str, rlen, access, file_status, cbd->data);
> > +
> > return;
> >
> > error:
> > - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, cbd->data);
> > + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
> > + SIM_FILE_STATUS_NOT_AVAILABLE, cbd->data);
> > }
> >
> > static void at_sim_read_info(struct ofono_sim *sim, int fileid,
> > @@ -123,7 +131,7 @@ static void at_sim_read_info(struct ofono_sim *sim,
> > int fileid, unsigned char access[3] = { 0x00, 0x00, 0x00 };
> >
> > if (fileid == SIM_EFAD_FILEID) {
> > - CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, data);
> > + CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, 0x01, data);
> > return;
> > }
> > }
> > @@ -142,7 +150,7 @@ static void at_sim_read_info(struct ofono_sim *sim,
> > int fileid, return;
> >
> > error:
> > - CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
> > + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0xFF, data);
> >
> > }
> >
> > static void at_crsm_read_cb(gboolean ok, GAtResult *result,
>
> Regards,
> -Denis
>
Br, Petteri
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
2010-10-14 10:57 ` [RFC PATCH 4/8] atmodem: " Denis Kenzior
@ 2010-10-14 11:03 ` Denis Kenzior
2 siblings, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 11:03 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
Hi Petteri,
> +
> + file_status = SIM_FILE_STATUS_NOT_AVAILABLE;
Thinking about it, I actually meant using 1 here, since that means the
file is not invalidated.
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 3/8] simutil: response-handler returns now also file-status
2010-10-12 15:18 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
@ 2010-10-14 10:41 ` Denis Kenzior
2010-10-14 16:12 ` Petteri Tikander
1 sibling, 1 reply; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 10:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2462 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> ---
> src/simutil.c | 5 ++++-
> src/simutil.h | 11 ++++++++++-
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/simutil.c b/src/simutil.c
> index 65ce1ac..04ba975 100644
> --- a/src/simutil.c
> +++ b/src/simutil.c
> @@ -1405,7 +1405,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
>
> gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
> int *file_len, int *record_len,
> - int *structure, unsigned char *access)
> + int *structure, unsigned char *access,
> + unsigned char *file_status)
> {
> if (len < 14 || response[6] != 0x04)
> return FALSE;
> @@ -1420,6 +1421,8 @@ gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
> access[1] = response[9];
> access[2] = response[10];
>
> + *file_status = response[11];
> +
> if (response[13] == 0x01 || response[13] == 0x03)
> *record_len = response[14];
> else
This looks fine.
> diff --git a/src/simutil.h b/src/simutil.h
> index 54b99a0..bd8e4ac 100644
> --- a/src/simutil.h
> +++ b/src/simutil.h
> @@ -57,6 +57,14 @@ enum sim_file_access {
> SIM_FILE_ACCESS_NEVER = 15,
> };
>
> +/* 51.011 Section 9.3 */
> +enum sim_file_status {
> + SIM_FILE_STATUS_INVALID = 0x00,
> + SIM_FILE_STATUS_NOT_INVALID = 0x01,
> + SIM_FILE_STATUS_INVALID_BUT_ACCESS = 0x04,
> + SIM_FILE_STATUS_NOT_AVAILABLE = 0xFF,
> +};
> +
I don't like this, you should structure this enum as a set of status flags.
E.g. SIM_FILE_STATUS_VALID = 0x01, SIM_FILE_STATUS_RW_WHEN_INVALID = 0x04
I don't see the need for the NOT_AVAILABLE enum since you will never
check this status in the 3G case. Passing 0 here is fine. But feel
free to correct me if I'm wrong.
> /* 131.102 Section 4.2.8 */
> enum sim_ust_service {
> SIM_UST_SERVICE_LOCAL_PHONE_BOOK = 0,
> @@ -425,7 +433,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
>
> gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
> int *file_len, int *record_len,
> - int *structure, unsigned char *access);
> + int *structure, unsigned char *access,
> + unsigned char *file_status);
>
> gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
> enum sim_ust_service index);
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [RFC PATCH 3/8] simutil: response-handler returns now also file-status
2010-10-14 10:41 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Denis Kenzior
@ 2010-10-14 16:12 ` Petteri Tikander
0 siblings, 0 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-14 16:12 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2876 bytes --]
Hi Denis,
> Hi Petteri,
>
> On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> > ---
> > src/simutil.c | 5 ++++-
> > src/simutil.h | 11 ++++++++++-
> > 2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/simutil.c b/src/simutil.c
> > index 65ce1ac..04ba975 100644
> > --- a/src/simutil.c
> > +++ b/src/simutil.c
> > @@ -1405,7 +1405,8 @@ gboolean sim_parse_3g_get_response(const unsigned
> > char *data, int len,
> >
> > gboolean sim_parse_2g_get_response(const unsigned char *response, int
> > len, int *file_len, int *record_len,
> > - int *structure, unsigned char *access)
> > + int *structure, unsigned char *access,
> > + unsigned char *file_status)
> > {
> > if (len < 14 || response[6] != 0x04)
> > return FALSE;
> > @@ -1420,6 +1421,8 @@ gboolean sim_parse_2g_get_response(const unsigned
> > char *response, int len, access[1] = response[9];
> > access[2] = response[10];
> >
> > + *file_status = response[11];
> > +
> > if (response[13] == 0x01 || response[13] == 0x03)
> > *record_len = response[14];
> > else
>
> This looks fine.
>
:)
> > diff --git a/src/simutil.h b/src/simutil.h
> > index 54b99a0..bd8e4ac 100644
> > --- a/src/simutil.h
> > +++ b/src/simutil.h
> > @@ -57,6 +57,14 @@ enum sim_file_access {
> > SIM_FILE_ACCESS_NEVER = 15,
> > };
> >
> > +/* 51.011 Section 9.3 */
> > +enum sim_file_status {
> > + SIM_FILE_STATUS_INVALID = 0x00,
> > + SIM_FILE_STATUS_NOT_INVALID = 0x01,
> > + SIM_FILE_STATUS_INVALID_BUT_ACCESS = 0x04,
> > + SIM_FILE_STATUS_NOT_AVAILABLE = 0xFF,
> > +};
> > +
>
> I don't like this, you should structure this enum as a set of status flags.
>
> E.g. SIM_FILE_STATUS_VALID = 0x01, SIM_FILE_STATUS_RW_WHEN_INVALID = 0x04
>
> I don't see the need for the NOT_AVAILABLE enum since you will never
> check this status in the 3G case. Passing 0 here is fine. But feel
> free to correct me if I'm wrong.
I can change definitions to describe pure bit-values. NOT_AVAILABLE-enum is not
actually used anywhere. So I can remove it :)
I just check invalidated-bit in the SIM-atom (which I'll have to change to be
checked with AND-operation).
>
> > /* 131.102 Section 4.2.8 */
> > enum sim_ust_service {
> > SIM_UST_SERVICE_LOCAL_PHONE_BOOK = 0,
> > @@ -425,7 +433,8 @@ gboolean sim_parse_3g_get_response(const unsigned
> > char *data, int len,
> >
> > gboolean sim_parse_2g_get_response(const unsigned char *response, int
> > len, int *file_len, int *record_len,
> > - int *structure, unsigned char *access);
> > + int *structure, unsigned char *access,
> > + unsigned char *file_status);
> >
> > gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char
> > len, enum sim_ust_service index);
>
> Regards,
> -Denis
>
Br, Petteri
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents
2010-10-12 15:18 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
@ 2010-10-14 11:10 ` Denis Kenzior
1 sibling, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 11:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3781 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> Handling of new parameter (file status) from the driver added.
> This commit doesn't store EF-info into cache yet.
> ---
> src/simfs.c | 27 +++++++++++++++++++++++----
> src/simfs.h | 1 +
> 2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/src/simfs.c b/src/simfs.c
> index b5b12b4..24ce7ec 100644
> --- a/src/simfs.c
> +++ b/src/simfs.c
> @@ -58,6 +58,7 @@ struct sim_fs_op {
> int id;
> enum ofono_sim_file_structure structure;
> unsigned short offset;
> + gboolean info_only;
> int num_bytes;
> int length;
> int record_length;
> @@ -426,7 +427,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);
> @@ -438,6 +441,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);
> @@ -473,11 +477,24 @@ 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);
Please watch out for coding style violations. There should be an empty
line before the if statement.
> } 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);
Same comment as above
> + }
> +
> + 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)
> @@ -522,7 +539,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);
> @@ -635,6 +652,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)
> {
> @@ -661,6 +679,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 6d5dded..284d15b 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);
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file
2010-10-12 15:18 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
@ 2010-10-14 11:07 ` Denis Kenzior
2010-10-14 15:14 ` Petteri Tikander
1 sibling, 1 reply; 24+ messages in thread
From: Denis Kenzior @ 2010-10-14 11:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3597 bytes --]
Hi Petteri,
On 10/12/2010 10:18 AM, Petteri Tikander wrote:
> Function reads file length, record length, file status etc,
> but doesn't retrieve any EF-contents.
> Request for EFadn is added, but this commit just debugs
> the response.
> ---
> include/sim.h | 11 +++++++++++
> src/sim.c | 30 ++++++++++++++++++++++++++++--
> 2 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/include/sim.h b/include/sim.h
> index 42b19bd..8dd6131 100644
> --- a/include/sim.h
> +++ b/include/sim.h
> @@ -82,6 +82,7 @@ typedef void (*ofono_sim_file_info_cb_t)(const struct ofono_error *error,
> enum ofono_sim_file_structure structure,
> int recordlength,
> const unsigned char access[3],
> + unsigned char file_status,
> void *data);
I suggest breaking this out into a separate patch and shuffling patch 4
and path 5 to follow after this patch. This patch should also come
before the changes to ofono_sim_read_info.
>
> typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
> @@ -206,6 +207,16 @@ 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);
> +
> +/*
> + * This function reads only general info from SIM-file with
> + * requested id (file length, record length, file status etc),
> + * not any records.
> + */
> +int ofono_sim_read_info(struct ofono_sim *sim, int id,
> + enum ofono_sim_file_structure expected,
> + ofono_sim_file_read_cb_t cb, void *data);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/src/sim.c b/src/sim.c
> index 6f10d4c..f0633bb 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -1183,6 +1183,15 @@ static void sim_efphase_read_cb(int ok, int length, int record,
> sim->phase = data[0];
> }
>
> +static void sim_info_read_cb(int ok, int length, int record,
> + const unsigned char *file_status,
> + int record_length, void *userdata)
> +{
> + DBG("OK: %d, length: %d, record: %d, \
> + file_status: %x, record_length: %d",
> + ok, length, record, file_status[0], record_length);
> +}
> +
Is this function actually used?
> static void sim_initialize_after_pin(struct ofono_sim *sim)
> {
> ofono_sim_read(sim, SIM_EFPHASE_FILEID,
> @@ -1530,7 +1539,7 @@ int ofono_sim_read_bytes(struct ofono_sim *sim, int id,
> return -1;
>
> return sim_fs_read(sim->simfs, id, OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
> - offset, num_bytes, cb, data);
> + FALSE, offset, num_bytes, cb, data);
> }
>
> int ofono_sim_read(struct ofono_sim *sim, int id,
> @@ -1540,7 +1549,24 @@ int ofono_sim_read(struct ofono_sim *sim, int id,
> if (sim == NULL)
> return -1;
>
> - return sim_fs_read(sim->simfs, id, expected_type, 0, 0, cb, data);
> + return sim_fs_read(sim->simfs, id, expected_type, FALSE,
> + 0, 0, cb, data);
> +}
> +
> +int ofono_sim_read_info(struct ofono_sim *sim, int id,
> + enum ofono_sim_file_structure expected_type,
> + ofono_sim_file_read_cb_t cb, void *data)
> +{
> + /*
> + * Retrieve EF-info only (file length, record length, file status etc).
> + * So this function doesn't retrieve actual EF-contents.
> + */
> +
> + if (sim == NULL)
> + return -1;
> +
> + return sim_fs_read(sim->simfs, id, expected_type, TRUE,
> + 0, 0, cb, data);
This sim fs changes should precede this patch.
> }
>
> int ofono_sim_write(struct ofono_sim *sim, int id,
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file
2010-10-14 11:07 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Denis Kenzior
@ 2010-10-14 15:14 ` Petteri Tikander
0 siblings, 0 replies; 24+ messages in thread
From: Petteri Tikander @ 2010-10-14 15:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4061 bytes --]
Hi Denis,
and thanks for comments
> > ---
> > include/sim.h | 11 +++++++++++
> > src/sim.c | 30 ++++++++++++++++++++++++++++--
> > 2 files changed, 39 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/sim.h b/include/sim.h
> > index 42b19bd..8dd6131 100644
> > --- a/include/sim.h
> > +++ b/include/sim.h
> > @@ -82,6 +82,7 @@ typedef void (*ofono_sim_file_info_cb_t)(const struct
> > ofono_error *error, enum ofono_sim_file_structure structure,
> > int recordlength,
> > const unsigned char access[3],
> > + unsigned char file_status,
> > void *data);
>
> I suggest breaking this out into a separate patch and shuffling patch 4
> and path 5 to follow after this patch. This patch should also come
> before the changes to ofono_sim_read_info.
>
OK.
I'll send in the next order (naturally updated versions according to the
comments):
2/8,
3/8,
1/8 (header-change only),
4/8,
5/8,
(6/8 applied),
1/8 (source code change: ofono_sim_read_info, no call-back handling),
7/8,
8/8
> > typedef void (*ofono_sim_read_cb_t)(const struct ofono_error *error,
> > @@ -206,6 +207,16 @@ 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);
> > +
> > +/*
> > + * This function reads only general info from SIM-file with
> > + * requested id (file length, record length, file status etc),
> > + * not any records.
> > + */
> > +int ofono_sim_read_info(struct ofono_sim *sim, int id,
> > + enum ofono_sim_file_structure expected,
> > + ofono_sim_file_read_cb_t cb, void *data);
> > +
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/src/sim.c b/src/sim.c
> > index 6f10d4c..f0633bb 100644
> > --- a/src/sim.c
> > +++ b/src/sim.c
> > @@ -1183,6 +1183,15 @@ static void sim_efphase_read_cb(int ok, int
> > length, int record, sim->phase = data[0];
> > }
> >
> > +static void sim_info_read_cb(int ok, int length, int record,
> > + const unsigned char *file_status,
> > + int record_length, void *userdata)
> > +{
> > + DBG("OK: %d, length: %d, record: %d, \
> > + file_status: %x, record_length: %d",
> > + ok, length, record, file_status[0], record_length);
> > +}
> > +
>
> Is this function actually used?
Yes, but not with that debug-content. I'll separate this patch into two
patches (header/source), and send source-patch in logical order (where
ofono_sim_read/ofono_sim_read_cb are really used without just debugging).
>
> > static void sim_initialize_after_pin(struct ofono_sim *sim)
> > {
> > ofono_sim_read(sim, SIM_EFPHASE_FILEID,
> > @@ -1530,7 +1539,7 @@ int ofono_sim_read_bytes(struct ofono_sim *sim, int
> > id, return -1;
> >
> > return sim_fs_read(sim->simfs, id,
> > OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, - offset, num_bytes, cb, data);
> > + FALSE, offset, num_bytes, cb, data);
> > }
> >
> > int ofono_sim_read(struct ofono_sim *sim, int id,
> > @@ -1540,7 +1549,24 @@ int ofono_sim_read(struct ofono_sim *sim, int id,
> > if (sim == NULL)
> > return -1;
> >
> > - return sim_fs_read(sim->simfs, id, expected_type, 0, 0, cb, data);
> > + return sim_fs_read(sim->simfs, id, expected_type, FALSE,
> > + 0, 0, cb, data);
> > +}
> > +
> > +int ofono_sim_read_info(struct ofono_sim *sim, int id,
> > + enum ofono_sim_file_structure expected_type,
> > + ofono_sim_file_read_cb_t cb, void *data)
> > +{
> > + /*
> > + * Retrieve EF-info only (file length, record length, file status etc).
> > + * So this function doesn't retrieve actual EF-contents.
> > + */
> > +
> > + if (sim == NULL)
> > + return -1;
> > +
> > + return sim_fs_read(sim->simfs, id, expected_type, TRUE,
> > + 0, 0, cb, data);
>
> This sim fs changes should precede this patch.
>
OK.
> > }
> >
> > int ofono_sim_write(struct ofono_sim *sim, int id,
>
> Regards,
> -Denis
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file
@ 2010-10-14 21:02 Petteri Tikander
2010-10-14 21:02 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
0 siblings, 1 reply; 24+ messages in thread
From: Petteri Tikander @ 2010-10-14 21:02 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2320 bytes --]
---
drivers/atmodem/sim.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d0a7148..90d87bc 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -64,11 +64,12 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
int flen, rlen;
int str;
unsigned char access[3];
+ unsigned char file_status;
decode_at_error(&error, g_at_result_final_response(result));
if (!ok) {
- cb(&error, -1, -1, -1, NULL, cbd->data);
+ cb(&error, -1, -1, -1, NULL, 0, cbd->data);
return;
}
@@ -88,27 +89,31 @@ static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
error.type = OFONO_ERROR_TYPE_SIM;
error.error = (sw1 << 8) | sw2;
- cb(&error, -1, -1, -1, NULL, cbd->data);
+ cb(&error, -1, -1, -1, NULL, 0, cbd->data);
return;
}
DBG("crsm_info_cb: %02x, %02x, %i", sw1, sw2, len);
- if (response[0] == 0x62)
+ if (response[0] == 0x62) {
ok = sim_parse_3g_get_response(response, len, &flen, &rlen,
&str, access, NULL);
+
+ file_status = SIM_FILE_STATUS_VALID;
+ }
else
ok = sim_parse_2g_get_response(response, len, &flen, &rlen,
- &str, access);
+ &str, access, &file_status);
if (!ok)
goto error;
- cb(&error, flen, str, rlen, access, cbd->data);
+ cb(&error, flen, str, rlen, access, file_status, cbd->data);
+
return;
error:
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, cbd->data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0, cbd->data);
}
static void at_sim_read_info(struct ofono_sim *sim, int fileid,
@@ -123,7 +128,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
unsigned char access[3] = { 0x00, 0x00, 0x00 };
if (fileid == SIM_EFAD_FILEID) {
- CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, data);
+ CALLBACK_WITH_SUCCESS(cb, 4, 0, 0, access, 1, data);
return;
}
}
@@ -142,7 +147,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
return;
error:
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0, data);
}
static void at_crsm_read_cb(gboolean ok, GAtResult *result,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread* [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file
2010-10-14 21:02 [RFC PATCH 4/8] atmodem: returns file-status of " Petteri Tikander
@ 2010-10-14 21:02 ` Petteri Tikander
2010-10-15 12:27 ` Denis Kenzior
0 siblings, 1 reply; 24+ messages in thread
From: Petteri Tikander @ 2010-10-14 21:02 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
---
drivers/isimodem/sim.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
index 44e539a..d978c85 100644
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -54,6 +54,7 @@ struct file_info {
int structure;
int record_length;
unsigned char access[3];
+ unsigned char file_status;
};
/* Returns file info */
@@ -66,7 +67,7 @@ static gboolean fake_file_info(gpointer user)
DBG("Returning static file_info for %04x", fi->fileid);
CALLBACK_WITH_SUCCESS(cb,
fi->length, fi->structure, fi->record_length,
- fi->access, cbd->data);
+ fi->access, fi->file_status, cbd->data);
g_free(cbd);
return FALSE;
}
@@ -76,8 +77,8 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
{
int i;
static struct file_info const info[] = {
- { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff } },
- { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff } },
+ { SIM_EFSPN_FILEID, 17, 0, 0, { 0x0f, 0xff, 0xff }, 1 },
+ { SIM_EF_ICCID_FILEID, 10, 0, 0, { 0x0f, 0xff, 0xff }, 1 },
};
int N = sizeof(info) / sizeof(info[0]);
struct isi_cb_data *cbd;
@@ -91,7 +92,7 @@ static void isi_read_file_info(struct ofono_sim *sim, int fileid,
}
DBG("Not implemented (fileid = %04x)", fileid);
- CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data);
+ CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, 0, data);
}
static gboolean spn_resp_cb(GIsiClient *client,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
end of thread, other threads:[~2010-10-15 12:27 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-12 15:18 Handling of Fixed Dialing v3 Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 4/8] atmodem: returns file-status of SIM EF-file Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 6/8] simutil: add ID of EFadn Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Petteri Tikander
2010-10-12 15:18 ` [RFC PATCH 8/8] doc: update sim-api Petteri Tikander
2010-10-14 5:56 ` Marcel Holtmann
2010-10-14 11:22 ` [RFC PATCH 7/8] sim: check if Fixed Dialing is enabled in the SIM-card Denis Kenzior
2010-10-14 11:24 ` Denis Kenzior
2010-10-14 10:43 ` [RFC PATCH 6/8] simutil: add ID of EFadn Denis Kenzior
2010-10-14 10:58 ` [RFC PATCH 5/8] isimodem: returns file-status of SIM EF-file Denis Kenzior
2010-10-14 10:57 ` [RFC PATCH 4/8] atmodem: " Denis Kenzior
2010-10-14 16:54 ` Petteri Tikander
2010-10-14 11:03 ` Denis Kenzior
2010-10-14 10:41 ` [RFC PATCH 3/8] simutil: response-handler returns now also file-status Denis Kenzior
2010-10-14 16:12 ` Petteri Tikander
2010-10-14 11:10 ` [RFC PATCH 2/8] simfs: add logic to retrieve only only EF-info, but no EF-contents Denis Kenzior
2010-10-14 11:07 ` [RFC PATCH 1/8] sim: add function to read general info from SIM EF-file Denis Kenzior
2010-10-14 15:14 ` Petteri Tikander
-- strict thread matches above, loose matches on Subject: below --
2010-10-14 21:02 [RFC PATCH 4/8] atmodem: returns file-status of " Petteri Tikander
2010-10-14 21:02 ` [RFC PATCH 5/8] isimodem: " Petteri Tikander
2010-10-15 12:27 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.