diff options
author | Arman Uguray <armansito@chromium.org> | 2015-03-23 18:57:11 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-03-23 20:53:46 -0400 |
commit | 203fea0178d7e165dbe834d1bdd9d243018fd5bf (patch) | |
tree | c1829ab75e4bc8bfdeec5b15ef5c4b5761b678d3 | |
parent | 4453b006538d02ada8294a195bb2dc2ada498436 (diff) |
Bluetooth: Add data structure for advertising instance
This patch introduces a new data structure to represent advertising
instances that were added using the "Add Advertising" mgmt command.
Initially an hci_dev structure will support only one of these instances
at a time, so the current instance is simply stored as a direct member
of hci_dev.
Signed-off-by: Arman Uguray <armansito@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 16 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b65c53de6a69..3a6d4e3d68fe 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -155,6 +155,15 @@ struct oob_data { | |||
155 | u8 rand256[16]; | 155 | u8 rand256[16]; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | struct adv_info { | ||
159 | __u8 instance; | ||
160 | __u32 flags; | ||
161 | __u16 adv_data_len; | ||
162 | __u8 adv_data[HCI_MAX_AD_LENGTH]; | ||
163 | __u16 scan_rsp_len; | ||
164 | __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; | ||
165 | }; | ||
166 | |||
158 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | 167 | #define HCI_MAX_SHORT_NAME_LENGTH 10 |
159 | 168 | ||
160 | /* Default LE RPA expiry time, 15 minutes */ | 169 | /* Default LE RPA expiry time, 15 minutes */ |
@@ -364,6 +373,8 @@ struct hci_dev { | |||
364 | __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; | 373 | __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; |
365 | __u8 scan_rsp_data_len; | 374 | __u8 scan_rsp_data_len; |
366 | 375 | ||
376 | struct adv_info adv_instance; | ||
377 | |||
367 | __u8 irk[16]; | 378 | __u8 irk[16]; |
368 | __u32 rpa_timeout; | 379 | __u32 rpa_timeout; |
369 | struct delayed_work rpa_expired; | 380 | struct delayed_work rpa_expired; |
@@ -550,6 +561,11 @@ static inline void hci_discovery_filter_clear(struct hci_dev *hdev) | |||
550 | hdev->discovery.scan_duration = 0; | 561 | hdev->discovery.scan_duration = 0; |
551 | } | 562 | } |
552 | 563 | ||
564 | static inline void adv_info_init(struct hci_dev *hdev) | ||
565 | { | ||
566 | memset(&hdev->adv_instance, 0, sizeof(struct adv_info)); | ||
567 | } | ||
568 | |||
553 | bool hci_discovery_active(struct hci_dev *hdev); | 569 | bool hci_discovery_active(struct hci_dev *hdev); |
554 | 570 | ||
555 | void hci_discovery_set_state(struct hci_dev *hdev, int state); | 571 | void hci_discovery_set_state(struct hci_dev *hdev, int state); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 17f52a195ba8..e6bfeb7b4415 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -3126,6 +3126,7 @@ struct hci_dev *hci_alloc_dev(void) | |||
3126 | 3126 | ||
3127 | hci_init_sysfs(hdev); | 3127 | hci_init_sysfs(hdev); |
3128 | discovery_init(hdev); | 3128 | discovery_init(hdev); |
3129 | adv_info_init(hdev); | ||
3129 | 3130 | ||
3130 | return hdev; | 3131 | return hdev; |
3131 | } | 3132 | } |