--- health/hdp.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/health/hdp.c b/health/hdp.c index 25a644c..a38cbe0 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -401,13 +401,10 @@ static void health_link_free(struct hdp_link *hdpl) if (hdpl->mcl) { mcap_close_mcl(hdpl->mcl, FALSE); mcap_mcl_unref(hdpl->mcl); - hdpl->mcl = NULL; } - if (hdpl->path) { + if (hdpl->path) g_free(hdpl->path); - hdpl->path = NULL; - } hdpl->hdpi->hlink = g_slist_remove(hdpl->hdpi->hlink, hdpl); g_free(hdpl); @@ -623,32 +620,37 @@ static DBusMessage *hdp_disconnect(DBusConnection *conn, DBusMessage *msg, void *user_data) { struct hdp_device *device = user_data; - struct hdp_link *hlink; + struct hdp_link *hdpl; const char *path; - const gboolean *del; + gboolean cache; if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_BOOLEAN, &del, - DBUS_TYPE_INVALID)){ + DBUS_TYPE_BOOLEAN, &cache, + DBUS_TYPE_INVALID)){ return g_dbus_create_error(msg, ERROR_INTERFACE ".InvalidArguments", "Invalid arguments in method call"); } - hlink = find_health_link(device->hdp_adapter, path); - if (!hlink) + hdpl = find_health_link(device->hdp_adapter, path); + if (!hdpl) return g_dbus_create_error(msg, ERROR_INTERFACE ".HealthError", "Health link does not found"); - return g_dbus_create_error(msg, ERROR_INTERFACE ".HealthError", - "Not yet implemented"); + if (cache) { + mcap_close_mcl(hdpl->mcl, cache); + hdpl->closed = TRUE; + } else + g_dbus_unregister_interface(conn, hdpl->path, HEALTH_LINK); + + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } static GDBusMethodTable device_methods[] = { { "GetHealthInstances", "", "aa{sv}", get_health_instances, G_DBUS_METHOD_FLAG_ASYNC }, { "Connect", "uu", "o", hdp_connect, G_DBUS_METHOD_FLAG_ASYNC }, - { "Diconnect", "ob", "", hdp_disconnect }, + { "Disconnect", "ob", "", hdp_disconnect }, { NULL } }; -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html