diff options
author | Georg Chini <georg@chini.tk> | 2017-03-14 07:32:31 +0100 |
---|---|---|
committer | Georg Chini <georg@chini.tk> | 2017-03-14 07:32:31 +0100 |
commit | e26a6752631d4db11b57a420b51abe36c1ef16f5 (patch) | |
tree | 058b8117ac3182d30ae632b0b036479d98676af6 | |
parent | adc2e8cd0acc7e49aa1c32fa78a3ad27f457ffd7 (diff) | |
download | pulseaudio-e26a6752631d4db11b57a420b51abe36c1ef16f5.tar.gz |
bluez5-util: Disconnect AG devices when ofono is started and headset=auto
With headset=auto it is possible that AG devices are connected and handled
via the native backend when ofono is started. Because the HS role will then
be disabled in the native backend, AG devices must be disconnected and any
future connections will be handled by ofono.
-rw-r--r-- | src/modules/bluetooth/bluez5-util.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index 8d59b6bb4..107255184 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -982,6 +982,24 @@ void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is if (y->headset_backend != HEADSET_BACKEND_AUTO) return; + /* If ofono starts running, all devices that might be connected to the HS role + * need to be disconnected, so that the devices can be handled by ofono */ + if (is_running) { + void *state; + pa_bluetooth_device *d; + + PA_HASHMAP_FOREACH(d, y->devices, state) { + if (device_supports_profile(d, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY)) { + DBusMessage *m; + + pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, d->path, "org.bluez.Device1", "Disconnect")); + dbus_message_set_no_reply(m, true); + dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL); + dbus_message_unref(m); + } + } + } + pa_bluetooth_native_backend_enable_hs_role(y->native_backend, !is_running); } |