linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 5/6] emulator: Add support for LE Setup ISO Data Path
Date: Thu, 23 Apr 2020 14:55:00 -0700	[thread overview]
Message-ID: <20200423215501.427266-5-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This implements support for LE Setup ISO Data Path command.
---
 emulator/btdev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index cd355e73a..1b3ad6442 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -148,6 +148,7 @@ struct btdev {
 		struct bt_hci_cmd_le_set_cig_params params;
 		struct bt_hci_cis_params cis;
 	} __attribute__ ((packed)) le_cig;
+	uint8_t  le_iso_path[2];
 
 	uint8_t le_local_sk256[32];
 
@@ -2418,6 +2419,38 @@ static void btdev_reset(struct btdev *btdev)
 	btdev->le_adv_enable		= 0x00;
 }
 
+static void le_setup_iso_path(struct btdev *dev, uint16_t handle,
+					uint8_t dir, uint8_t path)
+{
+	uint8_t status = BT_HCI_ERR_SUCCESS;
+
+	if (!dev->conn || handle != ISO_HANDLE) {
+		status = BT_HCI_ERR_UNKNOWN_CONN_ID;
+		goto done;
+	}
+
+	/* Only support HCI or disabled paths */
+	if (path && path != 0xff) {
+		status = BT_HCI_ERR_INVALID_PARAMETERS;
+		goto done;
+	}
+
+	switch (dir) {
+	case 0x00:
+		dev->le_iso_path[0] = path;
+		break;
+	case 0x01:
+		dev->le_iso_path[1] = path;
+		break;
+	default:
+		status = BT_HCI_ERR_INVALID_PARAMETERS;
+	}
+
+done:
+	cmd_complete(dev, BT_HCI_CMD_LE_SETUP_ISO_PATH, &status,
+						sizeof(status));
+}
+
 static void default_cmd(struct btdev *btdev, uint16_t opcode,
 						const void *data, uint8_t len)
 {
@@ -2541,6 +2574,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		struct bt_hci_rsp_le_set_cig_params params;
 		uint16_t handle;
 	} __attribute__ ((packed)) lscp;
+	struct bt_hci_cmd_le_setup_iso_path *lesip;
 	uint8_t status, page;
 
 	switch (opcode) {
@@ -3862,6 +3896,17 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 
 		break;
 
+	case BT_HCI_CMD_LE_SETUP_ISO_PATH:
+		if (btdev->type != BTDEV_TYPE_BREDRLE52)
+			goto unsupported;
+
+		lesip = (void *)data;
+
+		le_setup_iso_path(btdev, le16_to_cpu(lesip->handle),
+					lesip->direction, lesip->path);
+
+		break;
+
 	case BT_HCI_CMD_LE_SET_HOST_FEATURE:
 		if (btdev->type != BTDEV_TYPE_BREDRLE52)
 			goto unsupported;
-- 
2.25.3


  parent reply	other threads:[~2020-04-23 21:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 21:54 [PATCH v2 1/6] monitor: Remove use of base defines for 5.2 Luiz Augusto von Dentz
2020-04-23 21:54 ` [PATCH v2 2/6] monitor: Add decoding support for HCI LE Set Host Feature Luiz Augusto von Dentz
2020-04-23 21:54 ` [PATCH v2 3/6] emulator: Fix version number of ISO related features Luiz Augusto von Dentz
2020-04-23 21:54 ` [PATCH v2 4/6] emulator: Add support for LE Set Host Feature Luiz Augusto von Dentz
2020-04-23 21:55 ` Luiz Augusto von Dentz [this message]
2020-04-23 21:55 ` [PATCH v2 6/6] emulator: Add support for LE Remove ISO Data Path Luiz Augusto von Dentz
2020-04-24 17:50 ` [PATCH v2 1/6] monitor: Remove use of base defines for 5.2 Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200423215501.427266-5-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).