linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Bluetooth: Don't send device found events during passive scanning
Date: Mon, 24 Mar 2014 16:52:35 +0200	[thread overview]
Message-ID: <20140324145235.GA31526@t440s.lan> (raw)
In-Reply-To: <53304433.30507@openbossa.org>

Hi Andre,

On Mon, Mar 24, 2014, Andre Guedes wrote:
> On 03/24/2014 05:48 AM, johan.hedberg@gmail.com wrote:
> >From: Johan Hedberg <johan.hedberg@intel.com>
> >
> >Passive LE scanning is only used by the kernel-internal connection
> >establishment procedure. It makes therefore little sense to send device
> >found events to user space.
> 
> Not sure this patch is necessary. This feature is already garanteed
> by this patch 12602d0cc005354a519b3eba443d7912ab71313a .

First of all, I'm glad you're reviewing my patches :)

Secondly, yes I'm aware of that other patch and discovery check. I added
this extra one for clarity and for simplifying the logic of the
advertising report processing function (so it can assume that we're
doing active scanning once we've gone past this first if-statement).

> >diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> >index 43872af20aa4..403c1d96331a 100644
> >--- a/net/bluetooth/hci_event.c
> >+++ b/net/bluetooth/hci_event.c
> >@@ -3944,8 +3944,12 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr,
> >  static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
> >  			       u8 bdaddr_type, s8 rssi, u8 *data, u8 len)
> >  {
> >-	if (type == LE_ADV_IND || type == LE_ADV_DIRECT_IND)
> >-		check_pending_le_conn(hdev, bdaddr, bdaddr_type);
> >+	/* Passive scanning shouldn't trigger any device found events */
> >+	if (hdev->le_scan_type == LE_SCAN_PASSIVE) {
> >+		if (type == LE_ADV_IND || type == LE_ADV_DIRECT_IND)
> >+			check_pending_le_conn(hdev, bdaddr, bdaddr_type);
> >+	    return;
> >+	}
> 
> Additionally, as a side effect of this change, automatic connection
> won't be establish while discovery is running anymore. So it can add
> even more delay to our reconnection procedure (10.24 seconds max).
> Did you considered this?

Yes, I've considered it, however no one seems to be 100% sure either way
what is the best policy. Either you abort the discovery procedure the
user has started in hopes of pairing/connecting a new device, or you
delay the connection to an existing device. For now, I decided to be
consistent with what the "old" user space based reconnection code is
doing, i.e. ignoring events while active discovery has been requested.

Johan

  reply	other threads:[~2014-03-24 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24  8:48 [PATCH v2 1/4] Bluetooth: Refactor advertising report processing into its own function johan.hedberg
2014-03-24  8:48 ` [PATCH v2 2/4] Bluetooth: Don't send device found events during passive scanning johan.hedberg
2014-03-24 14:41   ` Andre Guedes
2014-03-24 14:52     ` Johan Hedberg [this message]
2014-03-24 20:05   ` Marcel Holtmann
2014-03-24  8:48 ` [PATCH v2 3/4] Bluetooth: Add scan_rsp parameter to mgmt_device_found() johan.hedberg
2014-03-24 20:05   ` Marcel Holtmann
2014-03-24  8:48 ` [PATCH v2 4/4] Bluetooth: Merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together johan.hedberg
2014-03-24 20:12   ` Marcel Holtmann
2014-03-25  8:23     ` Johan Hedberg
2014-03-24 20:05 ` [PATCH v2 1/4] Bluetooth: Refactor advertising report processing into its own function Marcel Holtmann

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=20140324145235.GA31526@t440s.lan \
    --to=johan.hedberg@gmail.com \
    --cc=andre.guedes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).