2021-08-24 22:54:38

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ] device: Remove GATT Attribute when device is removed

From: Luiz Augusto von Dentz <[email protected]>

This makes the GATT Attribute cache to be removed when device is removed
just like SDP ServiceRecords.

Fixes: https://github.com/bluez/bluez/issues/191
---
src/device.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/device.c b/src/device.c
index 807106812..998485be7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4511,6 +4511,7 @@ static void device_remove_stored(struct btd_device *device)
key_file = g_key_file_new();
g_key_file_load_from_file(key_file, filename, 0, NULL);
g_key_file_remove_group(key_file, "ServiceRecords", NULL);
+ g_key_file_remove_group(key_file, "Attributes", NULL);

data = g_key_file_to_data(key_file, &length, NULL);
if (length > 0) {
--
2.31.1


2021-08-25 17:47:44

by David Lechner

[permalink] [raw]
Subject: Re: [PATCH BlueZ] device: Remove GATT Attribute when device is removed

On 8/24/21 5:52 PM, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This makes the GATT Attribute cache to be removed when device is removed
> just like SDP ServiceRecords.
>
> Fixes: https://github.com/bluez/bluez/issues/191
> ---
Tested-by: David Lechner <[email protected]>

But wouldn't it be better to just delete the file altogether?
This would prevent any future sections from being forgotten to
be removed as well.

I sent an alternative patch that does this: "device: delete
cache file when device is removed"

2021-08-25 21:17:45

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ] device: Remove GATT Attribute when device is removed

Hi David,

On Wed, Aug 25, 2021 at 10:44 AM David Lechner <[email protected]> wrote:
>
> On 8/24/21 5:52 PM, Luiz Augusto von Dentz wrote:
> > From: Luiz Augusto von Dentz <[email protected]>
> >
> > This makes the GATT Attribute cache to be removed when device is removed
> > just like SDP ServiceRecords.
> >
> > Fixes: https://github.com/bluez/bluez/issues/191
> > ---
> Tested-by: David Lechner <[email protected]>
>
> But wouldn't it be better to just delete the file altogether?
> This would prevent any future sections from being forgotten to
> be removed as well.
>
> I sent an alternative patch that does this: "device: delete
> cache file when device is removed"

We do like to keep some details such as the name, etc.

--
Luiz Augusto von Dentz