linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] device: Fix not removing when connected
@ 2022-06-22 19:00 Luiz Augusto von Dentz
  2022-06-22 20:20 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-22 19:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

RemoveDevice causes the device to disconnect when connected but that
would result in calling set_temporary_timer with 0 timeout which would
only clear the timer but it doesn't program a timeout so
device_disappeared is never called, so instead of using temporary
timeout to cleanup this passes a variable which is set when to indicate
that the device shall be removed.
---
 src/adapter.c | 9 ++++++++-
 src/device.c  | 7 ++++---
 src/device.h  | 3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index afefa1d5d..43884cf15 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;
+
 	DBG("");
 
 	if (!g_slist_find(adapter->connections, device)) {
@@ -7178,7 +7180,12 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
 		return;
 	}
 
-	device_remove_connection(device, bdaddr_type);
+	device_remove_connection(device, bdaddr_type, &remove);
+
+	if (remove) {
+		btd_adapter_remove_device(adapter, device);
+		return;
+	}
 
 	if (device_is_authenticating(device))
 		device_cancel_authentication(device, TRUE);
diff --git a/src/device.c b/src/device.c
index 7b451e458..24b49ed79 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3073,7 +3073,8 @@ static void set_temporary_timer(struct btd_device *dev, unsigned int timeout)
 								dev, NULL);
 }
 
-void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type,
+								bool *remove)
 {
 	struct bearer_state *state = get_state(device, bdaddr_type);
 	DBusMessage *reply;
@@ -3158,8 +3159,8 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 	g_dbus_emit_property_changed(dbus_conn, device->path,
 						DEVICE_INTERFACE, "Connected");
 
-	if (remove_device)
-		set_temporary_timer(device, 0);
+	if (remove_device && remove)
+		*remove = true;
 }
 
 guint device_add_disconnect_watch(struct btd_device *device,
diff --git a/src/device.h b/src/device.h
index 960255d2b..d7f886224 100644
--- a/src/device.h
+++ b/src/device.h
@@ -123,7 +123,8 @@ int device_notify_pincode(struct btd_device *device, gboolean secure,
 void device_cancel_authentication(struct btd_device *device, gboolean aborted);
 gboolean device_is_authenticating(struct btd_device *device);
 void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type);
-void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type);
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type,
+								bool *remove);
 void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
 bool device_is_disconnecting(struct btd_device *device);
 void device_set_ltk_enc_size(struct btd_device *device, uint8_t enc_size);
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [BlueZ] device: Fix not removing when connected
  2022-06-22 19:00 [PATCH BlueZ] device: Fix not removing when connected Luiz Augusto von Dentz
@ 2022-06-22 20:20 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-06-22 20:20 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=652912

---Test result---

Test Summary:
CheckPatch                    PASS      1.43 seconds
GitLint                       PASS      0.96 seconds
Prep - Setup ELL              PASS      40.94 seconds
Build - Prep                  PASS      0.65 seconds
Build - Configure             PASS      7.93 seconds
Build - Make                  PASS      1344.46 seconds
Make Check                    PASS      11.39 seconds
Make Check w/Valgrind         PASS      447.75 seconds
Make Distcheck                PASS      228.15 seconds
Build w/ext ELL - Configure   PASS      8.11 seconds
Build w/ext ELL - Make        PASS      1344.12 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-22 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 19:00 [PATCH BlueZ] device: Fix not removing when connected Luiz Augusto von Dentz
2022-06-22 20:20 ` [BlueZ] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).