linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Don't remove temporary devices on disconnect
@ 2020-07-18  0:49 Luiz Augusto von Dentz
  2020-07-23 16:38 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2020-07-18  0:49 UTC (permalink / raw)
  To: linux-bluetooth

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

This makes the disconnect logic just update last seen field of the
device so in case it is temporary it would trigger its timer and be
removed after the timeout which is consistent with the discovery
session givin a grace time for application to react to such events.
---
 src/adapter.c | 7 -------
 src/device.c  | 2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index c757447e2..5e896a9f0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -6837,13 +6837,6 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
 		return;
 
 	adapter->connections = g_slist_remove(adapter->connections, device);
-
-	if (device_is_temporary(device) && !device_is_retrying(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 470596ee4..2237a7670 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3039,6 +3039,8 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 	if (device->bredr_state.connected || device->le_state.connected)
 		return;
 
+	device_update_last_seen(device, bdaddr_type);
+
 	g_dbus_emit_property_changed(dbus_conn, device->path,
 						DEVICE_INTERFACE, "Connected");
 }
-- 
2.26.2


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

* Re: [PATCH BlueZ] adapter: Don't remove temporary devices on disconnect
  2020-07-18  0:49 [PATCH BlueZ] adapter: Don't remove temporary devices on disconnect Luiz Augusto von Dentz
@ 2020-07-23 16:38 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2020-07-23 16:38 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Fri, Jul 17, 2020 at 5:50 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This makes the disconnect logic just update last seen field of the
> device so in case it is temporary it would trigger its timer and be
> removed after the timeout which is consistent with the discovery
> session givin a grace time for application to react to such events.
> ---
>  src/adapter.c | 7 -------
>  src/device.c  | 2 ++
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index c757447e2..5e896a9f0 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -6837,13 +6837,6 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
>                 return;
>
>         adapter->connections = g_slist_remove(adapter->connections, device);
> -
> -       if (device_is_temporary(device) && !device_is_retrying(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 470596ee4..2237a7670 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -3039,6 +3039,8 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
>         if (device->bredr_state.connected || device->le_state.connected)
>                 return;
>
> +       device_update_last_seen(device, bdaddr_type);
> +
>         g_dbus_emit_property_changed(dbus_conn, device->path,
>                                                 DEVICE_INTERFACE, "Connected");
>  }
> --
> 2.26.2

Applied.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2020-07-23 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-18  0:49 [PATCH BlueZ] adapter: Don't remove temporary devices on disconnect Luiz Augusto von Dentz
2020-07-23 16:38 ` Luiz Augusto von Dentz

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