Commit 5d4e7e8d authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan

Bluetooth: Add synchronization train parameters reading support

This patch adds support for reading the synchronization train parameters
for controllers that support the feature. Since the feature is
detectable through the local features page 2, which is retreived only in
stage 3 of the HCI init sequence, there is no other option than to add a
fourth stage to the init sequence.

For now the patch doesn't yet add storing of the parameters, but it is
nevertheless convenient to have around to see what kind of parameters
various controllers use by default (analyzable e.g. with the btmon user
space tool).
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent e793dcf0
...@@ -835,6 +835,8 @@ struct hci_cp_write_le_host_supported { ...@@ -835,6 +835,8 @@ struct hci_cp_write_le_host_supported {
__u8 simul; __u8 simul;
} __packed; } __packed;
#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
#define HCI_OP_READ_LOCAL_VERSION 0x1001 #define HCI_OP_READ_LOCAL_VERSION 0x1001
struct hci_rp_read_local_version { struct hci_rp_read_local_version {
__u8 status; __u8 status;
......
...@@ -648,6 +648,15 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) ...@@ -648,6 +648,15 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
} }
} }
static void hci_init4_req(struct hci_request *req, unsigned long opt)
{
struct hci_dev *hdev = req->hdev;
/* Check for Synchronization Train support */
if (hdev->features[2][0] & 0x04)
hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL);
}
static int __hci_init(struct hci_dev *hdev) static int __hci_init(struct hci_dev *hdev)
{ {
int err; int err;
...@@ -667,7 +676,11 @@ static int __hci_init(struct hci_dev *hdev) ...@@ -667,7 +676,11 @@ static int __hci_init(struct hci_dev *hdev)
if (err < 0) if (err < 0)
return err; return err;
return __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT); err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT);
if (err < 0)
return err;
return __hci_req_sync(hdev, hci_init4_req, 0, HCI_INIT_TIMEOUT);
} }
static void hci_scan_req(struct hci_request *req, unsigned long opt) static void hci_scan_req(struct hci_request *req, unsigned long opt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment