linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v3 4/4] android/bluetooth: Enable LE privacy mode on BfA startup
Date: Tue, 16 Dec 2014 22:37:22 +0100	[thread overview]
Message-ID: <2944887.ToNmaQstia@athlon> (raw)
In-Reply-To: <1418238948-30800-5-git-send-email-lukasz.rymanowski@tieto.com>

Hi Łukasz,

On Wednesday 10 December 2014 20:15:48 Lukasz Rymanowski wrote:
> Lets follow Android Lollipop behaviour and enable privacy on
> startup.
> ---
>  android/bluetooth.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 4c359d0..54e3d97 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -3423,6 +3423,32 @@ static void clear_auto_connect_list(void)
>  	error("Could not clear auto connect list");
>  }
> 
> +static void set_privacy_complete(uint8_t status, uint16_t length,
> +					const void *param, void *user_data)
> +{
> +	if (status != MGMT_STATUS_SUCCESS)
> +		error("Failed to set privacy mode: %s (0x%02x)",
> +						mgmt_errstr(status), status);
> +}
> +
> +static void set_privacy(void)
> +{
> +	struct mgmt_cp_set_privacy cp;
> +
> +	if (!local_irk_is_valid())
> +		goto failed;
> +
> +	cp.privacy = 0x01;
> +	memcpy(cp.irk, adapter.irk, sizeof(adapter.irk));
> +
> +	if (mgmt_send(mgmt_if, MGMT_OP_SET_PRIVACY, adapter.index, sizeof(cp),
> +				&cp, set_privacy_complete, NULL, NULL) > 0)
> +		return;
> +
> +failed:
> +	error("Could not set privacy mode");
> +}
> +
>  static void read_info_complete(uint8_t status, uint16_t length,
>  					const void *param, void *user_data)
>  {
> @@ -3497,6 +3523,9 @@ static void read_info_complete(uint8_t status,
> uint16_t length, if (missing_settings & MGMT_SETTING_BONDABLE)
>  		set_mode(MGMT_OP_SET_BONDABLE, 0x01);
> 
> +	if (missing_settings & MGMT_SETTING_PRIVACY)
> +		set_privacy();
> +
>  	load_devices_info(cb);
>  	load_devices_cache();

Shouldn't we first configure a static random address?

-- 
Szymon K. Janc
szymon.janc@gmail.com

  reply	other threads:[~2014-12-16 21:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 19:15 [PATCH v3 0/4] android/bluetooth: Enable privacy mode on starup Lukasz Rymanowski
2014-12-10 19:15 ` [PATCH v3 1/4] android/bluetooth: Start keep IRK for adapter Lukasz Rymanowski
2014-12-16 21:36   ` Szymon Janc
2014-12-10 19:15 ` [PATCH v3 2/4] android/bluetooth: Store IRK when storing adapter config Lukasz Rymanowski
2014-12-10 19:15 ` [PATCH v3 3/4] android/bluetooth: Load IRK on adapter start Lukasz Rymanowski
2014-12-10 19:15 ` [PATCH v3 4/4] android/bluetooth: Enable LE privacy mode on BfA startup Lukasz Rymanowski
2014-12-16 21:37   ` Szymon Janc [this message]
2014-12-16 22:11     ` Lukasz Rymanowski

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=2944887.ToNmaQstia@athlon \
    --to=szymon.janc@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lukasz.rymanowski@tieto.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;
as well as URLs for NNTP newsgroup(s).