diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-10-02 14:02:28 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-10-02 18:25:56 -0500 |
commit | be55ba4ab3e706caa9cbc6c854e78d045c723f9a (patch) | |
tree | add0164280a4cb8fa7baecdf148843b3ccea2e41 /src/cbs.c | |
parent | 6d9ec892595344d830e6831e3a868a67f4dfcf9c (diff) | |
download | ofono-be55ba4ab3e706caa9cbc6c854e78d045c723f9a.tar.bz2 |
Refactor: Move elementary file type checking
Every single EF read callback checks the file type reported out of the
SIM is what it expects. Instead this should be done in one place and
the errors reported accordingly
Diffstat (limited to 'src/cbs.c')
-rw-r--r-- | src/cbs.c | 30 |
1 files changed, 9 insertions, 21 deletions
@@ -514,9 +514,7 @@ struct ofono_cbs *ofono_cbs_create(struct ofono_modem *modem, return cbs; } -static void sim_cbmi_read_cb(int ok, - enum ofono_sim_file_structure structure, - int length, int record, +static void sim_cbmi_read_cb(int ok, int length, int record, const unsigned char *data, int record_length, void *userdata) { @@ -528,9 +526,6 @@ static void sim_cbmi_read_cb(int ok, if (!ok) return; - if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT) - return; - if ((length % 2) == 1 || length < 2) return; @@ -570,9 +565,7 @@ static void sim_cbmi_read_cb(int ok, cbs->efcbmi_contents = NULL; } -static void sim_cbmir_read_cb(int ok, - enum ofono_sim_file_structure structure, - int length, int record, +static void sim_cbmir_read_cb(int ok, int length, int record, const unsigned char *data, int record_length, void *userdata) { @@ -585,9 +578,6 @@ static void sim_cbmir_read_cb(int ok, if (!ok) return; - if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT) - return; - if ((length % 4) != 0) return; @@ -629,9 +619,7 @@ static void sim_cbmir_read_cb(int ok, cbs->efcbmir_contents = NULL; } -static void sim_cbmid_read_cb(int ok, - enum ofono_sim_file_structure structure, - int length, int record, +static void sim_cbmid_read_cb(int ok, int length, int record, const unsigned char *data, int record_length, void *userdata) { @@ -643,9 +631,6 @@ static void sim_cbmid_read_cb(int ok, if (!ok) return; - if (structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT) - return; - if ((length % 2) == 1 || length < 2) return; @@ -689,11 +674,14 @@ static void cbs_got_imsi(struct ofono_cbs *cbs) ofono_debug("Got IMSI: %s", imsi); ofono_sim_read(cbs->sim, SIM_EFCBMI_FILEID, - sim_cbmi_read_cb, cbs); + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_cbmi_read_cb, cbs); ofono_sim_read(cbs->sim, SIM_EFCBMIR_FILEID, - sim_cbmir_read_cb, cbs); + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_cbmir_read_cb, cbs); ofono_sim_read(cbs->sim, SIM_EFCBMID_FILEID, - sim_cbmid_read_cb, cbs); + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_cbmid_read_cb, cbs); } static gboolean reset_base_station_name(gpointer user) |