From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> A plugin might create an instance of audio_device using the manager's API and therefore a equivalent function is needed for removal. This simple approach assumes that there will be no more than one plugin adding/removing audio devices. --- profiles/audio/manager.c | 12 ++++++++++++ profiles/audio/manager.h | 1 + 2 files changed, 13 insertions(+) diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c index 7f02fbd..6b5d912 100644 --- a/profiles/audio/manager.c +++ b/profiles/audio/manager.c @@ -464,6 +464,18 @@ struct audio_device *manager_get_audio_device(struct btd_device *device, return dev; } +void manager_remove_audio_device(struct audio_device *dev) +{ + if (dev == NULL) + return; + + if (dev->sink || dev->source || dev->control) + return; + + devices = g_slist_remove(devices, dev); + audio_device_unregister(dev); +} + static void set_fast_connectable(struct btd_adapter *adapter, gpointer user_data) { diff --git a/profiles/audio/manager.h b/profiles/audio/manager.h index b8d8ef7..8167a86 100644 --- a/profiles/audio/manager.h +++ b/profiles/audio/manager.h @@ -34,6 +34,7 @@ void audio_manager_exit(void); struct audio_device *manager_get_audio_device(struct btd_device *device, gboolean create); +void manager_remove_audio_device(struct audio_device *dev); /* TRUE to enable fast connectable and FALSE to disable fast connectable for all * audio adapters. */ -- 1.8.1.4 -- 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