]> code.delx.au - pulseaudio/commitdiff
bluetooth: Fail to load driver if discovery module is not loaded
authorJoão Paulo Rechi Vita <jprvita@openbossa.org>
Tue, 24 Sep 2013 22:45:56 +0000 (19:45 -0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Sun, 29 Sep 2013 13:54:38 +0000 (16:54 +0300)
For quite some time now the device driver module doesn't work well
without the discovery module, so for the BlueZ 5 support we'll prevent
the device driver module to be loaded if the discovery module is not
loaded.

src/modules/bluetooth/bluez5-util.c
src/modules/bluetooth/module-bluez5-device.c
src/modules/bluetooth/module-bluez5-discover.c

index 9df90217f36df696415dc2b45cdb5b10b108bce4..225e5c828f1156d27d0270bf5988624198304c00 100644 (file)
@@ -1514,9 +1514,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
     DBusConnection *conn;
     unsigned i;
 
-    if ((y = pa_shared_get(c, "bluetooth-discovery")))
-        return pa_bluetooth_discovery_ref(y);
-
     y = pa_xnew0(pa_bluetooth_discovery, 1);
     PA_REFCNT_INIT(y);
     y->core = c;
index 36d71746c46c0e1c030ddd47dcec78dffb5fe340..013cce5b9b1a52849f8b4b7635de6947367c838d 100644 (file)
@@ -39,6 +39,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/poll.h>
 #include <pulsecore/rtpoll.h>
+#include <pulsecore/shared.h>
 #include <pulsecore/socket-util.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/thread-mq.h>
@@ -1792,8 +1793,12 @@ int pa__init(pa_module* m) {
         goto fail;
     }
 
-    if (!(u->discovery = pa_bluetooth_discovery_get(m->core)))
+    if ((u->discovery = pa_shared_get(u->core, "bluetooth-discovery")))
+        pa_bluetooth_discovery_ref(u->discovery);
+    else {
+        pa_log_error("module-bluez5-discover doesn't seem to be loaded, refusing to load module-bluez5-device");
         goto fail;
+    }
 
     if (!(u->device = pa_bluetooth_discovery_get_device_by_path(u->discovery, path))) {
         pa_log_error("%s is unknown", path);
index 9f392a289b8b87de74c0fb6e862cbc64ea03a62b..0b7bf49799e476e2760332b763f856c29d675441 100644 (file)
@@ -27,6 +27,7 @@
 #include <pulsecore/core-util.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/module.h>
+#include <pulsecore/shared.h>
 
 #include "bluez5-util.h"