summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorArman Uguray <armansito@chromium.org>2015-03-25 18:53:42 -0700
committerMarcel Holtmann <marcel@holtmann.org>2015-03-26 03:30:29 +0100
commit807ec772bf484a8e93bc9a2a681e49cb8f2c4d69 (patch)
tree04d325f98922a6609d82806ed2e71a1fb71dca8f /net/bluetooth
parentb44133ff03be30b55f23036e62f403a3f7784fce (diff)
downloadop-kernel-dev-807ec772bf484a8e93bc9a2a681e49cb8f2c4d69.zip
op-kernel-dev-807ec772bf484a8e93bc9a2a681e49cb8f2c4d69.tar.gz
Bluetooth: Support the "limited-discoverable" adv flag
This patch adds support for the "limited-discoverable" flag of the Add Advertising command. Signed-off-by: Arman Uguray <armansito@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index c180452..797cf6c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -977,9 +977,15 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 *ptr)
{
u8 ad_len = 0, flags = 0;
+ /* The Add Advertising command allows userspace to set both the general
+ * and limited discoverable flags.
+ */
if (hdev->adv_instance.flags & MGMT_ADV_FLAG_DISCOV)
flags |= LE_AD_GENERAL;
+ if (hdev->adv_instance.flags & MGMT_ADV_FLAG_LIMITED_DISCOV)
+ flags |= LE_AD_LIMITED;
+
if (flags) {
if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
flags |= LE_AD_NO_BREDR;
@@ -6576,8 +6582,9 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,
u8 max_len = HCI_MAX_AD_LENGTH;
int i, cur_len;
bool flags_managed = false;
+ u32 flags_params = MGMT_ADV_FLAG_DISCOV | MGMT_ADV_FLAG_LIMITED_DISCOV;
- if (is_adv_data && (adv_flags & MGMT_ADV_FLAG_DISCOV)) {
+ if (is_adv_data && (adv_flags & flags_params)) {
flags_managed = true;
max_len -= 3;
}
OpenPOWER on IntegriCloud