From: Mikel Astiz <[email protected]>
Use the new interface name if BlueZ 5 has been detected.
---
src/modules/bluetooth/bluetooth-util.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/modules/bluetooth/bluetooth-util.c
b/src/modules/bluetooth/bluetooth-util.c
index f59d770..3c0fcf7 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1382,6 +1382,7 @@ bool pa_bluetooth_device_any_audio_connected(const
pa_bluetooth_device *d) {
int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional,
size_t *imtu, size_t *omtu) {
const char *accesstype = "rw";
+ const char *interface;
DBusMessage *m, *r;
DBusError err;
int ret;
@@ -1391,6 +1392,8 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport
*t, bool optional, siz
pa_assert(t->device);
pa_assert(t->device->discovery);
+ interface = t->device->discovery->version == BLUEZ_VERSION_4 ?
"org.bluez.MediaTransport" : "org.bluez.MediaTransport1";
+
if (optional) {
/* FIXME: we are trying to acquire the transport only if the stream is
playing, without actually initiating the stream request from our
side
@@ -1407,7 +1410,7 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport
*t, bool optional, siz
dbus_error_init(&err);
- pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path,
"org.bluez.MediaTransport", "Acquire"));
+ pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path,
interface, "Acquire"));
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype,
DBUS_TYPE_INVALID));
r =
dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(t->device->discovery->connection),
m, -1, &err);
@@ -1417,7 +1420,7 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport
*t, bool optional, siz
}
if (!dbus_message_get_args(r, &err, DBUS_TYPE_UNIX_FD, &ret,
DBUS_TYPE_UINT16, &i, DBUS_TYPE_UINT16, &o, DBUS_TYPE_INVALID)) {
- pa_log("Failed to parse org.bluez.MediaTransport.Acquire(): %s",
err.message);
+ pa_log("Failed to result of acquire: %s", err.message);
ret = -1;
dbus_error_free(&err);
goto fail;
@@ -1436,6 +1439,7 @@ fail:
void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
const char *accesstype = "rw";
+ const char *interface;
DBusMessage *m;
DBusError err;
@@ -1443,9 +1447,11 @@ void
pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
pa_assert(t->device);
pa_assert(t->device->discovery);
+ interface = t->device->discovery->version == BLUEZ_VERSION_4 ?
"org.bluez.MediaTransport" : "org.bluez.MediaTransport1";
+
dbus_error_init(&err);
- pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path,
"org.bluez.MediaTransport", "Release"));
+ pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path,
interface, "Release"));
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype,
DBUS_TYPE_INVALID));
dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(t->device->discovery->connection),
m, -1, &err);
--
1.7.11.7
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss