[pulseaudio-discuss] [PATCH] bluetooth: Check if BlueZ tries to set the configuration twice for the same transport.

Tanu Kaskinen tanuk at iki.fi
Thu Dec 6 02:30:26 PST 2012


On Thu, 2012-12-06 at 06:51 +0200, Tanu Kaskinen wrote:
> ---
>  src/modules/bluetooth/bluetooth-util.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
> index 0daf1c9..39c5c5e 100644
> --- a/src/modules/bluetooth/bluetooth-util.c
> +++ b/src/modules/bluetooth/bluetooth-util.c
> @@ -1178,6 +1178,11 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
>      if (!d)
>          goto fail;
>  
> +    if (pa_hashmap_get(d->transports, path)) {
> +        pa_log("org.bluez.MediaEndpoint.SetConfiguration: Device %s already has transport %s.", d->path, path);
> +        goto fail;
> +    }
> +
>      if (dbus_message_has_path(m, HFP_AG_ENDPOINT))
>          p = PROFILE_HSP;
>      else if (dbus_message_has_path(m, HFP_HS_ENDPOINT))
> @@ -1192,7 +1197,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
>      t = transport_new(d, sender, path, p, config, size);
>      if (nrec)
>          t->nrec = nrec;
> -    pa_hashmap_put(d->transports, t->path, t);
> +    pa_assert_se(pa_hashmap_put(d->transports, t->path, t) >= 0);
>  
>      pa_log_debug("Transport %s profile %d available", t->path, t->profile);
>  

This is pretty trivial, so I decided to push this to my next branch
without review (there are some changes due to rebasing on the latest
patches from Mikel).

-- 
Tanu



More information about the pulseaudio-discuss mailing list