Linux-Bluetooth Archive on lore.kernel.org
 help / color / 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	[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, back to index

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

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git