[pulseaudio-commits] Branch 'next' - 3 commits - src/modules
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Thu May 9 02:33:18 PDT 2013
src/modules/bluetooth/bluetooth-util.c | 69 +++++++++++++++++++++++----------
1 file changed, 49 insertions(+), 20 deletions(-)
New commits:
commit 8090b24040ee0d88bb325a4ff37e07c1192b8f75
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date: Mon Apr 29 18:28:04 2013 +0200
bluetooth: BlueZ 5 interface rename to org.bluez.MediaTransport1
Use the new interface name if BlueZ 5 has been detected.
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index ff83f53..fb8f753 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1306,6 +1306,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;
@@ -1315,6 +1316,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
@@ -1331,7 +1334,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);
@@ -1342,7 +1345,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 parse the media transport Acquire() reply: %s", err.message);
ret = -1;
dbus_error_free(&err);
goto fail;
@@ -1361,6 +1364,7 @@ fail:
void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
const char *accesstype = "rw";
+ const char *interface;
DBusMessage *m;
DBusError err;
@@ -1368,9 +1372,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);
commit 3266409f41f5fa539600894f81bbed4a07320803
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date: Mon Apr 29 18:28:03 2013 +0200
bluetooth: BlueZ 5 interface rename to org.bluez.Media1
Use the new interface name if BlueZ 5 has been detected.
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 5d5c7ab..ff83f53 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -834,8 +834,7 @@ static void register_endpoint_reply(DBusPendingCall *pending, void *userdata) {
}
if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) {
- pa_log("org.bluez.Media.RegisterEndpoint() failed: %s: %s", dbus_message_get_error_name(r),
- pa_dbus_get_error_message(r));
+ pa_log("RegisterEndpoint() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r));
goto finish;
}
@@ -852,10 +851,11 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const
DBusMessage *m;
DBusMessageIter i, d;
uint8_t codec = 0;
+ const char *interface = y->version == BLUEZ_VERSION_4 ? "org.bluez.Media" : "org.bluez.Media1";
pa_log_debug("Registering %s on adapter %s.", endpoint, path);
- pa_assert_se(m = dbus_message_new_method_call("org.bluez", path, "org.bluez.Media", "RegisterEndpoint"));
+ pa_assert_se(m = dbus_message_new_method_call("org.bluez", path, interface, "RegisterEndpoint"));
dbus_message_iter_init_append(m, &i);
commit 80b32601ee383e353c8f6b15291edff633541b8a
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date: Mon Apr 29 18:28:02 2013 +0200
bluetooth: BlueZ 5 interface rename to org.bluez.MediaEndpoint1
Use the new interface name if BlueZ 5 has been detected.
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 8b9c1ba..5d5c7ab 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -61,6 +61,30 @@
" </interface>" \
"</node>"
+#define MEDIA_ENDPOINT_1_INTROSPECT_XML \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "<node>" \
+ " <interface name=\"org.bluez.MediaEndpoint1\">" \
+ " <method name=\"SetConfiguration\">" \
+ " <arg name=\"transport\" direction=\"in\" type=\"o\"/>" \
+ " <arg name=\"configuration\" direction=\"in\" type=\"ay\"/>" \
+ " </method>" \
+ " <method name=\"SelectConfiguration\">" \
+ " <arg name=\"capabilities\" direction=\"in\" type=\"ay\"/>" \
+ " <arg name=\"configuration\" direction=\"out\" type=\"ay\"/>" \
+ " </method>" \
+ " <method name=\"ClearConfiguration\">" \
+ " </method>" \
+ " <method name=\"Release\">" \
+ " </method>" \
+ " </interface>" \
+ " <interface name=\"org.freedesktop.DBus.Introspectable\">" \
+ " <method name=\"Introspect\">" \
+ " <arg name=\"data\" type=\"s\" direction=\"out\"/>" \
+ " </method>" \
+ " </interface>" \
+ "</node>"
+
typedef enum pa_bluez_version {
BLUEZ_VERSION_UNKNOWN,
BLUEZ_VERSION_4,
@@ -1453,7 +1477,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
dbus_message_iter_get_basic(&args, &path);
if (pa_hashmap_get(y->transports, path)) {
- pa_log("org.bluez.MediaEndpoint.SetConfiguration: Transport %s is already configured.", path);
+ pa_log("Endpoint SetConfiguration: Transport %s is already configured.", path);
goto fail2;
}
@@ -1547,11 +1571,10 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
return NULL;
fail:
- pa_log("org.bluez.MediaEndpoint.SetConfiguration: invalid arguments");
+ pa_log("Endpoint SetConfiguration: invalid arguments");
fail2:
- pa_assert_se(r = dbus_message_new_error(m, "org.bluez.MediaEndpoint.Error.InvalidArguments",
- "Unable to set configuration"));
+ pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to set configuration"));
return r;
}
@@ -1565,7 +1588,7 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
dbus_error_init(&e);
if (!dbus_message_get_args(m, &e, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
- pa_log("org.bluez.MediaEndpoint.ClearConfiguration: %s", e.message);
+ pa_log("Endpoint ClearConfiguration: %s", e.message);
dbus_error_free(&e);
goto fail;
}
@@ -1590,8 +1613,7 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
return r;
fail:
- pa_assert_se(r = dbus_message_new_error(m, "org.bluez.MediaEndpoint.Error.InvalidArguments",
- "Unable to clear configuration"));
+ pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to clear configuration"));
return r;
}
@@ -1661,7 +1683,7 @@ static DBusMessage *endpoint_select_configuration(DBusConnection *c, DBusMessage
dbus_error_init(&e);
if (!dbus_message_get_args(m, &e, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &cap, &size, DBUS_TYPE_INVALID)) {
- pa_log("org.bluez.MediaEndpoint.SelectConfiguration: %s", e.message);
+ pa_log("Endpoint SelectConfiguration: %s", e.message);
dbus_error_free(&e);
goto fail;
}
@@ -1758,8 +1780,7 @@ done:
return r;
fail:
- pa_assert_se(r = dbus_message_new_error(m, "org.bluez.MediaEndpoint.Error.InvalidArguments",
- "Unable to select configuration"));
+ pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to select configuration"));
return r;
}
@@ -1783,17 +1804,19 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
!pa_streq(path, HFP_HS_ENDPOINT))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ interface = y->version == BLUEZ_VERSION_4 ? "org.bluez.MediaEndpoint" : "org.bluez.MediaEndpoint1";
+
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
- const char *xml = ENDPOINT_INTROSPECT_XML;
+ const char *xml = y->version == BLUEZ_VERSION_4 ? ENDPOINT_INTROSPECT_XML : MEDIA_ENDPOINT_1_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
- } else if (dbus_message_is_method_call(m, "org.bluez.MediaEndpoint", "SetConfiguration"))
+ } else if (dbus_message_is_method_call(m, interface, "SetConfiguration"))
r = endpoint_set_configuration(c, m, userdata);
- else if (dbus_message_is_method_call(m, "org.bluez.MediaEndpoint", "SelectConfiguration"))
+ else if (dbus_message_is_method_call(m, interface, "SelectConfiguration"))
r = endpoint_select_configuration(c, m, userdata);
- else if (dbus_message_is_method_call(m, "org.bluez.MediaEndpoint", "ClearConfiguration"))
+ else if (dbus_message_is_method_call(m, interface, "ClearConfiguration"))
r = endpoint_clear_configuration(c, m, userdata);
else
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
More information about the pulseaudio-commits
mailing list