[PATCH] bluetooth: set availability for the ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2012-06-17 at 14:52 +0200, poljar (Damir Jelic) wrote:
> From: poljar <poljarinho at gmail.com>
> 
> The ports on the bluetooth device should be always available since
> there is only one port per profile for both directions.

The availability of a port doesn't depend on how many ports there are
per profile. Even when there is only one port, it may be unavailable.

Ports should be marked as available when we know that they are in a
"useful" state. When we know that they are not useful, they should be
marked as unavailable. When we don't know either way, they should be
marked as unknown. For bluetooth, I guess it's ok to mark everything
except A2DP_SOURCE as available.

> ---
>  src/modules/bluetooth/module-bluetooth-device.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index d62cf06..a7b8cb6 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -2767,6 +2767,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_
>              port->is_output = 1;
>              port->is_input = 0;
>              port->priority = profile->priority * 100;
> +            pa_device_port_set_available(port, PA_PORT_AVAILABLE_YES);

port->available should be set directly here, because
pa_device_port_set_available() will send notifications about the changed
state, which you don't want when the card is in the process of being
created.

>              pa_hashmap_put(port->profiles, profile->name, profile);
>              break;
>  
> @@ -2776,6 +2777,7 @@ static void create_ports_for_profile(struct userdata *u, pa_card_new_data *card_
>              port->is_output = 0;
>              port->is_input = 1;
>              port->priority = profile->priority * 100;
> +            pa_device_port_set_available(port, PA_PORT_AVAILABLE_YES);

I believe the port for A2DP_SOURCE should actually be marked as
unavailable whenever the device is not in the PLAYING state (a bluetooth
state, not pulseaudio state). Some discussion here:
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/13156/focus=13174

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux