Hi Johan,
You're right that we're missing the clearing of the HCI_SETUP flag for
such a scenario. Could you try the attached patch. It should fix the
We have tested your patch. Yes, it fixes the problem. Thanks!
issue. One problem that it does have is that if the HCIDEVUP ioctl path
goes through before hci_power_on gets called we will never notify mgmt
of the adapter. However, that might be acceptable here since if you're
using HCIDEVUP like this it seems it's not a mgmt based system anyway.
Do you think the following change helps?
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 3d9f02b..24814b0 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1665,7 +1665,7 @@ static void hci_power_on(struct work_struct *work)
BT_DBG("%s", hdev->name);
err = hci_dev_open(hdev->id);
- if (err < 0) {
+ if (err < 0 && err != -EALREADY) {
mgmt_set_powered_failed(hdev, err);
return;
}
Thanks,
Bing