From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> This is a follow-up of Tanu's work on fixing the issue with duplicated module-bluetooth-device instances. Main changes from v2: - Audio.State is not removed since otherwise there is an issue with module-card-restore (see Tanu's v2 cover-letter). - Instead of using an additional field to represent if any audio profile has been connected, a helper function is used (patch 3/5). - No additional hook is added and instead the discovery hook is reused. >From Tanu's original cover-letter: Currently, when a bluetooth device is disconnected, pulseaudio doesn't unload the device module. The last patch fixes that. The preceding patches do some refactoring so that the final patch can be as nice as it is. Mikel Astiz (1): bluetooth: Rename former device_use_audio() Tanu Kaskinen (4): bluetooth: Ignore Device.Connected bluetooth: Add helper pa_bluetooth_device_any_audio_connected() bluetooth: Run the discovery hook only when necessary bluetooth: Unload device module when no audio profiles connected src/modules/bluetooth/bluetooth-util.c | 34 +++++++++++++++++------ src/modules/bluetooth/bluetooth-util.h | 2 +- src/modules/bluetooth/module-bluetooth-device.c | 28 +++++++++++++++++-- src/modules/bluetooth/module-bluetooth-discover.c | 5 +--- 4 files changed, 52 insertions(+), 17 deletions(-) -- 1.7.11.7