summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-03-08 17:58:40 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-03-08 17:58:40 -0800
commit8e1892cc9217afcb82fd5ab50cfcbbe7b69b35ac (patch)
treebd7419743dfc015e8aeea1030f0a36f246be23e8 /emulator
parentb69b5736c8a1f52b3f92f44ea1ed52e558cba7fb (diff)
downloadbluez-8e1892cc9217afcb82fd5ab50cfcbbe7b69b35ac.tar.gz
btdev: Fix response to LE Set Extended Advertising Parameters
The response should both the status and TX Power regardless if the command succeeds or not.
Diffstat (limited to 'emulator')
-rw-r--r--emulator/btdev.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 6834ec1c2..0651a28e2 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -4671,7 +4671,8 @@ static int cmd_set_ext_adv_params(struct btdev *dev, const void *data,
const struct bt_hci_cmd_le_set_ext_adv_params *cmd = data;
struct bt_hci_rsp_le_set_ext_adv_params rsp;
struct le_ext_adv *ext_adv;
- uint8_t status;
+
+ memset(&rsp, 0, sizeof(rsp));
/* Check if Ext Adv is already existed */
ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle,
@@ -4679,26 +4680,26 @@ static int cmd_set_ext_adv_params(struct btdev *dev, const void *data,
if (!ext_adv) {
/* No more than maximum number */
if (queue_length(dev->le_ext_adv) >= MAX_EXT_ADV_SETS) {
- status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
+ rsp.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- &status, sizeof(status));
+ &rsp, sizeof(rsp));
return 0;
}
/* Create new set */
ext_adv = le_ext_adv_new(dev, cmd->handle);
if (!ext_adv) {
- status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
+ rsp.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- &status, sizeof(status));
+ &rsp, sizeof(rsp));
return 0;
}
}
if (ext_adv->enable) {
- status = BT_HCI_ERR_COMMAND_DISALLOWED;
- cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, &status,
- sizeof(status));
+ rsp.status = BT_HCI_ERR_COMMAND_DISALLOWED;
+ cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, &rsp,
+ sizeof(rsp));
return 0;
}