bluetooth: use native and ofono backends in parallel with headset=auto

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.
This commit is contained in:
Georg Chini 2017-03-11 19:02:16 +01:00
parent d065e4d114
commit adc2e8cd0a
3 changed files with 27 additions and 13 deletions

View file

@ -982,12 +982,7 @@ void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is
if (y->headset_backend != HEADSET_BACKEND_AUTO)
return;
if (is_running && y->native_backend) {
pa_bluetooth_native_backend_free(y->native_backend);
y->native_backend = NULL;
}
else if (!is_running && !y->native_backend)
y->native_backend = pa_bluetooth_native_backend_new(y->core, y);
pa_bluetooth_native_backend_enable_hs_role(y->native_backend, !is_running);
}
static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata) {
@ -1028,10 +1023,10 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata)
y->objects_listed = true;
if (!y->native_backend && y->headset_backend != HEADSET_BACKEND_OFONO)
y->native_backend = pa_bluetooth_native_backend_new(y->core, y, (y->headset_backend == HEADSET_BACKEND_NATIVE));
if (!y->ofono_backend && y->headset_backend != HEADSET_BACKEND_NATIVE)
y->ofono_backend = pa_bluetooth_ofono_backend_new(y->core, y);
if (!y->ofono_backend && !y->native_backend && y->headset_backend != HEADSET_BACKEND_OFONO)
y->native_backend = pa_bluetooth_native_backend_new(y->core, y);
finish:
dbus_message_unref(r);