Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 4/4] android/gatt: Use proper identity address for auto connect
Date: Sun, 09 Nov 2014 20:47:37 +0100	[thread overview]
Message-ID: <2956983.gPnelmntDU@localhost.localdomain> (raw)
In-Reply-To: <CABBYNZ+dZTiaMqw6F256zRzXP-0Z4oq8puGOegu_wXiMT6muBQ@mail.gmail.com>

Hi Jakub, Luiz,

On Thursday 06 of November 2014 15:43:14 Luiz Augusto von Dentz wrote:
> Hi Jakub,
> 
> On Thu, Nov 6, 2014 at 11:30 AM, Jakub Tyszkowski
> 
> <jakub.tyszkowski@tieto.com> wrote:
> > We should behave the same as whe nwe connect using active scan.
> > ---
> > 
> >  android/gatt.c | 20 ++++++++++++++++++--
> >  1 file changed, 18 insertions(+), 2 deletions(-)
> > 
> > diff --git a/android/gatt.c b/android/gatt.c
> > index 47dadc2..8cc7536 100644
> > --- a/android/gatt.c
> > +++ b/android/gatt.c
> > @@ -583,8 +583,24 @@ static void device_set_state(struct gatt_device *dev,
> > uint32_t state)> 
> >  static bool auto_connect_le(struct gatt_device *dev)
> >  {
> >  
> >         /*  For LE devices use auto connect feature if possible */
> > 
> > -       if (bt_kernel_conn_control())
> > -               return  bt_auto_connect_add(&dev->bdaddr);
> > +       if (bt_kernel_conn_control()) {
> > +               const bdaddr_t *bdaddr;
> > +
> > +               /*
> > +                * If address type is random it might be that IRK was
> > received +                * and random is just for faking Android
> > Framework. ID address +                * should be used for connection if
> > present.
> > +                */
> > +               if (dev->bdaddr_type == BDADDR_LE_RANDOM) {
> > +                       bdaddr = bt_get_id_addr(&dev->bdaddr, NULL);
> > +                       if (!bdaddr)
> > +                               return -EINVAL;
> > +               } else {
> > +                       bdaddr = &dev->bdaddr;
> > +               }
> > +
> > +               return bt_auto_connect_add(bdaddr);
> > +       }
> > 
> >         /* Trigger discovery if not already started */
> >         if (!scanning) {
> > 
> > --
> > 1.9.1
> 
> Perhaps this would be better done inside bt_auto_connect_add since
> anyway bt_get_id_addr is in bluetooth.c, actually perhaps
> auto_connect_le is not really necessary since bt_auto_connect_add
> should be able to do the checks done here.

I've applied this patch so we use proper address when connecting.
Nevertheless, Jakub please send follow up patch that address Luiz comment.

Thanks.

-- 
BR
Szymon Janc

  reply	other threads:[~2014-11-09 19:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06  9:30 [PATCH 1/4] android/gatt: Fix using wrong variable type Jakub Tyszkowski
2014-11-06  9:30 ` [PATCH 2/4] android/gatt: Fix sign counter comparison Jakub Tyszkowski
2014-11-06  9:30 ` [PATCH 3/4] android/gatt: Fix pending request data leakage Jakub Tyszkowski
2014-11-06  9:30 ` [PATCH 4/4] android/gatt: Use proper identity address for auto connect Jakub Tyszkowski
2014-11-06 13:43   ` Luiz Augusto von Dentz
2014-11-09 19:47     ` Szymon Janc [this message]
2014-11-06 15:28 ` [PATCH 1/4] android/gatt: Fix using wrong variable type Szymon Janc

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=2956983.gPnelmntDU@localhost.localdomain \
    --to=szymon.janc@tieto.com \
    --cc=jakub.tyszkowski@tieto.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