[pulseaudio-discuss] [PATCH 2/3] bluetooth: use native and ofono backends in parallel with headset=auto

Tanu Kaskinen tanuk at iki.fi
Thu Mar 9 23:33:19 UTC 2017


On Thu, 2017-03-02 at 17:04 +0100, Georg Chini wrote:
> This patch changes the behavior of the headset=auto switch for module-bluez5-discover.
> With headset=auto now both backends will be active at the same time for the AG role and
> the switching between the backends is only done for the HS role.
> headset=ofono and headset=native remain unchanged.
> 
> This allows to use old HSP only headsets while running ofono and to have headset support
> via pulseaudio if ofono is started with the --noplugin=hfp_ag_bluez5 option.

Not really related to the patch, I'm just curious: Does hfp_ag_bluez5
make ofono act in the AG role? Is the plugin loaded by default? Does
that work nowadays? Or is it still work in progress? My understanding
has been that ofono only supports the HF role.

> ---
>  src/modules/bluetooth/backend-native.c | 24 +++++++++++++++++++++---
>  src/modules/bluetooth/bluez5-util.c    | 10 +++-------
>  src/modules/bluetooth/bluez5-util.h    |  4 ++--
>  3 files changed, 26 insertions(+), 12 deletions(-)
> 
> diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c
> index 71f1773..7573b89 100644
> --- a/src/modules/bluetooth/backend-native.c
> +++ b/src/modules/bluetooth/backend-native.c
> @@ -40,6 +40,7 @@ struct pa_bluetooth_backend {
>    pa_core *core;
>    pa_dbus_connection *connection;
>    pa_bluetooth_discovery *discovery;
> +  bool enable_hs_role;
>  
>    PA_LLIST_HEAD(pa_dbus_pending, pending);
>  };
> @@ -653,10 +654,24 @@ static void profile_done(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile
>      }
>  }
>  
> -pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y) {
> +pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, pa_bluetooth_backend *native_backend, bool enable_hs_role) {
>      pa_bluetooth_backend *backend;
>      DBusError err;
>  
> +    /* If the backend already exists just switch the HS role on or off */

I find this interface weird. If the goal is just to switch the HS role
on or off, I think it would be better to have function
pa_bluetooth_native_backend_enable_hs_role().

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list