bluez5: cleanup hfp/hsp backend handling + config file option

It seems not uncommon that people have not properly configured ofono
running, which results to loss of HFP/HSP functionality. It's less
surprising if the backend selection is fixed in the configuration file,
and (by default) does not depend on running services.

Add a configuration file option for selecting HFP/HSP backend, and set
the default value to the native backend. Emit warnings if conflicting
backend services are detected to be running.

Also cleanup hfp/hsp backend handling a bit, now that it's mostly
abstracted behind an interface.
This commit is contained in:
Pauli Virtanen 2021-08-29 18:22:41 +03:00 committed by Wim Taymans
parent cae1554449
commit 90b4efd98d
6 changed files with 236 additions and 109 deletions

View file

@ -696,14 +696,15 @@ struct spa_bt_backend_implementation {
int (*free) (void *data);
int (*register_profiles) (void *data);
int (*unregister_profiles) (void *data);
int (*unregistered) (void *data);
int (*add_filters) (void *data);
int (*ensure_codec) (void *data, struct spa_bt_device *device, unsigned int codec);
int (*supports_codec) (void *data, struct spa_bt_device *device, unsigned int codec);
};
struct spa_bt_backend {
struct spa_callbacks impl;
const char *name;
bool available;
bool exclusive;
};
#define spa_bt_backend_set_implementation(b,_impl,_data) \
@ -722,8 +723,6 @@ struct spa_bt_backend {
#define spa_bt_backend_free(b) spa_bt_backend_impl(b, free, 0)
#define spa_bt_backend_register_profiles(b) spa_bt_backend_impl(b, register_profiles, 0)
#define spa_bt_backend_unregister_profiles(b) spa_bt_backend_impl(b, unregister_profiles, 0)
#define spa_bt_backend_unregistered(b) spa_bt_backend_impl(b, unregistered, 0)
#define spa_bt_backend_add_filters(b) spa_bt_backend_impl(b, add_filters, 0)
#define spa_bt_backend_ensure_codec(b,...) spa_bt_backend_impl(b, ensure_codec, 0, __VA_ARGS__)
#define spa_bt_backend_supports_codec(b,...) spa_bt_backend_impl(b, supports_codec, 0, __VA_ARGS__)