summaryrefslogtreecommitdiff
path: root/src/adapter.c
diff options
context:
space:
mode:
authorYouwan Wang <wangyouwan@uniontech.com>2022-06-23 14:29:53 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-06-23 16:25:54 -0700
commit65f7faf5a3d0dcd63c14467a3a2bda317287e330 (patch)
treecab31a49adbe319ef7c978f8aab96837c71dc894 /src/adapter.c
parente3c92f1f786f0b55440bd908b55894d0c792cf0e (diff)
downloadbluez-65f7faf5a3d0dcd63c14467a3a2bda317287e330.tar.gz
device: Fix not removing connected device
[bluetooth]# connect 40:EF:4C:0C:11:F0 Attempting to connect to 40:EF:4C:0C:11:F0 [CHG] Device 40:EF:4C:0C:11:F0 Connected: yes Connection successful [CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: yes [UFO]# remove 40:EF:4C:0C:11:F0 [CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: no Device has been removed [CHG] Device 40:EF:4C:0C:11:F0 Connected: no [bluetooth]# info 40:EF:4C:0C:11:F0 Device 40:EF:4C:0C:11:F0 (public) Name: UFO Alias: UFO Class: 0x00240418 Icon: audio-headphones Paired: yes Trusted: no Blocked: no Connected: no LegacyPairing: no UUID: Headset UUID: Audio Sink UUID: A/V Remote Control Target UUID: A/V Remote Control UUID: Handsfree UUID: Phonebook Access Server
Diffstat (limited to 'src/adapter.c')
-rw-r--r--src/adapter.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/adapter.c b/src/adapter.c
index afefa1d5d..16da20034 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7171,6 +7171,8 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
struct btd_device *device,
uint8_t bdaddr_type)
{
+ bool remove_device = false;
+
DBG("");
if (!g_slist_find(adapter->connections, device)) {
@@ -7178,7 +7180,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
return;
}
- device_remove_connection(device, bdaddr_type);
+ device_remove_connection(device, bdaddr_type, &remove_device);
if (device_is_authenticating(device))
device_cancel_authentication(device, TRUE);
@@ -7188,6 +7190,13 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
return;
adapter->connections = g_slist_remove(adapter->connections, device);
+
+ if (remove_device) {
+ const char *path = device_get_path(device);
+
+ DBG("Removing temporary device %s", path);
+ btd_adapter_remove_device(adapter, device);
+ }
}
static void adapter_stop(struct btd_adapter *adapter)