From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> If the profile setup fails during module load, the fallback should be setting the profile to off, exactly as it is done in card_set_profile(). --- src/modules/bluetooth/module-bluetooth-device.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 03a7ccc..85123c2 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2574,6 +2574,7 @@ int pa__init(pa_module* m) { DBusError err; char *mike, *speaker; const pa_bluetooth_device *device; + pa_queue *inputs, *outputs; pa_assert(m); @@ -2678,14 +2679,24 @@ int pa__init(pa_module* m) { if (u->profile != PROFILE_OFF) if (init_profile(u) < 0) - goto fail; + goto off; if (u->sink || u->source) if (start_thread(u) < 0) - goto fail; + goto off; return 0; +off: + move_all_start(u, &inputs, &outputs); + stop_thread(u); + move_all_end(u, inputs, outputs); + + if (pa_card_set_profile(u->card, "off", FALSE) >= 0) + return 0; + + pa_log_debug("Failed to switch profile to off"); + fail: pa__done(m); -- 1.7.11.4