aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-03-15 18:07:11 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-03-18 14:35:02 -0400
commitf332ec6699980e0563408c7bcf1a8a31b825fee1 (patch)
tree3d27ea4481fb2be74c349d6070b9e089fe440e31 /net/bluetooth
parente36a37691e53b54edb78209757fab0dd76c4614f (diff)
Bluetooth: Add reading of page scan parameters
These parameters are related to the "fast connectable" mode that can be changed through the mgmt interface. Not all controllers properly reset these values with HCI_Reset so they need to be read in order to be able to verify whether the values are correct or not before enabling page scan. 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')
-rw-r--r--net/bluetooth/hci_core.c6
-rw-r--r--net/bluetooth/hci_event.c32
2 files changed, 38 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 0ffd35871172..cfcad5423f1c 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -272,6 +272,12 @@ static void bredr_setup(struct hci_request *req)
272 bacpy(&cp.bdaddr, BDADDR_ANY); 272 bacpy(&cp.bdaddr, BDADDR_ANY);
273 cp.delete_all = 0x01; 273 cp.delete_all = 0x01;
274 hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); 274 hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp);
275
276 /* Read page scan parameters */
277 if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) {
278 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
279 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
280 }
275} 281}
276 282
277static void le_setup(struct hci_request *req) 283static void le_setup(struct hci_request *req)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 84edacbc14a1..3c6d0a4f78dc 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -601,6 +601,30 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb)
601 bacpy(&hdev->bdaddr, &rp->bdaddr); 601 bacpy(&hdev->bdaddr, &rp->bdaddr);
602} 602}
603 603
604static void hci_cc_read_page_scan_activity(struct hci_dev *hdev,
605 struct sk_buff *skb)
606{
607 struct hci_rp_read_page_scan_activity *rp = (void *) skb->data;
608
609 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
610
611 if (test_bit(HCI_INIT, &hdev->flags) && !rp->status) {
612 hdev->page_scan_interval = __le16_to_cpu(rp->interval);
613 hdev->page_scan_window = __le16_to_cpu(rp->window);
614 }
615}
616
617static void hci_cc_read_page_scan_type(struct hci_dev *hdev,
618 struct sk_buff *skb)
619{
620 struct hci_rp_read_page_scan_type *rp = (void *) skb->data;
621
622 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
623
624 if (test_bit(HCI_INIT, &hdev->flags) && !rp->status)
625 hdev->page_scan_type = rp->type;
626}
627
604static void hci_cc_read_data_block_size(struct hci_dev *hdev, 628static void hci_cc_read_data_block_size(struct hci_dev *hdev,
605 struct sk_buff *skb) 629 struct sk_buff *skb)
606{ 630{
@@ -2204,6 +2228,14 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2204 hci_cc_read_bd_addr(hdev, skb); 2228 hci_cc_read_bd_addr(hdev, skb);
2205 break; 2229 break;
2206 2230
2231 case HCI_OP_READ_PAGE_SCAN_ACTIVITY:
2232 hci_cc_read_page_scan_activity(hdev, skb);
2233 break;
2234
2235 case HCI_OP_READ_PAGE_SCAN_TYPE:
2236 hci_cc_read_page_scan_type(hdev, skb);
2237 break;
2238
2207 case HCI_OP_READ_DATA_BLOCK_SIZE: 2239 case HCI_OP_READ_DATA_BLOCK_SIZE:
2208 hci_cc_read_data_block_size(hdev, skb); 2240 hci_cc_read_data_block_size(hdev, skb);
2209 break; 2241 break;