aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2014-05-09 15:35:28 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-05-09 17:16:42 -0400
commit5a134faeef82b46ff4ad244d11d8c6be41679834 (patch)
tree5e222abbed314e7a17a1cc67f8be90451577b75c /net/bluetooth/hci_event.c
parentb75cf9cd162244fe1c29691a21acfb1e657101a7 (diff)
Bluetooth: Store TX power level for connection
This patch adds support to store local TX power level for connection when reply for HCI_Read_Transmit_Power_Level is received. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 2bb0053d4c45..fa614e3430a7 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1264,6 +1264,30 @@ static void hci_cc_read_rssi(struct hci_dev *hdev, struct sk_buff *skb)
1264 hci_dev_unlock(hdev); 1264 hci_dev_unlock(hdev);
1265} 1265}
1266 1266
1267static void hci_cc_read_tx_power(struct hci_dev *hdev, struct sk_buff *skb)
1268{
1269 struct hci_cp_read_tx_power *sent;
1270 struct hci_rp_read_tx_power *rp = (void *) skb->data;
1271 struct hci_conn *conn;
1272
1273 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
1274
1275 if (rp->status)
1276 return;
1277
1278 sent = hci_sent_cmd_data(hdev, HCI_OP_READ_TX_POWER);
1279 if (!sent)
1280 return;
1281
1282 hci_dev_lock(hdev);
1283
1284 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle));
1285 if (conn && sent->type == 0x00)
1286 conn->tx_power = rp->tx_power;
1287
1288 hci_dev_unlock(hdev);
1289}
1290
1267static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) 1291static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
1268{ 1292{
1269 BT_DBG("%s status 0x%2.2x", hdev->name, status); 1293 BT_DBG("%s status 0x%2.2x", hdev->name, status);
@@ -2660,6 +2684,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2660 hci_cc_read_rssi(hdev, skb); 2684 hci_cc_read_rssi(hdev, skb);
2661 break; 2685 break;
2662 2686
2687 case HCI_OP_READ_TX_POWER:
2688 hci_cc_read_tx_power(hdev, skb);
2689 break;
2690
2663 default: 2691 default:
2664 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); 2692 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode);
2665 break; 2693 break;