aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-03-15 18:07:12 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-03-18 14:36:03 -0400
commit4a3ee763ba797e0489b7e9fd8810ae087c2a7504 (patch)
tree241fd2aed7f65300cab2878fb0904379d386a46a /net/bluetooth
parentf332ec6699980e0563408c7bcf1a8a31b825fee1 (diff)
Bluetooth: Update page scan parameters after successful write commands
The page scan parameters (interval, window and type) stored in struct hci_dev should not only be updated after successful reads but also after successful writes. This patch adds the necessary handlers for the write command complete events and updates the stored values through them. 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_event.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3c6d0a4f78dc..138580745c2c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -614,6 +614,25 @@ static void hci_cc_read_page_scan_activity(struct hci_dev *hdev,
614 } 614 }
615} 615}
616 616
617static void hci_cc_write_page_scan_activity(struct hci_dev *hdev,
618 struct sk_buff *skb)
619{
620 u8 status = *((u8 *) skb->data);
621 struct hci_cp_write_page_scan_activity *sent;
622
623 BT_DBG("%s status 0x%2.2x", hdev->name, status);
624
625 if (status)
626 return;
627
628 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY);
629 if (!sent)
630 return;
631
632 hdev->page_scan_interval = __le16_to_cpu(sent->interval);
633 hdev->page_scan_window = __le16_to_cpu(sent->window);
634}
635
617static void hci_cc_read_page_scan_type(struct hci_dev *hdev, 636static void hci_cc_read_page_scan_type(struct hci_dev *hdev,
618 struct sk_buff *skb) 637 struct sk_buff *skb)
619{ 638{
@@ -625,6 +644,22 @@ static void hci_cc_read_page_scan_type(struct hci_dev *hdev,
625 hdev->page_scan_type = rp->type; 644 hdev->page_scan_type = rp->type;
626} 645}
627 646
647static void hci_cc_write_page_scan_type(struct hci_dev *hdev,
648 struct sk_buff *skb)
649{
650 u8 status = *((u8 *) skb->data);
651 u8 *type;
652
653 BT_DBG("%s status 0x%2.2x", hdev->name, status);
654
655 if (status)
656 return;
657
658 type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE);
659 if (type)
660 hdev->page_scan_type = *type;
661}
662
628static void hci_cc_read_data_block_size(struct hci_dev *hdev, 663static void hci_cc_read_data_block_size(struct hci_dev *hdev,
629 struct sk_buff *skb) 664 struct sk_buff *skb)
630{ 665{
@@ -2232,10 +2267,18 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2232 hci_cc_read_page_scan_activity(hdev, skb); 2267 hci_cc_read_page_scan_activity(hdev, skb);
2233 break; 2268 break;
2234 2269
2270 case HCI_OP_WRITE_PAGE_SCAN_ACTIVITY:
2271 hci_cc_write_page_scan_activity(hdev, skb);
2272 break;
2273
2235 case HCI_OP_READ_PAGE_SCAN_TYPE: 2274 case HCI_OP_READ_PAGE_SCAN_TYPE:
2236 hci_cc_read_page_scan_type(hdev, skb); 2275 hci_cc_read_page_scan_type(hdev, skb);
2237 break; 2276 break;
2238 2277
2278 case HCI_OP_WRITE_PAGE_SCAN_TYPE:
2279 hci_cc_write_page_scan_type(hdev, skb);
2280 break;
2281
2239 case HCI_OP_READ_DATA_BLOCK_SIZE: 2282 case HCI_OP_READ_DATA_BLOCK_SIZE:
2240 hci_cc_read_data_block_size(hdev, skb); 2283 hci_cc_read_data_block_size(hdev, skb);
2241 break; 2284 break;