From: Marcel Holtmann <marcel@holtmann.org>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC v2 1/8] Bluetooth: Setup LE scan with no timeout
Date: Mon, 18 Feb 2013 23:41:35 +0100 [thread overview]
Message-ID: <1361227295.1583.31.camel@aeonflux> (raw)
In-Reply-To: <CACJA=fVD_0z5o6D0L-1roj19GTaOCYiroAXEWWhXMY4tC5+1Xw@mail.gmail.com>
Hi Andre,
> >> This patch modifies hci_do_le_scan and hci_cancel_le_scan helpers so
> >> we are able to start and stop LE scan with no timeout. This feature
> >> will be used by the LE connection routine.
> >>
> >> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> >> ---
> >> net/bluetooth/hci_core.c | 17 +++++++++--------
> >> 1 file changed, 9 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> >> index 22e77a7..3aa0345 100644
> >> --- a/net/bluetooth/hci_core.c
> >> +++ b/net/bluetooth/hci_core.c
> >> @@ -1618,26 +1618,27 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
> >> if (err < 0)
> >> return err;
> >>
> >> - queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable,
> >> - msecs_to_jiffies(timeout));
> >> + if (timeout > 0)
> >> + queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable,
> >> + msecs_to_jiffies(timeout));
> >>
> >> return 0;
> >> }
> >
> > I really do not like this magic handling of scan disable. Maybe you
> > better remove the timeout handling completely and put it into the
> > discovery functionality.
> >
> > Doing it like this seems pretty much hacked together. It no longer looks
> > like the right place to do handle it.
>
> The le_scan_disable work should be scheduled only if LE scanning was
> started successfully.
>
> So hci_do_le_scan seems to be a better place than discovery
> functionality for the timeout handling. Besides, these LE scan helpers
> were originally designed to provide a self-contained framework to
> start and stop LE scanning.
>
> The framework lacks support for starting LE scanning with no timeout.
> This patch aims to address this issue.
>
> Anyway, if you still think it is a good idea to remove this timeout
> handling, I'll remove it in the next series.
look into what Johan is working on with the transaction support. I am
getting the feeling that moving everything over to proper transaction
and not just trying it hack stuff in seems to be the right approach.
For example the actual discovery handling needs to be able to report
errors anyway. So that can be handled there.
Regards
Marcel
next prev parent reply other threads:[~2013-02-18 22:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 23:27 [RFC v2 0/8] LE Connection Routine Andre Guedes
2013-02-15 23:27 ` [RFC v2 1/8] Bluetooth: Setup LE scan with no timeout Andre Guedes
2013-02-16 22:26 ` Marcel Holtmann
2013-02-18 22:07 ` Andre Guedes
2013-02-18 22:41 ` Marcel Holtmann [this message]
2013-02-19 18:15 ` Andre Guedes
2013-02-15 23:27 ` [RFC v2 2/8] Bluetooth: Add LE scan type macros Andre Guedes
2013-02-15 23:27 ` [RFC v2 3/8] Bluetooth: LE connection state machine Andre Guedes
2013-02-16 22:32 ` Marcel Holtmann
2013-02-18 22:08 ` Andre Guedes
2013-02-18 22:50 ` Marcel Holtmann
2013-02-19 18:15 ` Andre Guedes
2013-02-15 23:27 ` [RFC v2 4/8] Bluetooth: Add hci_conn helpers Andre Guedes
2013-02-15 23:27 ` [RFC v2 5/8] Bluetooth: Change LE connection routine Andre Guedes
2013-02-15 23:27 ` [RFC v2 6/8] Bluetooth: Handle hci_conn timeout in BT_CONNECT Andre Guedes
2013-02-15 23:27 ` [RFC v2 7/8] Bluetooth: Count pending LE connection attempts Andre Guedes
2013-02-15 23:27 ` [RFC v2 8/8] Bluetooth: Initialize some hci_conn fields earlier 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=1361227295.1583.31.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