Bluetooth: Introduce unconfigured controller state
With the new unconfigured controller state it is possible to provide a fully functional HCI transport, but disable the higher level operations that would normally happen. This way userspace can try to configure the controller before releases the unconfigured state. The internal state is represented by HCI_UNCONFIGURED. This replaces the HCI_QUIRK_RAW_DEVICE quirk as internal state representation. This is now a real state and drivers can use the quirk to actually trigger this state. In the future this will allow a more fine grained switching from unconfigured state to configured state for controller inititialization. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
@@ -453,7 +453,7 @@ static int hci_sock_release(struct socket *sock)
|
||||
|
||||
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);
|
||||
@@ -518,7 +518,7 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
|
||||
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)
|
||||
@@ -706,13 +706,13 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
|
||||
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;
|
||||
|
Reference in New Issue
Block a user