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

Mikel Astiz mikel.astiz.oss at gmail.com
Thu Apr 18 00:23:20 PDT 2013


Hi João,

On Wed, Apr 17, 2013 at 7:02 PM, João Paulo Rechi Vita
<jprvita at gmail.com> wrote:
> On Tue, Apr 16, 2013 at 10:40 AM, Mikel Astiz <mikel.astiz.oss at gmail.com> wrote:
>> 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.
>
> There is no HSP implementation in BlueZ 5 and for HFP these interfaces
> will be exposed in the oFono API, so this code will never be used. IMO
> we shouldn't merge this patch util these properties are actually used
> by someone.

I already mentioned this in the cover-letter and basically I agree
with your proposal.

Cheers,
Mikel

>
>> ---
>>  src/modules/bluetooth/bluetooth-util.c | 41 ++++++++++++++++++++++++++++++++++
>>  1 file changed, 41 insertions(+)
>>
>> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
>> index 7589c22..de4dbce 100644
>> --- a/src/modules/bluetooth/bluetooth-util.c
>> +++ b/src/modules/bluetooth/bluetooth-util.c
>> @@ -1154,6 +1154,32 @@ static int transport_parse_property(pa_bluetooth_transport *t, DBusMessageIter *
>>
>>              break;
>>          }
>> +
>> +        case DBUS_TYPE_BYTE: {
>> +            uint8_t value;
>> +
>> +            dbus_message_iter_get_basic(&variant_i, &value);
>> +
>> +            if (pa_streq(key, "MicrophoneGain")) {
>> +                uint8_t gain;
>> +
>> +                if ((gain = PA_MIN(value, HSP_MAX_GAIN)) == t->microphone_gain)
>> +                    break;
>> +
>> +                t->microphone_gain = gain;
>> +                pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED], t);
>> +            } else if (pa_streq(key, "SpeakerGain")) {
>> +                uint8_t gain;
>> +
>> +                if ((gain = PA_MIN(value, HSP_MAX_GAIN)) == t->speaker_gain)
>> +                    break;
>> +
>> +                t->speaker_gain = gain;
>> +                pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED], t);
>> +            }
>> +
>> +            break;
>> +        }
>>      }
>>
>>      return 0;
>> @@ -1617,6 +1643,14 @@ 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) {
>> +        uint8_t g = (uint8_t) gain;
>> +
>> +        set_property(t->device->discovery, t->owner, t->path, "org.bluez.MediaTransport1",
>> +                     "MicrophoneGain", DBUS_TYPE_BYTE, &g);
>> +        return;
>> +    }
>> +
>>      set_property(t->device->discovery, "org.bluez", t->device->path, "org.bluez.Headset",
>>                   "MicrophoneGain", DBUS_TYPE_UINT16, &gain);
>>  }
>> @@ -1627,6 +1661,13 @@ 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) {
>> +        uint8_t g = (uint8_t) gain;
>> +
>> +        set_property(t->device->discovery, t->owner, t->path, "org.bluez.MediaTransport1", "SpeakerGain", DBUS_TYPE_BYTE, &g);
>> +        return;
>> +    }
>> +
>>      set_property(t->device->discovery, "org.bluez", t->device->path, "org.bluez.Headset",
>>                   "SpeakerGain", DBUS_TYPE_UINT16, &gain);
>>  }
>> --
>> 1.8.1.4
>>
>> _______________________________________________
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
>
>
> --
> João Paulo Rechi Vita
> http://about.me/jprvita
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list