[pulseaudio-discuss] [RFC v0 15/15] bluetooth: Update to volume control in BlueZ 5

Mikel Astiz mikel.astiz.oss at gmail.com
Wed Dec 19 04:58:34 PST 2012


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

In BlueZ 5, the microphone and speaker gains are exposed as properties
of the MediaTransport1 interface.
---
 src/modules/bluetooth/bluetooth-util.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 16aee20..8c96cc1 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1578,6 +1578,12 @@ void pa_bluetooth_transport_set_microphone_gain(pa_bluetooth_transport *t, uint1
     pa_assert(t);
     pa_assert(t->profile == PROFILE_HSP);
 
+    if (t->device->discovery->version >= BLUEZ_VERSION_5) {
+        set_property(t->device->discovery, t->owner, t->path, "org.bluez.MediaTransport1",
+                     "MicrophoneGain", DBUS_TYPE_UINT16, &gain);
+        return;
+    }
+
     set_property(t->device->discovery, "org.bluez", t->device->path, "org.bluez.Headset",
                  "MicrophoneGain", DBUS_TYPE_UINT16, &gain);
 }
@@ -1588,6 +1594,12 @@ void pa_bluetooth_transport_set_speaker_gain(pa_bluetooth_transport *t, uint16_t
     pa_assert(t);
     pa_assert(t->profile == PROFILE_HSP);
 
+    if (t->device->discovery->version >= BLUEZ_VERSION_5) {
+        set_property(t->device->discovery, t->owner, t->path, "org.bluez.MediaTransport1",
+                     "SpeakerGain", DBUS_TYPE_UINT16, &gain);
+        return;
+    }
+
     set_property(t->device->discovery, "org.bluez", t->device->path, "org.bluez.Headset",
                  "SpeakerGain", DBUS_TYPE_UINT16, &gain);
 }
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list