From b6108df6f3060a50e84942e21d64bda273609bdf Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Wed, 10 Feb 2021 22:34:32 +0200 Subject: [PATCH] bluez5: remove device on disconnect Do device_remove when device disconnects. This can occur, as profile check is not run on HFP/HSP profile disconnect. --- spa/plugins/bluez5/bluez5-dbus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index e1052b449..de9981608 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -612,6 +612,8 @@ int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force) static void device_set_connected(struct spa_bt_device *device, int connected) { + struct spa_bt_monitor *monitor = device->monitor; + if (device->connected && !connected) device->connected_profiles = 0; @@ -619,8 +621,11 @@ static void device_set_connected(struct spa_bt_device *device, int connected) if (connected) spa_bt_device_check_profiles(device, false); - else + else { device_stop_timer(device); + if (device->added) + device_remove(monitor, device); + } } int spa_bt_device_connect_profile(struct spa_bt_device *device, enum spa_bt_profile profile)