linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v3 5/6] Bluetooth: MGMT start discovery LE-Only support
Date: Mon, 30 Jan 2012 13:44:24 -0800	[thread overview]
Message-ID: <1327959864.1955.171.camel@aeonflux> (raw)
In-Reply-To: <1327531949-29463-6-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

> This patch adds LE-Only discovery procedure support to MGMT Start
> Discovery command.
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |   13 ++++++++++++-
>  net/bluetooth/mgmt.c      |   20 +++++++++++++++++++-
>  2 files changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 856ab35..fb2497b 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1033,6 +1033,13 @@ static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb)
>  
>  	hdev->le_scan_result = -bt_to_errno(status);
>  	wake_up(&hdev->le_scan_wait_q);
> +
> +	if (status) {
> +		hci_dev_lock(hdev);
> +		mgmt_start_discovery_failed(hdev, status);
> +		hci_dev_unlock(hdev);
> +		return;
> +	}
>  }
>  
>  static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
> @@ -1052,8 +1059,12 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
>  		hdev->le_scan_result = -bt_to_errno(status);
>  		wake_up(&hdev->le_scan_wait_q);
>  
> -		if (status)
> +		if (status) {
> +			hci_dev_lock(hdev);
> +			mgmt_start_discovery_failed(hdev, status);
> +			hci_dev_unlock(hdev);
>  			return;
> +		}

are these two related to the other changes or just actual bug fixes?

>  
>  		set_bit(HCI_LE_SCAN, &hdev->dev_flags);
>  
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 8970799..0a1fa4c 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -35,6 +35,15 @@
>  #define MGMT_VERSION	0
>  #define MGMT_REVISION	1
>  
> +/*
> + * These LE scan and inquiry parameters were chosen according to LE General
> + * Discovery Procedure specification.
> + */
> +#define LE_SCAN_TYPE			0x01
> +#define LE_SCAN_WIN			0x12
> +#define LE_SCAN_INT			0x12
> +#define LE_SCAN_TIMEOUT_LE_ONLY		10240	/* TGAP(gen_disc_scan_min) */
> +
>  #define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
>  
>  #define SERVICE_CACHE_TIMEOUT (5 * 1000)
> @@ -1897,6 +1906,7 @@ static int start_discovery(struct sock *sk, u16 index,
>  						unsigned char *data, u16 len)
>  {
>  	struct mgmt_cp_start_discovery *cp = (void *) data;
> +	unsigned long discov_type = cp->type;
>  	struct pending_cmd *cmd;
>  	struct hci_dev *hdev;
>  	int err;
> @@ -1932,7 +1942,15 @@ static int start_discovery(struct sock *sk, u16 index,
>  		goto failed;
>  	}
>  
> -	err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
> +	if (test_bit(MGMT_ADDR_BREDR, &discov_type))
> +		err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
> +	else if (test_bit(MGMT_ADDR_LE_PUBLIC, &discov_type) &&
> +				test_bit(MGMT_ADDR_LE_RANDOM, &discov_type))

so test_bit can not check for two bits at the same time?

> +		err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT,
> +					LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY);
> +	else
> +		err = -EINVAL;
> +
>  	if (err < 0)
>  		mgmt_pending_remove(cmd);
>  	else

Regards

Marcel



  parent reply	other threads:[~2012-01-30 21:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 22:52 [PATCH v3 0/6] MGMT Start Discovery command LE-Only Support Andre Guedes
2012-01-25 22:52 ` [PATCH v3 1/6] Bluetooth: LE scan should send Discovering events Andre Guedes
2012-01-30 21:35   ` Marcel Holtmann
2012-01-31 13:41     ` Andre Guedes
2012-01-31 15:12       ` Marcel Holtmann
2012-01-25 22:52 ` [PATCH v3 2/6] Bluetooth: Add helper functions to send LE scan commands Andre Guedes
2012-01-25 22:52 ` [PATCH v3 3/6] Bluetooth: Add hci_do_le_scan() Andre Guedes
2012-01-30 21:38   ` Marcel Holtmann
2012-01-30 23:22     ` Andre Guedes
2012-01-31  0:51       ` Marcel Holtmann
2012-01-31 13:42         ` Andre Guedes
2012-01-25 22:52 ` [PATCH v3 4/6] Bluetooth: Add hci_le_scan() Andre Guedes
2012-01-30 21:41   ` Marcel Holtmann
2012-01-25 22:52 ` [PATCH v3 5/6] Bluetooth: MGMT start discovery LE-Only support Andre Guedes
2012-01-26 12:55   ` Anderson Lizardo
2012-01-26 13:05     ` Andre Guedes
2012-01-30 21:44   ` Marcel Holtmann [this message]
2012-01-31 13:44     ` Andre Guedes
2012-01-25 22:52 ` [PATCH v3 6/6] Bluetooth: Fix indentation Andre Guedes
2012-01-30 21:45   ` Marcel Holtmann
2012-01-31 13:45     ` Andre Guedes

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=1327959864.1955.171.camel@aeonflux \
    --to=marcel@holtmann.org \
    --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).