All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/3] Bluetooth: Don't send device found events during passive scanning
Date: Sat, 22 Mar 2014 11:48:53 -0700	[thread overview]
Message-ID: <D104547D-CF55-4E6A-8474-9222047BBFCC@holtmann.org> (raw)
In-Reply-To: <1395506915-23058-2-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

> 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.
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/hci_event.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
> 
> 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;

the indentation is sort of screwed up here.

> +	}
> 
> 	mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, rssi, 0, 1,
> 			  data, len);

And strictly speaking the mgmt_device_found checks by itself if it is discovering mode or not. So events will only be send out when discovering. However I think it is a good idea to shortcut this function when passive scanning.

One minor details is now that devices will no longer be connected when doing active discovery. So when you discover a device during discovery, it will not be connected, it has to wait for the next passive scan. Not sure if we really want that. Especially with direct advertising, we really want to connect right away.

Regards

Marcel


  reply	other threads:[~2014-03-22 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-22 16:48 [PATCH 1/3] Bluetooth: Refactor advertising report processing into its own function johan.hedberg
2014-03-22 16:48 ` [PATCH 2/3] Bluetooth: Don't send device found events during passive scanning johan.hedberg
2014-03-22 18:48   ` Marcel Holtmann [this message]
2014-03-22 16:48 ` [PATCH 3/3] Bluetooth: Merge adv_ind/adv_direct_ind ans scan_rsp together johan.hedberg
2014-03-22 18:54   ` Marcel Holtmann
2014-03-23 15:04     ` Johan Hedberg
2014-03-22 18:46 ` [PATCH 1/3] 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=D104547D-CF55-4E6A-8474-9222047BBFCC@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=johan.hedberg@gmail.com \
    --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 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.