summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2011-02-15 08:58:56 +0100
committerDenis Kenzior <denkenz@gmail.com>2011-02-17 15:09:17 -0600
commit9e640a246a563564e184335324fb3932fe4facdb (patch)
treed911309ecceee92d5e7dfbfeb205040a4d75a756 /src
parent1d38e7e075f7c7b2efc9250d3d57e790f3b2f6f8 (diff)
downloadofono-9e640a246a563564e184335324fb3932fe4facdb.tar.bz2
cbs: Watch for changes to relevant SIM files
Diffstat (limited to 'src')
-rw-r--r--src/cbs.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/cbs.c b/src/cbs.c
index cf8fc101..c58ff892 100644
--- a/src/cbs.c
+++ b/src/cbs.c
@@ -68,6 +68,7 @@ struct ofono_cbs {
GSList *efcbmir_contents;
unsigned short efcbmid_length;
GSList *efcbmid_contents;
+ gboolean efcbmid_update;
guint reset_source;
int lac;
int ci;
@@ -852,6 +853,7 @@ static void sim_cbmid_read_cb(int ok, int length, int record,
int i;
char *str;
GSList *contents = NULL;
+ char *topic_str;
if (!ok)
goto done;
@@ -886,7 +888,33 @@ static void sim_cbmid_read_cb(int ok, int length, int record,
g_free(str);
done:
- cbs_got_file_contents(cbs);
+ if (cbs->efcbmid_update) {
+ topic_str = cbs_topics_to_str(cbs, cbs->topics);
+ cbs->driver->set_topics(cbs, topic_str,
+ cbs_set_powered_cb, cbs);
+ g_free(topic_str);
+
+ cbs->efcbmid_update = FALSE;
+ } else
+ cbs_got_file_contents(cbs);
+}
+
+static void cbs_efcbmid_changed(int id, void *userdata)
+{
+ struct ofono_cbs *cbs = userdata;
+
+ if (cbs->efcbmid_length) {
+ cbs->efcbmid_length = 0;
+ g_slist_foreach(cbs->efcbmid_contents, (GFunc) g_free, NULL);
+ g_slist_free(cbs->efcbmid_contents);
+ cbs->efcbmid_contents = NULL;
+ }
+
+ cbs->efcbmid_update = TRUE;
+
+ ofono_sim_read(cbs->sim_context, SIM_EFCBMID_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+ sim_cbmid_read_cb, cbs);
}
static void cbs_got_imsi(struct ofono_cbs *cbs)
@@ -929,6 +957,8 @@ static void cbs_got_imsi(struct ofono_cbs *cbs)
ofono_sim_read(cbs->sim_context, SIM_EFCBMID_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_cbmid_read_cb, cbs);
+ ofono_sim_add_file_watch(cbs->sim_context, SIM_EFCBMID_FILEID,
+ cbs_efcbmid_changed, cbs, NULL);
}
static gboolean reset_base_station_name(gpointer user)