Commit d5cc6626 authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Introduce HCI_MGMT_HDEV_OPTIONAL option

When setting HCI_MGMT_HDEV_OPTIONAL it is possible to target a specific
conntroller or a global interface.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 14a81bf0
...@@ -1554,6 +1554,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); ...@@ -1554,6 +1554,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
#define HCI_MGMT_NO_HDEV BIT(1) #define HCI_MGMT_NO_HDEV BIT(1)
#define HCI_MGMT_UNTRUSTED BIT(2) #define HCI_MGMT_UNTRUSTED BIT(2)
#define HCI_MGMT_UNCONFIGURED BIT(3) #define HCI_MGMT_UNCONFIGURED BIT(3)
#define HCI_MGMT_HDEV_OPTIONAL BIT(4)
struct hci_mgmt_handler { struct hci_mgmt_handler {
int (*func) (struct sock *sk, struct hci_dev *hdev, void *data, int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
......
...@@ -1579,12 +1579,14 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk, ...@@ -1579,12 +1579,14 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
} }
} }
if (!(handler->flags & HCI_MGMT_HDEV_OPTIONAL)) {
no_hdev = (handler->flags & HCI_MGMT_NO_HDEV); no_hdev = (handler->flags & HCI_MGMT_NO_HDEV);
if (no_hdev != !hdev) { if (no_hdev != !hdev) {
err = mgmt_cmd_status(sk, index, opcode, err = mgmt_cmd_status(sk, index, opcode,
MGMT_STATUS_INVALID_INDEX); MGMT_STATUS_INVALID_INDEX);
goto done; goto done;
} }
}
var_len = (handler->flags & HCI_MGMT_VAR_LEN); var_len = (handler->flags & HCI_MGMT_VAR_LEN);
if ((var_len && len < handler->data_len) || if ((var_len && len < handler->data_len) ||
......
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