diff options
author | Jaganath Kanakkassery <jaganath.k.os@gmail.com> | 2018-07-19 07:39:35 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2018-07-30 07:44:52 -0400 |
commit | 0314f2867fa0c46d0fc1c23c80e7fab9435079df (patch) | |
tree | 0223f6b657a2b031cc7a64c29c7ed1badae92273 /net/bluetooth/hci_event.c | |
parent | 6244691fec4dd0adebca255e60e0ed7ac8155b2e (diff) |
Bluetooth: Implement Set PHY Confguration command
This enables user to set phys which will be used in all subsequent
connections. Also host will use the same in LE scanning as well.
@ MGMT Command: Set PHY Configuration (0x0045) plen 4
Selected PHYs: 0x7fff
BR 1M 1SLOT
BR 1M 3SLOT
BR 1M 5SLOT
EDR 2M 1SLOT
EDR 2M 3SLOT
EDR 2M 5SLOT
EDR 3M 1SLOT
EDR 3M 3SLOT
EDR 3M 5SLOT
LE 1M TX
LE 1M RX
LE 2M TX
LE 2M RX
LE CODED TX
LE CODED RX
< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3
All PHYs preference: 0x00
TX PHYs preference: 0x07
LE 1M
LE 2M
LE Coded
RX PHYs preference: 0x07
LE 1M
LE 2M
LE Coded
> HCI Event: Command Complete (0x0e) plen 4
LE Set Default PHY (0x08|0x0031) ncmd 1
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 3
Set PHY Configuration (0x0045) plen 0
Status: Success (0x00)
@ MGMT Event: PHY Configuration Changed (0x0026) plen 4
Selected PHYs: 0x7fff
BR 1M 1SLOT
BR 1M 3SLOT
BR 1M 5SLOT
EDR 2M 1SLOT
EDR 2M 3SLOT
EDR 2M 5SLOT
EDR 3M 1SLOT
EDR 3M 3SLOT
EDR 3M 5SLOT
LE 1M TX
LE 1M RX
LE 2M TX
LE 2M RX
LE CODED TX
LE CODED RX
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 68192152c23b..694231541a4c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1042,6 +1042,28 @@ static void hci_cc_le_set_random_addr(struct hci_dev *hdev, struct sk_buff *skb) | |||
1042 | hci_dev_unlock(hdev); | 1042 | hci_dev_unlock(hdev); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | static void hci_cc_le_set_default_phy(struct hci_dev *hdev, struct sk_buff *skb) | ||
1046 | { | ||
1047 | __u8 status = *((__u8 *) skb->data); | ||
1048 | struct hci_cp_le_set_default_phy *cp; | ||
1049 | |||
1050 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1051 | |||
1052 | if (status) | ||
1053 | return; | ||
1054 | |||
1055 | cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_DEFAULT_PHY); | ||
1056 | if (!cp) | ||
1057 | return; | ||
1058 | |||
1059 | hci_dev_lock(hdev); | ||
1060 | |||
1061 | hdev->le_tx_def_phys = cp->tx_phys; | ||
1062 | hdev->le_rx_def_phys = cp->rx_phys; | ||
1063 | |||
1064 | hci_dev_unlock(hdev); | ||
1065 | } | ||
1066 | |||
1045 | static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) | 1067 | static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) |
1046 | { | 1068 | { |
1047 | __u8 *sent, status = *((__u8 *) skb->data); | 1069 | __u8 *sent, status = *((__u8 *) skb->data); |
@@ -3163,6 +3185,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, | |||
3163 | hci_cc_le_set_ext_scan_enable(hdev, skb); | 3185 | hci_cc_le_set_ext_scan_enable(hdev, skb); |
3164 | break; | 3186 | break; |
3165 | 3187 | ||
3188 | case HCI_OP_LE_SET_DEFAULT_PHY: | ||
3189 | hci_cc_le_set_default_phy(hdev, skb); | ||
3190 | break; | ||
3191 | |||
3166 | default: | 3192 | default: |
3167 | BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); | 3193 | BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); |
3168 | break; | 3194 | break; |