summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArron Wang <arron.wang@intel.com>2014-05-21 00:49:17 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2014-05-21 00:49:17 +0200
commitf40ed8918027496ebdecce95844b3f56cc01e102 (patch)
tree82aa56d2e4325ca34e50f7e2a381e8ab3f998861
parentf44ce62dc83799f80bca8d2ad6f50546e21694c9 (diff)
downloadneard-f40ed8918027496ebdecce95844b3f56cc01e102.tar.gz
neard-f40ed8918027496ebdecce95844b3f56cc01e102.tar.bz2
neard-f40ed8918027496ebdecce95844b3f56cc01e102.zip
tizen: Use modem path as the key for modem_hash
We only get the modem name from the telephony GetModems interface, but in sim_changed signal, we get the dbus path, this patch will make them in accordance with each other.
-rw-r--r--se/plugins/tizen.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/se/plugins/tizen.c b/se/plugins/tizen.c
index e398320..62c6c42 100644
--- a/se/plugins/tizen.c
+++ b/se/plugins/tizen.c
@@ -153,10 +153,10 @@ static void add_modem(const char *path)
if (modem == NULL)
return;
- modem->path = g_strdup_printf("%s/%s", TELEPHONY_DEFAULT_PATH, path);
+ modem->path = g_strdup(path);
modem->sim_available = false;
- g_hash_table_insert(modem_hash, g_strdup(path), modem);
+ g_hash_table_insert(modem_hash, g_strdup(modem->path), modem);
}
static void remove_modem(gpointer user_data)
@@ -193,10 +193,15 @@ static void get_modems_reply(DBusPendingCall *call, void *user_data)
dbus_message_iter_recurse(&array, &entry);
while (dbus_message_iter_get_arg_type(&entry) == DBUS_TYPE_STRING) {
- const char *path;
+ const char *name, *path;
- dbus_message_iter_get_basic(&entry, &path);
- add_modem(path);
+ dbus_message_iter_get_basic(&entry, &name);
+
+ path = g_strdup_printf("%s/%s", TELEPHONY_DEFAULT_PATH, name);
+ if (path != NULL) {
+ add_modem(path);
+ g_free(path);
+ }
dbus_message_iter_next(&entry);
}
@@ -296,13 +301,11 @@ static gboolean sim_changed(DBusConnection *conn, DBusMessage *message,
struct tapi_modem *modem;
int status;
- DBG("");
-
DBG("modem_path %s", path);
modem = g_hash_table_lookup(modem_hash, path);
- if (modem != NULL)
- add_modem(path);
+ if (modem == NULL)
+ return TRUE;
if (!dbus_message_get_args(message, NULL, DBUS_TYPE_INT32, &status,
DBUS_TYPE_INVALID))