Skip to content

Commit

Permalink
sfos: bluez5: Add possibility to distinguish droid use cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
jusa committed Mar 21, 2019
1 parent fde7f9a commit 87eeea2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/modules/bluetooth/bluez5-util.c
Expand Up @@ -92,8 +92,15 @@ struct pa_bluetooth_discovery {
int headset_backend;
pa_bluetooth_backend *ofono_backend, *native_backend;
PA_LLIST_HEAD(pa_dbus_pending, pending);

bool droid_backend;
};

bool pa_bluetooth_droid_backend(pa_bluetooth_discovery *y) {
pa_assert(y);
return y->droid_backend;
}

static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m,
DBusPendingCallNotifyFunction func, void *call_data) {
pa_dbus_pending *p;
Expand Down Expand Up @@ -1752,7 +1759,11 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c, int headset_backe
y = pa_xnew0(pa_bluetooth_discovery, 1);
PA_REFCNT_INIT(y);
y->core = c;
y->headset_backend = headset_backend;
if (headset_backend == HEADSET_BACKEND_DROID) {
y->headset_backend = HEADSET_BACKEND_AUTO;
y->droid_backend = true;
} else
y->headset_backend = headset_backend;
y->adapters = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
(pa_free_cb_t) adapter_free);
y->devices = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
Expand Down
3 changes: 3 additions & 0 deletions src/modules/bluetooth/bluez5-util.h
Expand Up @@ -147,6 +147,8 @@ static inline void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b) {}
static inline void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *b, bool enable_hs_role) {}
#endif

bool pa_bluetooth_droid_backend(pa_bluetooth_discovery *y);

pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,
pa_bluetooth_profile_t p, const uint8_t *config, size_t size);

Expand All @@ -171,6 +173,7 @@ static inline bool pa_bluetooth_uuid_is_hsp_hs(const char *uuid) {
#define HEADSET_BACKEND_OFONO 0
#define HEADSET_BACKEND_NATIVE 1
#define HEADSET_BACKEND_AUTO 2
#define HEADSET_BACKEND_DROID 3

pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core, int headset_backend);
pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
Expand Down
2 changes: 2 additions & 0 deletions src/modules/bluetooth/module-bluez5-discover.c
Expand Up @@ -117,6 +117,8 @@ int pa__init(pa_module *m) {
headset_backend = HEADSET_BACKEND_NATIVE;
else if (pa_streq(headset_str, "auto"))
headset_backend = HEADSET_BACKEND_AUTO;
else if (pa_streq(headset_str, "droid"))
headset_backend = HEADSET_BACKEND_DROID;
else {
pa_log("headset parameter must be either ofono, native or auto (found %s)", headset_str);
goto fail;
Expand Down

0 comments on commit 87eeea2

Please sign in to comment.