aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-14 20:53:25 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-15 10:03:41 +0200
commitd3d5305bfd1cb48c8f44207abb567276a1e09cc7 (patch)
tree5bcc688e2ccdb2b9c5936d3a18a83edc23d75cdf /net
parentBluetooth: Use BIT(n) macro instead of manually encoding (1 << n) (diff)
downloadlinux-dev-d3d5305bfd1cb48c8f44207abb567276a1e09cc7.tar.xz
linux-dev-d3d5305bfd1cb48c8f44207abb567276a1e09cc7.zip
Bluetooth: Add simple version of Read Advertising Features command
This adds support for the simplest possible version of Read Advertising Features management command. It allows basic testing of the interface. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index fa5654d89702..25a687c2a112 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -97,6 +97,7 @@ static const u16 mgmt_commands[] = {
MGMT_OP_SET_PUBLIC_ADDRESS,
MGMT_OP_START_SERVICE_DISCOVERY,
MGMT_OP_READ_EXT_INDEX_LIST,
+ MGMT_OP_READ_ADV_FEATURES,
};
static const u16 mgmt_events[] = {
@@ -6254,6 +6255,40 @@ unlock:
return err;
}
+static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 data_len)
+{
+ struct mgmt_rp_read_adv_features *rp;
+ size_t rp_len;
+ int err;
+
+ BT_DBG("%s", hdev->name);
+
+ hci_dev_lock(hdev);
+
+ rp_len = sizeof(*rp);
+ rp = kmalloc(rp_len, GFP_ATOMIC);
+ if (!rp) {
+ hci_dev_unlock(hdev);
+ return -ENOMEM;
+ }
+
+ rp->supported_flags = cpu_to_le32(0);
+ rp->max_adv_data_len = 31;
+ rp->max_scan_rsp_len = 31;
+ rp->max_instances = 0;
+ rp->num_instances = 0;
+
+ hci_dev_unlock(hdev);
+
+ err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_ADV_FEATURES,
+ MGMT_STATUS_SUCCESS, rp, rp_len);
+
+ kfree(rp);
+
+ return err;
+}
+
static const struct hci_mgmt_handler mgmt_handlers[] = {
{ NULL }, /* 0x0000 (no command) */
{ read_version, MGMT_READ_VERSION_SIZE,
@@ -6337,6 +6372,7 @@ static const struct hci_mgmt_handler mgmt_handlers[] = {
{ read_ext_index_list, MGMT_READ_EXT_INDEX_LIST_SIZE,
HCI_MGMT_NO_HDEV |
HCI_MGMT_UNTRUSTED },
+ { read_adv_features, MGMT_READ_ADV_FEATURES_SIZE },
};
int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,