diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-11-07 19:23:00 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-11-18 20:03:01 -0500 |
commit | 3f0f524bafcd2025c12e215f13207c7be0a13bf9 (patch) | |
tree | 0938ee73420e34e3753f344d3a3e8927db57f672 /net/bluetooth/hci_event.c | |
parent | bbaf444a89dd7dd7effd8ed2f4e4ec64da3cc1da (diff) |
Bluetooth: Add support for setting LE advertising data
This patch adds support for setting basing LE advertising data. The
three elements supported for now are the advertising flags, the TX power
and the friendly name.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 09c65712e8cc..7caea1af557b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -204,6 +204,9 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) | |||
204 | hdev->discovery.state = DISCOVERY_STOPPED; | 204 | hdev->discovery.state = DISCOVERY_STOPPED; |
205 | hdev->inq_tx_power = HCI_TX_POWER_INVALID; | 205 | hdev->inq_tx_power = HCI_TX_POWER_INVALID; |
206 | hdev->adv_tx_power = HCI_TX_POWER_INVALID; | 206 | hdev->adv_tx_power = HCI_TX_POWER_INVALID; |
207 | |||
208 | memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); | ||
209 | hdev->adv_data_len = 0; | ||
207 | } | 210 | } |
208 | 211 | ||
209 | static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) | 212 | static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -226,6 +229,9 @@ static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) | |||
226 | 229 | ||
227 | hci_dev_unlock(hdev); | 230 | hci_dev_unlock(hdev); |
228 | 231 | ||
232 | if (!status && !test_bit(HCI_INIT, &hdev->flags)) | ||
233 | hci_update_ad(hdev); | ||
234 | |||
229 | hci_req_complete(hdev, HCI_OP_WRITE_LOCAL_NAME, status); | 235 | hci_req_complete(hdev, HCI_OP_WRITE_LOCAL_NAME, status); |
230 | } | 236 | } |
231 | 237 | ||
@@ -1091,8 +1097,11 @@ static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, | |||
1091 | 1097 | ||
1092 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 1098 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
1093 | 1099 | ||
1094 | if (!rp->status) | 1100 | if (!rp->status) { |
1095 | hdev->adv_tx_power = rp->tx_power; | 1101 | hdev->adv_tx_power = rp->tx_power; |
1102 | if (!test_bit(HCI_INIT, &hdev->flags)) | ||
1103 | hci_update_ad(hdev); | ||
1104 | } | ||
1096 | 1105 | ||
1097 | hci_req_complete(hdev, HCI_OP_LE_READ_ADV_TX_POWER, rp->status); | 1106 | hci_req_complete(hdev, HCI_OP_LE_READ_ADV_TX_POWER, rp->status); |
1098 | } | 1107 | } |