Bluetooth: Introduce user channel flag for HCI devices
This patch introduces a new user channel flag that allows to give full control of a HCI device to a user application. The kernel will stay away from the device and does not allow any further modifications of the device states. The existing raw flag is not used since it has a bit of unclear meaning due to its legacy. Using a new flag makes the code clearer. A device with the user channel flag set can still be enumerate using the legacy API, but it does not longer enumerate using the new management interface used by BlueZ 5 and beyond. This is intentional to not confuse users of modern systems. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This commit is contained in:
committed by
Gustavo Padovan
parent
c1c4f95670
commit
0736cfa8e5
@@ -339,6 +339,9 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
if (test_bit(HCI_SETUP, &d->dev_flags))
|
||||
continue;
|
||||
|
||||
if (test_bit(HCI_USER_CHANNEL, &d->dev_flags))
|
||||
continue;
|
||||
|
||||
if (!mgmt_valid_hdev(d))
|
||||
continue;
|
||||
|
||||
@@ -3320,6 +3323,12 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
|
||||
MGMT_STATUS_INVALID_INDEX);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) {
|
||||
err = cmd_status(sk, index, opcode,
|
||||
MGMT_STATUS_INVALID_INDEX);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (opcode >= ARRAY_SIZE(mgmt_handlers) ||
|
||||
|
||||
Reference in New Issue
Block a user