aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-03-11 22:27:21 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-08 23:41:30 -0400
commit91c4e9b1ac595f83681c9a9de691e0f30eeafb44 (patch)
treea9917d121f19adafb81abf4b7f264f185f60b736
parent6935e0f5181644201894f0b7fbe3d8910c18af05 (diff)
Bluetooth: Add TX power tag to EIR data
The Inquiry Response TX power tag should be added to the Extended Inquiry Data (EIR) as well. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--include/net/bluetooth/hci.h4
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_event.c9
-rw-r--r--net/bluetooth/mgmt.c9
4 files changed, 20 insertions, 3 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index d47e523c9d83..3edb3e759ffe 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -717,6 +717,10 @@ struct hci_rp_read_local_oob_data {
717} __packed; 717} __packed;
718 718
719#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 719#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
720struct hci_rp_read_inq_rsp_tx_power {
721 __u8 status;
722 __s8 tx_power;
723} __packed;
720 724
721#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 725#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
722struct hci_rp_read_flow_control_mode { 726struct hci_rp_read_flow_control_mode {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c80a9684a144..ce09bf1592e2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -158,6 +158,7 @@ struct hci_dev {
158 __u16 lmp_subver; 158 __u16 lmp_subver;
159 __u16 voice_setting; 159 __u16 voice_setting;
160 __u8 io_capability; 160 __u8 io_capability;
161 __s8 inq_tx_power;
161 162
162 __u16 pkt_type; 163 __u16 pkt_type;
163 __u16 esco_type; 164 __u16 esco_type;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 50ff9a989531..75f01d1b126f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -887,11 +887,14 @@ static void hci_cc_write_inquiry_mode(struct hci_dev *hdev,
887static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, 887static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev,
888 struct sk_buff *skb) 888 struct sk_buff *skb)
889{ 889{
890 __u8 status = *((__u8 *) skb->data); 890 struct hci_rp_read_inq_rsp_tx_power *rp = (void *) skb->data;
891 891
892 BT_DBG("%s status 0x%x", hdev->name, status); 892 BT_DBG("%s status 0x%x", hdev->name, rp->status);
893
894 if (!rp->status)
895 hdev->inq_tx_power = rp->tx_power;
893 896
894 hci_req_complete(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, status); 897 hci_req_complete(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, rp->status);
895} 898}
896 899
897static void hci_cc_set_event_flt(struct hci_dev *hdev, struct sk_buff *skb) 900static void hci_cc_set_event_flt(struct hci_dev *hdev, struct sk_buff *skb)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4a2fb06226fc..02b89e299ff8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -479,6 +479,15 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
479 ptr += (name_len + 2); 479 ptr += (name_len + 2);
480 } 480 }
481 481
482 if (hdev->inq_tx_power) {
483 ptr[0] = 2;
484 ptr[1] = EIR_TX_POWER;
485 ptr[2] = (u8) hdev->inq_tx_power;
486
487 eir_len += 3;
488 ptr += 3;
489 }
490
482 memset(uuid16_list, 0, sizeof(uuid16_list)); 491 memset(uuid16_list, 0, sizeof(uuid16_list));
483 492
484 /* Group all UUID16 types */ 493 /* Group all UUID16 types */