diff options
| author | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-17 08:00:52 -0400 |
|---|---|---|
| committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-04-17 23:26:25 -0400 |
| commit | d2c5d77fff6ac0f43fc36f4fde020f726f773c1d (patch) | |
| tree | 17219324bd7af41a4df3edc194f020c80777eab7 | |
| parent | cad718ed2f6fd204b2c5cac6b611fc3fcde7b183 (diff) | |
Bluetooth: Add reading of all local feature pages
With the introduction of CSA4 there is now also a features page number 2
available. This patch increments the maximum supported page number to 2
and adds code for reading all available pages (as long as we have
support for them - indicated by HCI_MAX_PAGES).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 3 | ||||
| -rw-r--r-- | net/bluetooth/hci_core.c | 10 | ||||
| -rw-r--r-- | net/bluetooth/hci_event.c | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 26822967e29c..80d718a9b31f 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -134,7 +134,7 @@ struct amp_assoc { | |||
| 134 | __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; | 134 | __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | #define HCI_MAX_PAGES 2 | 137 | #define HCI_MAX_PAGES 3 |
| 138 | 138 | ||
| 139 | #define NUM_REASSEMBLY 4 | 139 | #define NUM_REASSEMBLY 4 |
| 140 | struct hci_dev { | 140 | struct hci_dev { |
| @@ -153,6 +153,7 @@ struct hci_dev { | |||
| 153 | __u8 dev_class[3]; | 153 | __u8 dev_class[3]; |
| 154 | __u8 major_class; | 154 | __u8 major_class; |
| 155 | __u8 minor_class; | 155 | __u8 minor_class; |
| 156 | __u8 max_page; | ||
| 156 | __u8 features[HCI_MAX_PAGES][8]; | 157 | __u8 features[HCI_MAX_PAGES][8]; |
| 157 | __u8 le_features[8]; | 158 | __u8 le_features[8]; |
| 158 | __u8 le_white_list_size; | 159 | __u8 le_white_list_size; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9570358adb77..e246d3782ac2 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
| @@ -589,6 +589,7 @@ static void hci_set_le_support(struct hci_request *req) | |||
| 589 | static void hci_init3_req(struct hci_request *req, unsigned long opt) | 589 | static void hci_init3_req(struct hci_request *req, unsigned long opt) |
| 590 | { | 590 | { |
| 591 | struct hci_dev *hdev = req->hdev; | 591 | struct hci_dev *hdev = req->hdev; |
| 592 | u8 p; | ||
| 592 | 593 | ||
| 593 | if (hdev->commands[5] & 0x10) | 594 | if (hdev->commands[5] & 0x10) |
| 594 | hci_setup_link_policy(req); | 595 | hci_setup_link_policy(req); |
| @@ -597,6 +598,15 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) | |||
| 597 | hci_set_le_support(req); | 598 | hci_set_le_support(req); |
| 598 | hci_update_ad(req); | 599 | hci_update_ad(req); |
| 599 | } | 600 | } |
| 601 | |||
| 602 | /* Read features beyond page 1 if available */ | ||
| 603 | for (p = 2; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { | ||
| 604 | struct hci_cp_read_local_ext_features cp; | ||
| 605 | |||
| 606 | cp.page = p; | ||
| 607 | hci_req_add(req, HCI_OP_READ_LOCAL_EXT_FEATURES, | ||
| 608 | sizeof(cp), &cp); | ||
| 609 | } | ||
| 600 | } | 610 | } |
| 601 | 611 | ||
| 602 | static int __hci_init(struct hci_dev *hdev) | 612 | static int __hci_init(struct hci_dev *hdev) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 8adc3915ece4..3b2c0e07b25b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -544,6 +544,8 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev, | |||
| 544 | if (rp->status) | 544 | if (rp->status) |
| 545 | return; | 545 | return; |
| 546 | 546 | ||
| 547 | hdev->max_page = rp->max_page; | ||
| 548 | |||
| 547 | if (rp->page < HCI_MAX_PAGES) | 549 | if (rp->page < HCI_MAX_PAGES) |
| 548 | memcpy(hdev->features[rp->page], rp->features, 8); | 550 | memcpy(hdev->features[rp->page], rp->features, 8); |
| 549 | } | 551 | } |
