* [PATCH v2] Bluetooth: Power the device up after a rfkill unblock
@ 2013-01-14 14:20 Vinicius Costa Gomes
2013-01-14 18:00 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2013-01-14 14:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Vinicius Costa Gomes
With the HCI_SETUP patches, this is all that is needed to make the
case when a adapter is added with Bluetooth blocked in rfkill to work.
When rfkill is unblocked, the device will be powered on if the device
is in HCI_SETUP state, meaning that it was never properly initialized.
If the device is not used by userspace, the HCI_AUTO_OFF flag will
take care of powering it off.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
---
Samuel on IRC caused me to remember this. Thanks :-)
net/bluetooth/hci_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 596660d..9796c0a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1124,8 +1124,11 @@ static int hci_rfkill_set_block(void *data, bool blocked)
BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked);
- if (!blocked)
+ if (!blocked) {
+ if (test_bit(HCI_SETUP, &hdev->dev_flags))
+ schedule_work(&hdev->power_on);
return 0;
+ }
hci_dev_do_close(hdev);
--
1.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Bluetooth: Power the device up after a rfkill unblock
2013-01-14 14:20 [PATCH v2] Bluetooth: Power the device up after a rfkill unblock Vinicius Costa Gomes
@ 2013-01-14 18:00 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2013-01-14 18:00 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
Hi Vinicius,
> With the HCI_SETUP patches, this is all that is needed to make the
> case when a adapter is added with Bluetooth blocked in rfkill to work.
>
> When rfkill is unblocked, the device will be powered on if the device
> is in HCI_SETUP state, meaning that it was never properly initialized.
> If the device is not used by userspace, the HCI_AUTO_OFF flag will
> take care of powering it off.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>
> Samuel on IRC caused me to remember this. Thanks :-)
>
>
> net/bluetooth/hci_core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 596660d..9796c0a 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1124,8 +1124,11 @@ static int hci_rfkill_set_block(void *data, bool blocked)
>
> BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked);
>
> - if (!blocked)
> + if (!blocked) {
> + if (test_bit(HCI_SETUP, &hdev->dev_flags))
> + schedule_work(&hdev->power_on);
> return 0;
> + }
>
> hci_dev_do_close(hdev);
>
is this really the behavior that we want. Even if rfkill block all
Bluetooth is set, we should run the adapter initialization. That is not
triggering any RF. Sending the initial HCI_Reset is actually even more
important to ensure the adapter is really reset and has not some left
over state.
So I think what should be done is run the HCI_SETUP phase, but then
refuse to allow bringing up the controller.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-14 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 14:20 [PATCH v2] Bluetooth: Power the device up after a rfkill unblock Vinicius Costa Gomes
2013-01-14 18:00 ` Marcel Holtmann
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).