All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] device: Fix not removing connected device
@ 2022-06-23  6:29 Youwan Wang
  2022-06-23  8:08 ` bluez.test.bot
  2022-06-23 23:30 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 5+ messages in thread
From: Youwan Wang @ 2022-06-23  6:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Youwan Wang

[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
---
 src/adapter.c | 11 ++++++++++-
 src/device.c  |  5 +++--
 src/device.h  |  3 ++-
 3 files changed, 15 insertions(+), 4 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)
diff --git a/src/device.c b/src/device.c
index 7b451e458..c5484ca7b 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;
@@ -3159,7 +3160,7 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 						DEVICE_INTERFACE, "Connected");
 
 	if (remove_device)
-		set_temporary_timer(device, 0);
+		*remove = remove_device;
 }
 
 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.20.1




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

* RE: device: Fix not removing connected device
  2022-06-23  6:29 [PATCH] device: Fix not removing connected device Youwan Wang
@ 2022-06-23  8:08 ` bluez.test.bot
  2022-06-23 23:30 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-06-23  8:08 UTC (permalink / raw)
  To: linux-bluetooth, wangyouwan

[-- Attachment #1: Type: text/plain, Size: 997 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=653038

---Test result---

Test Summary:
CheckPatch                    PASS      1.13 seconds
GitLint                       PASS      0.75 seconds
Prep - Setup ELL              PASS      51.93 seconds
Build - Prep                  PASS      0.83 seconds
Build - Configure             PASS      10.19 seconds
Build - Make                  PASS      1774.49 seconds
Make Check                    PASS      12.25 seconds
Make Check w/Valgrind         PASS      528.82 seconds
Make Distcheck                PASS      281.37 seconds
Build w/ext ELL - Configure   PASS      10.19 seconds
Build w/ext ELL - Make        PASS      1750.64 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH] device: Fix not removing connected device
  2022-06-23  6:29 [PATCH] device: Fix not removing connected device Youwan Wang
  2022-06-23  8:08 ` bluez.test.bot
@ 2022-06-23 23:30 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-06-23 23:30 UTC (permalink / raw)
  To: Youwan Wang; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 23 Jun 2022 14:29:53 +0800 you wrote:
> [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
> 
> [...]

Here is the summary with links:
  - device: Fix not removing connected device
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=65f7faf5a3d0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* [PATCH] device: Fix not removing connected device
@ 2022-06-23  3:13 Youwan Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Youwan Wang @ 2022-06-23  3:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Youwan Wang

[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
---
 src/adapter.c | 11 ++++++++++-
 src/device.c  |  4 ++--
 src/device.h  |  3 ++-
 3 files changed, 14 insertions(+), 4 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)
diff --git a/src/device.c b/src/device.c
index 7b451e458..24d88929e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3073,7 +3073,7 @@ 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;
@@ -3159,7 +3159,7 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 						DEVICE_INTERFACE, "Connected");
 
 	if (remove_device)
-		set_temporary_timer(device, 0);
+		*remove = remove_device;
 }
 
 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.20.1




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

* [PATCH] device: Fix not removing connected device
@ 2022-06-23  1:44 Youwan Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Youwan Wang @ 2022-06-23  1:44 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Youwan Wang

[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
---
 src/adapter.c | 11 ++++++++++-
 src/device.c  |  4 ++--
 src/device.h  |  2 +-
 3 files changed, 13 insertions(+), 4 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)
diff --git a/src/device.c b/src/device.c
index 7b451e458..24d88929e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3073,7 +3073,7 @@ 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;
@@ -3159,7 +3159,7 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 						DEVICE_INTERFACE, "Connected");
 
 	if (remove_device)
-		set_temporary_timer(device, 0);
+		*remove = remove_device;
 }
 
 guint device_add_disconnect_watch(struct btd_device *device,
diff --git a/src/device.h b/src/device.h
index 960255d2b..fdf18d8e6 100644
--- a/src/device.h
+++ b/src/device.h
@@ -123,7 +123,7 @@ 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.20.1




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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23  6:29 [PATCH] device: Fix not removing connected device Youwan Wang
2022-06-23  8:08 ` bluez.test.bot
2022-06-23 23:30 ` [PATCH] " patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2022-06-23  3:13 Youwan Wang
2022-06-23  1:44 Youwan Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.