Diff between 611d1d2ca65288b84a5423e86f9b34f4d9b28ce9 and 4c4726d1d57c1588266491a946fe9308e6e84002

Changed Files

File Additions Deletions Status
emulator/btdev.c +19 -0 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index a06c296..8a4b34d 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -89,6 +89,10 @@ struct btdev {
 	uint8_t  le_simultaneous;
 	uint8_t  le_event_mask[8];
 	uint8_t  le_adv_data[31];
+
+	uint16_t sync_train_interval;
+	uint32_t sync_train_timeout;
+	uint8_t  sync_train_service_data;
 };
 
 #define MAX_BTDEV_ENTRIES 16
@@ -299,6 +303,10 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
 	btdev->page_scan_window = 0x0012;
 	btdev->page_scan_type = 0x00;
 
+	btdev->sync_train_interval = 0x0080;
+	btdev->sync_train_timeout = 0x0002ee00;
+	btdev->sync_train_service_data = 0x00;
+
 	btdev->acl_mtu = 192;
 	btdev->acl_max_pkt = 1;
 
@@ -738,6 +746,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 	struct bt_hci_rsp_read_simple_pairing_mode rspm;
 	struct bt_hci_rsp_read_inquiry_resp_tx_power rirtp;
 	struct bt_hci_rsp_read_le_host_supported rlhs;
+	struct bt_hci_rsp_read_sync_train_params rstp;
 	struct bt_hci_rsp_read_local_version rlv;
 	struct bt_hci_rsp_read_local_commands rlc;
 	struct bt_hci_rsp_read_local_features rlf;
@@ -1161,6 +1170,16 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		cmd_complete(btdev, opcode, &status, sizeof(status));
 		break;
 
+	case BT_HCI_CMD_READ_SYNC_TRAIN_PARAMS:
+		if (btdev->type != BTDEV_TYPE_BREDRLE)
+			goto unsupported;
+		rstp.status = BT_HCI_ERR_SUCCESS;
+		rstp.interval = cpu_to_le16(btdev->sync_train_interval);
+		rstp.timeout = cpu_to_le32(btdev->sync_train_timeout);
+		rstp.service_data = btdev->sync_train_service_data;
+		cmd_complete(btdev, opcode, &rstp, sizeof(rstp));
+		break;
+
 	case BT_HCI_CMD_READ_LOCAL_VERSION:
 		rlv.status = BT_HCI_ERR_SUCCESS;
 		rlv.hci_ver = btdev->version;