From: Gustavo Padovan <padovan@profusion.mobi>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 01/16] Bluetooth: Periodic Inquiry and mgmt discovering event
Date: Wed, 13 Jul 2011 17:21:28 -0300 [thread overview]
Message-ID: <20110713202128.GD23921@joana> (raw)
In-Reply-To: <1310418719-12296-2-git-send-email-andre.guedes@openbossa.org>
* Andre Guedes <andre.guedes@openbossa.org> [2011-07-11 18:11:44 -0300]:
> By using periodic inquiry command we're not able to detect correctly
> when the controller has started inquiry.
>
> Today we have this workaround in inquiry result event handler to set
> the HCI_INQUIRY flag when it sees the first inquiry result event.
> This workaround isn't enough because the device may be performing
> an inquiry but the HCI_INQUIRY flag is not set. For instance, if
> there is no device in range, no inquiry result event is generated,
> consequently, the HCI_INQUIRY flags isn't set when it should so.
>
> We rely on HCI_INQUIRY flag to implement the discovery procedure
> properly. So, as we aren't able to clear/set the HCI_INQUIRY flag in
> a reliable manner, periodic inquiry events shouldn't change the
> HCI_INQUIRY flag. In future, if needed, we might add a new flag (e.g.
> HCI_PINQUIRY) to know if the controller is performing periodic
> inquiry.
>
> Thus, due to that issue and in order to keep compatibility with
> userspace, periodic inquiry events shouldn't send mgmt discovering
> events.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/hci_event.c | 46 ++++++++++++--------------------------------
> 1 files changed, 13 insertions(+), 33 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index a40170e..cf0efe5 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -58,13 +58,13 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
> if (status)
> return;
>
> - if (test_bit(HCI_MGMT, &hdev->flags) &&
> - test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
> - mgmt_discovering(hdev->id, 0);
> + clear_bit(HCI_INQUIRY, &hdev->flags);
>
> hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status);
>
> hci_conn_check_pending(hdev);
> +
> + mgmt_discovering(hdev->id, 0);
> }
>
> static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
> @@ -76,10 +76,6 @@ static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
> if (status)
> return;
>
> - if (test_bit(HCI_MGMT, &hdev->flags) &&
> - test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
> - mgmt_discovering(hdev->id, 0);
> -
> hci_conn_check_pending(hdev);
> }
>
> @@ -959,10 +955,9 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
> return;
> }
>
> - if (test_bit(HCI_MGMT, &hdev->flags) &&
> - !test_and_set_bit(HCI_INQUIRY,
> - &hdev->flags))
> - mgmt_discovering(hdev->id, 1);
> + set_bit(HCI_INQUIRY, &hdev->flags);
> +
> + mgmt_discovering(hdev->id, 1);
> }
>
> static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
> @@ -1340,13 +1335,16 @@ static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff
>
> BT_DBG("%s status %d", hdev->name, status);
>
> - if (test_bit(HCI_MGMT, &hdev->flags) &&
> - test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
> - mgmt_discovering(hdev->id, 0);
> + hci_conn_check_pending(hdev);
> +
> + if (!test_bit(HCI_INQUIRY, &hdev->flags))
> + return;
> +
> + clear_bit(HCI_INQUIRY, &hdev->flags);
this can be test_and_clear_bit
Gustavo
next prev parent reply other threads:[~2011-07-13 20:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 21:11 [PATCH 00/16] Full support discovery procedure Andre Guedes
2011-07-11 21:11 ` [PATCH 01/16] Bluetooth: Periodic Inquiry and mgmt discovering event Andre Guedes
2011-07-13 20:21 ` Gustavo Padovan [this message]
2011-07-14 14:28 ` Andre Guedes
2011-07-11 21:11 ` [PATCH 02/16] Bluetooth: Add failed/complete functions to discovery commands Andre Guedes
2011-07-11 21:11 ` [PATCH 03/16] Bluetooth: Remove pending " Andre Guedes
2011-07-11 21:11 ` [PATCH 04/16] Bluetooth: Check pending command in start_discovery() Andre Guedes
2011-07-11 21:11 ` [PATCH 05/16] Bluetooth: Check pending commands in stop_discovery() Andre Guedes
2011-07-13 20:20 ` Gustavo Padovan
2011-07-14 14:29 ` Andre Guedes
2011-07-11 21:11 ` [PATCH 06/16] Bluetooth: Create do_inquiry() Andre Guedes
2011-07-11 21:11 ` [PATCH 07/16] Bluetooth: Create cancel_inquiry() Andre Guedes
2011-07-11 21:11 ` [PATCH 08/16] Bluetooth: Fix stop_discovery() Andre Guedes
2011-07-13 20:15 ` Gustavo Padovan
2011-07-14 14:31 ` Andre Guedes
2011-07-22 15:24 ` Gustavo Padovan
2011-07-11 21:11 ` [PATCH 09/16] Bluetooth: Prepare for full support discovery procedures Andre Guedes
2011-07-13 20:26 ` Gustavo Padovan
2011-07-14 14:31 ` Andre Guedes
2011-07-11 21:11 ` [PATCH 10/16] Bluetooth: Check 'dev_class' in mgmt_device_found() Andre Guedes
2011-07-11 21:11 ` [PATCH 11/16] Bluetooth: Add 'eir_len' param to mgmt_device_found() Andre Guedes
2011-07-11 21:11 ` [PATCH 12/16] Bluetooth: Report LE devices Andre Guedes
2011-07-11 21:11 ` [PATCH 13/16] Bluetooth: Add 'le_scan_timer' to struct hci_dev Andre Guedes
2011-07-11 21:11 ` [PATCH 14/16] Bluetooth: Add LE Scan helper functions Andre Guedes
2011-07-11 21:11 ` [PATCH 15/16] Bluetooth: Support LE-Only discovery procedure Andre Guedes
2011-07-11 21:11 ` [PATCH 16/16] 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=20110713202128.GD23921@joana \
--to=padovan@profusion.mobi \
--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).