Re: [PATCH BlueZ] core/gatt: Add KeepCache config option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> writes:

> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> This adds [GATT] KeepCache config option to main.conf which can be used
> to adjust the cache behavior of attributes found over GATT.
> ---
>  src/device.c  | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/main.c    |  2 +-
>  src/main.conf |  6 ++++++
>  3 files changed, 53 insertions(+), 1 deletion(-)
>
> diff --git a/src/device.c b/src/device.c
> index 50e7f23..dfb7b1f 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -261,6 +261,8 @@ static const uint16_t uuid_list[] = {
>  	0
>  };
>
> +static char *gatt_cache;

There's already a main_opts (defined in hcid.h, brings back memories :-)
for this kind of thing. Is there a reason you didn't use it?

> +
>  static int device_browse_gatt(struct btd_device *device, DBusMessage *msg);
>  static int device_browse_sdp(struct btd_device *device, DBusMessage *msg);
>
> @@ -522,11 +524,32 @@ static void browse_request_free(struct browse_req *req)
>  	g_free(req);
>  }
>

[...]

> @@ -6121,9 +6150,26 @@ struct btd_service *btd_device_get_service(struct btd_device *dev,
>
>  void btd_device_init(void)
>  {
> +	GKeyFile *conf;
> +	GError *err = NULL;
> +
>  	dbus_conn = btd_get_dbus_connection();
>  	service_state_cb_id = btd_service_add_state_cb(
>  						service_state_changed, NULL);
> +
> +	conf = btd_get_main_conf();
> +	if (!conf) {
> +		gatt_cache = g_strdup("always");
> +		return;
> +	}
> +
> +	gatt_cache = g_key_file_get_string(conf, "GATT", "KeepCache", &err);
> +	if (!err)
> +		return;
> +
> +	DBG("%s", err->message);
> +	g_clear_error(&err);
> +	gatt_cache = g_strdup("always");

Overwriting the value looks wrong.

>  }
>


Cheers,
--
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux