diff options
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/adapter.c | 13 | ||||
-rw-r--r-- | hcid/hcid.h | 1 | ||||
-rw-r--r-- | hcid/storage.c | 9 |
3 files changed, 21 insertions, 2 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index b589a721..763118e8 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -3459,6 +3459,7 @@ static DBusHandlerResult remove_device(DBusConnection *conn, DBusMessage *reply; const char *path; GSList *l; + bdaddr_t src; if (!hcid_dbus_use_experimental()) return error_unknown_method(conn, msg); @@ -3478,8 +3479,16 @@ static DBusHandlerResult remove_device(DBusConnection *conn, if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; - /* FIXME: Remove from filesystem */ - /* FIXME: Remove linkkeys */ + str2ba(adapter->address, &src); + delete_entry(&src, "profiles", device->address); + delete_entry(&src, "linkkey", device->address); + + dbus_connection_emit_signal(conn, + dbus_message_get_path(msg), + ADAPTER_INTERFACE, + "DeviceRemoved", + DBUS_TYPE_OBJECT_PATH, &device->path, + DBUS_TYPE_INVALID); device_destroy(device); adapter->devices = g_slist_remove(adapter->devices, device); diff --git a/hcid/hcid.h b/hcid/hcid.h index 03b12807..f32f4ae7 100644 --- a/hcid/hcid.h +++ b/hcid/hcid.h @@ -210,6 +210,7 @@ gboolean read_trust(bdaddr_t *local, const char *addr, const char *service); int write_trust(bdaddr_t *local, const char *addr, const char *service, gboolean trust); GSList *list_trusts(bdaddr_t *local, const char *service); int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles); +int delete_entry(bdaddr_t *src, const char *storage, const char *key); gboolean plugin_init(void); void plugin_cleanup(void); diff --git a/hcid/storage.c b/hcid/storage.c index 586d73f0..7c053cd5 100644 --- a/hcid/storage.c +++ b/hcid/storage.c @@ -691,3 +691,12 @@ int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles) ba2str(dst, addr); return textfile_put(filename, addr, profiles); } + +int delete_entry(bdaddr_t *src, const char *storage, const char *key) +{ + char filename[PATH_MAX + 1]; + + create_filename(filename, PATH_MAX, src, storage); + + return textfile_del(filename, key); +} |