Linux bluetooth development
 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 v4 08/14] Bluetooth: Prepare for full support discovery procedures
Date: Tue, 20 Sep 2011 14:43:40 +0200	[thread overview]
Message-ID: <1316522621.1937.86.camel@aeonflux> (raw)
In-Reply-To: <1316468136-12472-9-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

> This patch prepares start_discovery() to support LE-Only and BR/EDR/LE
> discovery procedures (BR/EDR is already supported).
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  include/net/bluetooth/hci.h      |    1 +
>  include/net/bluetooth/hci_core.h |    1 +
>  net/bluetooth/mgmt.c             |   10 +++++++++-
>  3 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index aaf79af..1e11e7f 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -202,6 +202,7 @@ enum {
>  
>  #define LMP_EV4		0x01
>  #define LMP_EV5		0x02
> +#define LMP_NO_BREDR	0x20
>  #define LMP_LE		0x40
>  
>  #define LMP_SNIFF_SUBR	0x02
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 36e15cc..e0c9790 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -613,6 +613,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
>  #define lmp_esco_capable(dev)      ((dev)->features[3] & LMP_ESCO)
>  #define lmp_ssp_capable(dev)       ((dev)->features[6] & LMP_SIMPLE_PAIR)
>  #define lmp_no_flush_capable(dev)  ((dev)->features[6] & LMP_NO_FLUSH)
> +#define lmp_bredr_capable(dev)     (!((dev)->features[4] & LMP_NO_BREDR))
>  #define lmp_le_capable(dev)        ((dev)->features[4] & LMP_LE)
>  
>  /* ----- Extended LMP capabilities ----- */
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 58cf33a..3a0815b 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -32,6 +32,8 @@
>  #define MGMT_VERSION	0
>  #define MGMT_REVISION	1
>  
> +#define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
> +
>  struct pending_cmd {
>  	struct list_head list;
>  	__u16 opcode;
> @@ -1632,7 +1634,13 @@ static int start_discovery(struct sock *sk, u16 index)
>  		goto failed;
>  	}
>  
> -	err = hci_do_inquiry(hdev, 0x08);
> +	if (lmp_host_le_capable(hdev) && lmp_bredr_capable(hdev))
> +		err = -ENOSYS;
> +	else if (lmp_host_le_capable(hdev))
> +		err = -ENOSYS;
> +	else
> +		err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
> +

this if statement is ugly. I think you want something like this:

	if (lmp_host_le_capable()) {
		if (lmp_bredr_capable()) {
		} else {
		}
	} else
		hci_do_inquiry()

>  	if (err < 0)
>  		mgmt_pending_remove(cmd);
>  

Regards

Marcel



  reply	other threads:[~2011-09-20 12:43 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 21:35 [PATCH v4 00/14] Discovery support Andre Guedes
2011-09-19 21:35 ` [PATCH v4 01/14] Bluetooth: Periodic Inquiry and mgmt discovering event Andre Guedes
2011-09-20 12:23   ` Marcel Holtmann
2011-09-23 19:12     ` Andre Guedes
2012-03-19 12:40     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 02/14] Bluetooth: Add mgmt_discovery_complete() Andre Guedes
2011-09-20 12:29   ` Marcel Holtmann
2011-09-23 19:13     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 03/14] Bluetooth: Check pending command in start_discovery() Andre Guedes
2011-09-20 12:26   ` Marcel Holtmann
2011-09-23 19:13     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 04/14] Bluetooth: Check pending commands in stop_discovery() Andre Guedes
2011-09-19 21:35 ` [PATCH v4 05/14] Bluetooth: Create hci_do_inquiry() Andre Guedes
2011-09-20 12:31   ` Marcel Holtmann
2011-09-23 19:13     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 06/14] Bluetooth: Create hci_cancel_inquiry() Andre Guedes
2011-09-20 12:33   ` Marcel Holtmann
2011-09-19 21:35 ` [PATCH v4 07/14] Bluetooth: Handle race condition in Discovery Andre Guedes
2011-09-20 12:37   ` Marcel Holtmann
2011-09-23 19:13     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 08/14] Bluetooth: Prepare for full support discovery procedures Andre Guedes
2011-09-20 12:43   ` Marcel Holtmann [this message]
2011-09-23 19:14     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 09/14] Bluetooth: Send mgmt_discovering events Andre Guedes
2011-09-20 12:45   ` Marcel Holtmann
2011-09-23 19:15     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 10/14] Bluetooth: Add 'eir_len' param to mgmt_device_found() Andre Guedes
2011-09-20 12:47   ` Marcel Holtmann
2011-09-19 21:35 ` [PATCH v4 11/14] Bluetooth: Report LE devices Andre Guedes
2011-09-20 12:49   ` Marcel Holtmann
2011-09-23 19:15     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 12/14] Bluetooth: LE scan infra-structure Andre Guedes
2011-09-20 12:53   ` Marcel Holtmann
2011-09-23 19:15     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 13/14] Bluetooth: Support LE-Only discovery procedure Andre Guedes
2011-09-20 13:00   ` Marcel Holtmann
2011-09-23 19:16     ` Andre Guedes
2011-09-19 21:35 ` [PATCH v4 14/14] Bluetooth: Support BR/EDR/LE " 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=1316522621.1937.86.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