All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ] core/gatt: Add KeepCache config option
Date: Fri, 02 Jun 2017 13:19:02 -0700	[thread overview]
Message-ID: <87shjip2h5.fsf@intel.com> (raw)
In-Reply-To: <20170531105640.3132-1-luiz.dentz@gmail.com>

Hi Luiz,

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

> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> 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

  parent reply	other threads:[~2017-06-02 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 10:56 [PATCH BlueZ] core/gatt: Add KeepCache config option Luiz Augusto von Dentz
2017-05-31 10:56 ` [PATCH BlueZ] core/gatt: Fix not registering .accept callback for external profiles Luiz Augusto von Dentz
2017-06-02 20:19 ` Vinicius Costa Gomes [this message]
2017-06-09 13:04   ` [PATCH BlueZ] core/gatt: Add KeepCache config option Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shjip2h5.fsf@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.