diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 12 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 4 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 39 |
3 files changed, 55 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 6933766e7215..58c5930dea60 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -1087,6 +1087,18 @@ struct hci_rp_read_rssi { | |||
1087 | __s8 rssi; | 1087 | __s8 rssi; |
1088 | } __packed; | 1088 | } __packed; |
1089 | 1089 | ||
1090 | #define HCI_OP_READ_CLOCK 0x1407 | ||
1091 | struct hci_cp_read_clock { | ||
1092 | __le16 handle; | ||
1093 | __u8 which; | ||
1094 | } __packed; | ||
1095 | struct hci_rp_read_clock { | ||
1096 | __u8 status; | ||
1097 | __le16 handle; | ||
1098 | __le32 clock; | ||
1099 | __le16 accuracy; | ||
1100 | } __packed; | ||
1101 | |||
1090 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 | 1102 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 |
1091 | struct hci_rp_read_local_amp_info { | 1103 | struct hci_rp_read_local_amp_info { |
1092 | __u8 status; | 1104 | __u8 status; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ca2a99807615..0906990dedd8 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -207,6 +207,7 @@ struct hci_dev { | |||
207 | __u16 conn_info_min_age; | 207 | __u16 conn_info_min_age; |
208 | __u16 conn_info_max_age; | 208 | __u16 conn_info_max_age; |
209 | __u8 ssp_debug_mode; | 209 | __u8 ssp_debug_mode; |
210 | __u32 clock; | ||
210 | 211 | ||
211 | __u16 devid_source; | 212 | __u16 devid_source; |
212 | __u16 devid_vendor; | 213 | __u16 devid_vendor; |
@@ -388,6 +389,9 @@ struct hci_conn { | |||
388 | __s8 max_tx_power; | 389 | __s8 max_tx_power; |
389 | unsigned long flags; | 390 | unsigned long flags; |
390 | 391 | ||
392 | __u32 clock; | ||
393 | __u16 clock_accuracy; | ||
394 | |||
391 | unsigned long conn_info_timestamp; | 395 | unsigned long conn_info_timestamp; |
392 | 396 | ||
393 | __u8 remote_cap; | 397 | __u8 remote_cap; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 7a23324eac39..315d615ca3f9 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -721,6 +721,41 @@ static void hci_cc_read_data_block_size(struct hci_dev *hdev, | |||
721 | hdev->block_cnt, hdev->block_len); | 721 | hdev->block_cnt, hdev->block_len); |
722 | } | 722 | } |
723 | 723 | ||
724 | static void hci_cc_read_clock(struct hci_dev *hdev, struct sk_buff *skb) | ||
725 | { | ||
726 | struct hci_rp_read_clock *rp = (void *) skb->data; | ||
727 | struct hci_cp_read_clock *cp; | ||
728 | struct hci_conn *conn; | ||
729 | |||
730 | BT_DBG("%s", hdev->name); | ||
731 | |||
732 | if (skb->len < sizeof(*rp)) | ||
733 | return; | ||
734 | |||
735 | if (rp->status) | ||
736 | return; | ||
737 | |||
738 | hci_dev_lock(hdev); | ||
739 | |||
740 | cp = hci_sent_cmd_data(hdev, HCI_OP_READ_CLOCK); | ||
741 | if (!cp) | ||
742 | goto unlock; | ||
743 | |||
744 | if (cp->which == 0x00) { | ||
745 | hdev->clock = le32_to_cpu(rp->clock); | ||
746 | goto unlock; | ||
747 | } | ||
748 | |||
749 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); | ||
750 | if (conn) { | ||
751 | conn->clock = le32_to_cpu(rp->clock); | ||
752 | conn->clock_accuracy = le16_to_cpu(rp->accuracy); | ||
753 | } | ||
754 | |||
755 | unlock: | ||
756 | hci_dev_unlock(hdev); | ||
757 | } | ||
758 | |||
724 | static void hci_cc_read_local_amp_info(struct hci_dev *hdev, | 759 | static void hci_cc_read_local_amp_info(struct hci_dev *hdev, |
725 | struct sk_buff *skb) | 760 | struct sk_buff *skb) |
726 | { | 761 | { |
@@ -2597,6 +2632,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2597 | hci_cc_read_local_amp_info(hdev, skb); | 2632 | hci_cc_read_local_amp_info(hdev, skb); |
2598 | break; | 2633 | break; |
2599 | 2634 | ||
2635 | case HCI_OP_READ_CLOCK: | ||
2636 | hci_cc_read_clock(hdev, skb); | ||
2637 | break; | ||
2638 | |||
2600 | case HCI_OP_READ_LOCAL_AMP_ASSOC: | 2639 | case HCI_OP_READ_LOCAL_AMP_ASSOC: |
2601 | hci_cc_read_local_amp_assoc(hdev, skb); | 2640 | hci_cc_read_local_amp_assoc(hdev, skb); |
2602 | break; | 2641 | break; |