Skip to content

Commit 5ea234d

Browse files
holtmannjhedberg
authored andcommitted
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: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 9713c17 commit 5ea234d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,6 +2887,12 @@ static void hci_power_on(struct work_struct *work)
28872887
*/
28882888
mgmt_index_added(hdev);
28892889
} else if (test_and_clear_bit(HCI_CONFIG, &hdev->dev_flags)) {
2890+
/* When the controller is now configured, then it
2891+
* is important to clear the HCI_RAW flag.
2892+
*/
2893+
if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
2894+
clear_bit(HCI_RAW, &hdev->flags);
2895+
28902896
/* Powering on the controller with HCI_CONFIG set only
28912897
* happens with the transition from unconfigured to
28922898
* configured. This will send the Index Added event.

‎net/bluetooth/mgmt.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,6 +5451,7 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev,
54515451

54525452
queue_work(hdev->req_workqueue, &hdev->power_on);
54535453
} else {
5454+
set_bit(HCI_RAW, &hdev->flags);
54545455
mgmt_index_added(hdev);
54555456
}
54565457
}

0 commit comments

Comments
 (0)