Commit 5ea234d3 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Clear HCI_RAW flag when controller becomes configured

When an unconfigured controllers reaches the configured state, it is
important to change the HCI_RAW flag. It indicates to userspace that
the controller is fully operational.

External configuration allows to bring the controller back into an
unconfigured state. In that case make sure HCI_RAW flag is set again.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 9713c17b
...@@ -2887,6 +2887,12 @@ static void hci_power_on(struct work_struct *work) ...@@ -2887,6 +2887,12 @@ static void hci_power_on(struct work_struct *work)
*/ */
mgmt_index_added(hdev); mgmt_index_added(hdev);
} else if (test_and_clear_bit(HCI_CONFIG, &hdev->dev_flags)) { } else if (test_and_clear_bit(HCI_CONFIG, &hdev->dev_flags)) {
/* When the controller is now configured, then it
* is important to clear the HCI_RAW flag.
*/
if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
clear_bit(HCI_RAW, &hdev->flags);
/* Powering on the controller with HCI_CONFIG set only /* Powering on the controller with HCI_CONFIG set only
* happens with the transition from unconfigured to * happens with the transition from unconfigured to
* configured. This will send the Index Added event. * configured. This will send the Index Added event.
......
...@@ -5451,6 +5451,7 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev, ...@@ -5451,6 +5451,7 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev,
queue_work(hdev->req_workqueue, &hdev->power_on); queue_work(hdev->req_workqueue, &hdev->power_on);
} else { } else {
set_bit(HCI_RAW, &hdev->flags);
mgmt_index_added(hdev); mgmt_index_added(hdev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment