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 v3] core/gatt: Add GATT.Cache config option
Date: Tue, 13 Jun 2017 10:44:00 -0700 [thread overview]
Message-ID: <87h8zjg4v3.fsf@intel.com> (raw)
In-Reply-To: <20170609130258.23401-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.Cache config option to main.conf which can be used
> to adjust the cache expected behavior of attributes found over GATT.
> ---
> src/device.c | 28 ++++++++++++++++++++++++++++
> src/hcid.h | 7 +++++++
> src/main.c | 26 +++++++++++++++++++++++++-
> src/main.conf | 6 ++++++
> 4 files changed, 66 insertions(+), 1 deletion(-)
>
[...]
>
> +static void parse_gatt_cache(const char *cache)
> +{
> + if (!strcmp(cache, "always")) {
> + main_opts.gatt_cache = BT_GATT_CACHE_ALWAYS;
> + } else if (!strcmp(cache, "yes")) {
> + main_opts.gatt_cache = BT_GATT_CACHE_YES;
> + } else if (!strcmp(cache, "no")) {
> + main_opts.gatt_cache = BT_GATT_CACHE_NO;
> + } else {
> + DBG("Invalid value for KeepCache=%s", cache);
> + }
[optional] I wonder if making this return the enum, and return the
default if 'cache' is NULL, would make the code clearer.
> +}
> +
> static void check_config(GKeyFile *config)
> {
> - const char *valid_groups[] = { "General", "Policy", NULL };
> + const char *valid_groups[] = { "General", "Policy", "GATT", NULL };
> char **keys;
> int i;
>
> @@ -357,6 +370,17 @@ static void parse_config(GKeyFile *config)
> g_clear_error(&err);
> else
> main_opts.fast_conn = boolean;
> +
> + str = g_key_file_get_string(config, "GATT", "Cache", &err);
> + if (err) {
> + g_clear_error(&err);
> + main_opts.gatt_cache = BT_GATT_CACHE_ALWAYS;
> + return;
> + }
> +
> + parse_gatt_cache(str);
> +
> + g_free(str);
> }
>
> static void init_defaults(void)
> diff --git a/src/main.conf b/src/main.conf
> index a649276..7807a8f 100644
> --- a/src/main.conf
> +++ b/src/main.conf
> @@ -71,6 +71,12 @@
> # Defaults to "off"
> # Privacy = off
>
> +[GATT]
> +# GATT attribute cache.
> +# Possible values: always, yes, no
> +# Default: always
> +#Cache = always
> +
> [Policy]
> #
> # The ReconnectUUIDs defines the set of remote services that should try
> --
> 2.9.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers,
--
Vinicius
next prev parent reply other threads:[~2017-06-13 17:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 13:02 [PATCH v3] core/gatt: Add GATT.Cache config option Luiz Augusto von Dentz
2017-06-13 17:44 ` Vinicius Costa Gomes [this message]
2017-06-15 2:31 ` Miao-chen Chou
2017-06-17 19:40 ` Luiz Augusto von Dentz
2017-06-19 21:19 ` Miao-chen Chou
2017-06-21 19:44 ` Luiz Augusto von Dentz
-- strict thread matches above, loose matches on Subject: below --
2017-06-09 13:02 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=87h8zjg4v3.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox