Skip to content

Commit 60e7732

Browse files
jhedbergGustavo Padovan
authored andcommitted
Bluetooth: Add LE Local Features reading support
To be able to make the appropriate decisions for some LE procedures we need to know the LE features that the local controller supports. Therefore, it's important to have the LE Read Local Supported Features HCI comand as part of the HCI init sequence. 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>
1 parent 5d0846d commit 60e7732

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎include/net/bluetooth/hci.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,12 @@ struct hci_rp_le_read_buffer_size {
943943
__u8 le_max_pkt;
944944
} __packed;
945945

946+
#define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003
947+
struct hci_rp_le_read_local_features {
948+
__u8 status;
949+
__u8 features[8];
950+
} __packed;
951+
946952
#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
947953
struct hci_rp_le_read_adv_tx_power {
948954
__u8 status;

‎include/net/bluetooth/hci_core.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ struct hci_dev {
152152
__u8 minor_class;
153153
__u8 features[8];
154154
__u8 host_features[8];
155+
__u8 le_features[8];
155156
__u8 commands[64];
156157
__u8 hci_ver;
157158
__u16 hci_rev;

‎net/bluetooth/hci_event.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,9 @@ static void le_setup(struct hci_dev *hdev)
609609
/* Read LE Buffer Size */
610610
hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);
611611

612+
/* Read LE Local Supported Features */
613+
hci_send_cmd(hdev, HCI_OP_LE_READ_LOCAL_FEATURES, 0, NULL);
614+
612615
/* Read LE Advertising Channel TX Power */
613616
hci_send_cmd(hdev, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
614617
}
@@ -1090,6 +1093,19 @@ static void hci_cc_le_read_buffer_size(struct hci_dev *hdev,
10901093
hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status);
10911094
}
10921095

1096+
static void hci_cc_le_read_local_features(struct hci_dev *hdev,
1097+
struct sk_buff *skb)
1098+
{
1099+
struct hci_rp_le_read_local_features *rp = (void *) skb->data;
1100+
1101+
BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
1102+
1103+
if (!rp->status)
1104+
memcpy(hdev->le_features, rp->features, 8);
1105+
1106+
hci_req_complete(hdev, HCI_OP_LE_READ_LOCAL_FEATURES, rp->status);
1107+
}
1108+
10931109
static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev,
10941110
struct sk_buff *skb)
10951111
{
@@ -2628,6 +2644,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
26282644
hci_cc_le_read_buffer_size(hdev, skb);
26292645
break;
26302646

2647+
case HCI_OP_LE_READ_LOCAL_FEATURES:
2648+
hci_cc_le_read_local_features(hdev, skb);
2649+
break;
2650+
26312651
case HCI_OP_LE_READ_ADV_TX_POWER:
26322652
hci_cc_le_read_adv_tx_power(hdev, skb);
26332653
break;

0 commit comments

Comments
 (0)