[pulseaudio-discuss] [PATCH v2 7/9] bluetooth: Set to off instead of failing module load

Mikel Astiz mikel.astiz.oss at gmail.com
Fri Oct 19 01:11:27 PDT 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 8b14c61..a907e4b 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2647,11 +2647,18 @@ 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:
+    stop_thread(u);
+
+    pa_assert_se(pa_card_set_profile(u->card, "off", false) >= 0);
 
     return 0;
 
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list