]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Add TX power tag to EIR data
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 12 Mar 2012 02:27:21 +0000 (19:27 -0700)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 28 Mar 2012 14:39:06 +0000 (11:39 -0300)
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>
include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c
net/bluetooth/mgmt.c

index 344b0f972828f4167393948c4263a628309ca7c6..f87f893f612a4125636e525689b2d6eaf4feff2f 100644 (file)
@@ -716,6 +716,10 @@ struct hci_rp_read_local_oob_data {
 } __packed;
 
 #define HCI_OP_READ_INQ_RSP_TX_POWER   0x0c58
+struct hci_rp_read_inq_rsp_tx_power {
+       __u8     status;
+       __s8     tx_power;
+} __packed;
 
 #define HCI_OP_READ_FLOW_CONTROL_MODE  0x0c66
 struct hci_rp_read_flow_control_mode {
index c2d8c653925a822f062b0ff555179f7ad86950a5..286de1ddb03b14f4da7373478652bc386dd6a821 100644 (file)
@@ -158,6 +158,7 @@ struct hci_dev {
        __u16           lmp_subver;
        __u16           voice_setting;
        __u8            io_capability;
+       __s8            inq_tx_power;
 
        __u16           pkt_type;
        __u16           esco_type;
index 66ffe459e170cdbc96e9f75dd9ce801260412ffb..cfbe3f673a7bcd53049a7fc69c340d743012049e 100644 (file)
@@ -888,11 +888,14 @@ static void hci_cc_write_inquiry_mode(struct hci_dev *hdev,
 static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev,
                                                        struct sk_buff *skb)
 {
-       __u8 status = *((__u8 *) skb->data);
+       struct hci_rp_read_inq_rsp_tx_power *rp = (void *) skb->data;
 
-       BT_DBG("%s status 0x%x", hdev->name, status);
+       BT_DBG("%s status 0x%x", hdev->name, rp->status);
+
+       if (!rp->status)
+               hdev->inq_tx_power = rp->tx_power;
 
-       hci_req_complete(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, status);
+       hci_req_complete(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, rp->status);
 }
 
 static void hci_cc_set_event_flt(struct hci_dev *hdev, struct sk_buff *skb)
index bcd632d629c62be844914e799ac75bf74d151e82..564cd7b73e97a1465021929ad4188cab22037675 100644 (file)
@@ -479,6 +479,15 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
                ptr += (name_len + 2);
        }
 
+       if (hdev->inq_tx_power) {
+               ptr[0] = 2;
+               ptr[1] = EIR_TX_POWER;
+               ptr[2] = (u8) hdev->inq_tx_power;
+
+               eir_len += 3;
+               ptr += 3;
+       }
+
        memset(uuid16_list, 0, sizeof(uuid16_list));
 
        /* Group all UUID16 types */