goto done;
}
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
err = -EOPNOTSUPP;
goto done;
}
}
if (!ret) {
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks) &&
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) &&
!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags))
ret = __hci_init(hdev);
}
set_bit(HCI_UP, &hdev->flags);
hci_notify(hdev, HCI_DEV_UP);
if (!test_bit(HCI_SETUP, &hdev->dev_flags) &&
+ !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) &&
!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) &&
hdev->dev_type == HCI_BREDR) {
hci_dev_lock(hdev);
if (!hdev)
return -ENODEV;
- /* Devices that are marked for raw-only usage can only be powered
+ /* Devices that are marked as unconfigured can only be powered
* up as user channel. Trying to bring them up as normal devices
* will result into a failure. Only user channel operation is
* possible.
* HCI_USER_CHANNEL will be set first before attempting to
* open the device.
*/
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks) &&
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) &&
!test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) {
err = -EOPNOTSUPP;
goto done;
/* Reset device */
skb_queue_purge(&hdev->cmd_q);
atomic_set(&hdev->cmd_cnt, 1);
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks) &&
- !test_bit(HCI_AUTO_OFF, &hdev->dev_flags) &&
+ if (!test_bit(HCI_AUTO_OFF, &hdev->dev_flags) &&
+ !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) &&
test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) {
set_bit(HCI_INIT, &hdev->flags);
__hci_req_sync(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT);
goto done;
}
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
ret = -EOPNOTSUPP;
goto done;
}
goto done;
}
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
ret = -EOPNOTSUPP;
goto done;
}
goto done;
}
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
err = -EOPNOTSUPP;
goto done;
}
* valid, it is important to turn the device back off.
*/
if (test_bit(HCI_RFKILLED, &hdev->dev_flags) ||
+ test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) ||
(hdev->dev_type == HCI_BREDR &&
!bacmp(&hdev->bdaddr, BDADDR_ANY) &&
!bacmp(&hdev->static_addr, BDADDR_ANY))) {
}
if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) {
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+ /* For unconfigured devices, set the HCI_RAW flag
+ * so that userspace can easily identify them.
+ *
+ * If the device is fully configured and ready for
+ * operation, announce it via management interface.
+ */
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
+ set_bit(HCI_RAW, &hdev->flags);
+ else
mgmt_index_added(hdev);
}
}
list_add(&hdev->list, &hci_dev_list);
write_unlock(&hci_dev_list_lock);
- /* Devices that are marked for raw-only usage need to set
- * the HCI_RAW flag to indicate that only user channel is
- * supported.
+ /* Devices that are marked for raw-only usage are unconfigured
+ * and should not be included in normal operation.
*/
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
- set_bit(HCI_RAW, &hdev->flags);
+ set_bit(HCI_UNCONFIGURED, &hdev->dev_flags);
hci_notify(hdev, HCI_DEV_REG);
hci_dev_hold(hdev);
if (!test_bit(HCI_INIT, &hdev->flags) &&
!test_bit(HCI_SETUP, &hdev->dev_flags) &&
- !test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
hci_dev_lock(hdev);
mgmt_index_removed(hdev);
hci_dev_unlock(hdev);
static void __check_timeout(struct hci_dev *hdev, unsigned int cnt)
{
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
/* ACL tx timeout must be longer than maximum
* link supervision timeout (40.9 seconds) */
if (!cnt && time_after(jiffies, hdev->acl_last_tx +
if (!hci_conn_num(hdev, LE_LINK))
return;
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) {
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
/* LE tx timeout must be longer than maximum
* link supervision timeout (40.9 seconds) */
if (!hdev->le_cnt && hdev->le_pkts &&
if (hdev) {
if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
mgmt_index_added(hdev);
clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags);
hci_dev_close(hdev->id);
if (test_bit(HCI_USER_CHANNEL, &hdev->dev_flags))
return -EBUSY;
- if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+ if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
return -EOPNOTSUPP;
if (hdev->dev_type != HCI_BREDR)
goto done;
}
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
mgmt_index_removed(hdev);
err = hci_dev_open(hdev->id);
if (err) {
clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags);
- if (!test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+ if (!test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
mgmt_index_added(hdev);
hci_dev_put(hdev);
goto done;