diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2014-05-08 09:32:08 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-05-08 11:01:57 -0400 |
commit | 5ae76a94150c86a6e0ee84eb74e7f7e1909b8d39 (patch) | |
tree | 4abcdb2d73127eabb1f6d48af20b37cb7725e69b /net | |
parent | 38e4a915663f3f3c03b753d90a34fbb6164ea55d (diff) |
Bluetooth: Store RSSI for connection
This patch adds support to store RSSI for connection when reply for
HCI_Read_RSSI is received.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_event.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 07c37d0cecb2..2bb0053d4c45 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1245,6 +1245,25 @@ static void hci_cc_write_remote_amp_assoc(struct hci_dev *hdev, | |||
1245 | amp_write_rem_assoc_continue(hdev, rp->phy_handle); | 1245 | amp_write_rem_assoc_continue(hdev, rp->phy_handle); |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | static void hci_cc_read_rssi(struct hci_dev *hdev, struct sk_buff *skb) | ||
1249 | { | ||
1250 | struct hci_rp_read_rssi *rp = (void *) skb->data; | ||
1251 | struct hci_conn *conn; | ||
1252 | |||
1253 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
1254 | |||
1255 | if (rp->status) | ||
1256 | return; | ||
1257 | |||
1258 | hci_dev_lock(hdev); | ||
1259 | |||
1260 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); | ||
1261 | if (conn) | ||
1262 | conn->rssi = rp->rssi; | ||
1263 | |||
1264 | hci_dev_unlock(hdev); | ||
1265 | } | ||
1266 | |||
1248 | static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) | 1267 | static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) |
1249 | { | 1268 | { |
1250 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | 1269 | BT_DBG("%s status 0x%2.2x", hdev->name, status); |
@@ -2637,6 +2656,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2637 | hci_cc_write_remote_amp_assoc(hdev, skb); | 2656 | hci_cc_write_remote_amp_assoc(hdev, skb); |
2638 | break; | 2657 | break; |
2639 | 2658 | ||
2659 | case HCI_OP_READ_RSSI: | ||
2660 | hci_cc_read_rssi(hdev, skb); | ||
2661 | break; | ||
2662 | |||
2640 | default: | 2663 | default: |
2641 | BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); | 2664 | BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); |
2642 | break; | 2665 | break; |