diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 11 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_conn.c | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 28 |
4 files changed, 41 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index ad2ecc92380d..16587dcd6a91 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -1054,6 +1054,17 @@ struct hci_cp_write_page_scan_activity { | |||
1054 | __le16 window; | 1054 | __le16 window; |
1055 | } __packed; | 1055 | } __packed; |
1056 | 1056 | ||
1057 | #define HCI_OP_READ_TX_POWER 0x0c2d | ||
1058 | struct hci_cp_read_tx_power { | ||
1059 | __le16 handle; | ||
1060 | __u8 type; | ||
1061 | } __packed; | ||
1062 | struct hci_rp_read_tx_power { | ||
1063 | __u8 status; | ||
1064 | __le16 handle; | ||
1065 | __s8 tx_power; | ||
1066 | } __packed; | ||
1067 | |||
1057 | #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 | 1068 | #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 |
1058 | struct hci_rp_read_page_scan_type { | 1069 | struct hci_rp_read_page_scan_type { |
1059 | __u8 status; | 1070 | __u8 status; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 0318d5263837..211bad6a3366 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -375,6 +375,7 @@ struct hci_conn { | |||
375 | __u16 le_conn_min_interval; | 375 | __u16 le_conn_min_interval; |
376 | __u16 le_conn_max_interval; | 376 | __u16 le_conn_max_interval; |
377 | __s8 rssi; | 377 | __s8 rssi; |
378 | __s8 tx_power; | ||
378 | unsigned long flags; | 379 | unsigned long flags; |
379 | 380 | ||
380 | __u8 remote_cap; | 381 | __u8 remote_cap; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 55a174317925..74b368bfe102 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -407,6 +407,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
407 | conn->io_capability = hdev->io_capability; | 407 | conn->io_capability = hdev->io_capability; |
408 | conn->remote_auth = 0xff; | 408 | conn->remote_auth = 0xff; |
409 | conn->key_type = 0xff; | 409 | conn->key_type = 0xff; |
410 | conn->tx_power = HCI_TX_POWER_INVALID; | ||
410 | 411 | ||
411 | set_bit(HCI_CONN_POWER_SAVE, &conn->flags); | 412 | set_bit(HCI_CONN_POWER_SAVE, &conn->flags); |
412 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; | 413 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; |
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 | ||
1267 | static 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 | |||
1267 | static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) | 1291 | static 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; |