[PATCH v2 8/8] emulator: Return error for ext adv feature not supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

This return an error if LE Set Extended Advertising Enable is used with
unsupported features.
---
 emulator/btdev.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 42276a2ce..a36493346 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -3760,8 +3760,19 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		if (btdev->le_adv_enable == lseae->enable)
 			status = BT_HCI_ERR_COMMAND_DISALLOWED;
 		else {
-			btdev->le_adv_enable = lseae->enable;
-			status = BT_HCI_ERR_SUCCESS;
+			const struct bt_hci_cmd_ext_adv_set *eas;
+
+			if (lseae->num_of_sets) {
+				eas = data + sizeof(*lseae);
+				if (eas->duration || lseae->num_of_sets > 1)
+					status = BT_HCI_ERR_INVALID_PARAMETERS;
+				else
+					status = BT_HCI_ERR_SUCCESS;
+			} else
+				status = BT_HCI_ERR_SUCCESS;
+
+			if (status == BT_HCI_ERR_SUCCESS)
+				btdev->le_adv_enable = lseae->enable;
 		}
 		cmd_complete(btdev, opcode, &status, sizeof(status));
 		if (status == BT_HCI_ERR_SUCCESS && btdev->le_adv_enable)
-- 
2.26.2




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux