diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-19 13:57:49 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-10-24 09:17:17 -0400 |
commit | 8fa19098ebc700f14b0f8d0fb957e7748e14c44b (patch) | |
tree | 488d94f7b05d394b5b29a0a9adae0cf67bbb4cf0 /net/bluetooth | |
parent | e36b04c805e452689d468f9783e5dffa61e38be7 (diff) |
Bluetooth: Read adversiting channel TX power during init sequence
This patch adds the reading of the LE advertising channel TX power to
the HCI init sequence of LE-capable controllers. This data will be used
e.g. for inclusion in the advertising data packets when advertising is
enabled.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_event.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 78f1af52ed81..fd5a51ccb8e4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -594,6 +594,9 @@ static void le_init(struct hci_dev *hdev) | |||
594 | { | 594 | { |
595 | /* Read LE Buffer Size */ | 595 | /* Read LE Buffer Size */ |
596 | hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL); | 596 | hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL); |
597 | |||
598 | /* Read LE Advertising Channel TX Power */ | ||
599 | hci_send_cmd(hdev, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL); | ||
597 | } | 600 | } |
598 | 601 | ||
599 | static void hci_setup(struct hci_dev *hdev) | 602 | static void hci_setup(struct hci_dev *hdev) |
@@ -1073,6 +1076,19 @@ static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, | |||
1073 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); | 1076 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); |
1074 | } | 1077 | } |
1075 | 1078 | ||
1079 | static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, | ||
1080 | struct sk_buff *skb) | ||
1081 | { | ||
1082 | struct hci_rp_le_read_adv_tx_power *rp = (void *) skb->data; | ||
1083 | |||
1084 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
1085 | |||
1086 | if (!rp->status) | ||
1087 | hdev->adv_tx_power = rp->tx_power; | ||
1088 | |||
1089 | hci_req_complete(hdev, HCI_OP_LE_READ_ADV_TX_POWER, rp->status); | ||
1090 | } | ||
1091 | |||
1076 | static void hci_cc_le_set_event_mask(struct hci_dev *hdev, struct sk_buff *skb) | 1092 | static void hci_cc_le_set_event_mask(struct hci_dev *hdev, struct sk_buff *skb) |
1077 | { | 1093 | { |
1078 | __u8 status = *((__u8 *) skb->data); | 1094 | __u8 status = *((__u8 *) skb->data); |
@@ -2505,6 +2521,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2505 | hci_cc_le_read_buffer_size(hdev, skb); | 2521 | hci_cc_le_read_buffer_size(hdev, skb); |
2506 | break; | 2522 | break; |
2507 | 2523 | ||
2524 | case HCI_OP_LE_READ_ADV_TX_POWER: | ||
2525 | hci_cc_le_read_adv_tx_power(hdev, skb); | ||
2526 | break; | ||
2527 | |||
2508 | case HCI_OP_LE_SET_EVENT_MASK: | 2528 | case HCI_OP_LE_SET_EVENT_MASK: |
2509 | hci_cc_le_set_event_mask(hdev, skb); | 2529 | hci_cc_le_set_event_mask(hdev, skb); |
2510 | break; | 2530 | break; |