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.
This commit is contained in:
Pauli Virtanen 2021-02-10 22:34:32 +02:00
parent 6b11bf71f3
commit b6108df6f3

View file

@ -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)