Return invalid parameters error if reserved value is used.
---
emulator/btdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 2a0c673..a2a2e50 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -2393,8 +2393,12 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
case BT_HCI_CMD_SET_HOST_FLOW_CONTROL:
shfc = data;
- btdev->host_flow_control = shfc->enable;
- status = BT_HCI_ERR_SUCCESS;
+ if (shfc->enable > 0x03) {
+ status = BT_HCI_ERR_INVALID_PARAMETERS;
+ } else {
+ btdev->host_flow_control = shfc->enable;
+ status = BT_HCI_ERR_SUCCESS;
+ }
cmd_complete(btdev, opcode, &status, sizeof(status));
break;
--
1.9.3
Hi Szymon,
On Wed, May 20, 2015, Szymon Janc wrote:
> Return invalid parameters error if reserved value is used.
> ---
> emulator/btdev.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
All three patches have been applied. Thanks.
Bonus points if you also implement the missing HCI commands in
emulator/le.c :)
Johan
The Host_Number_Of_Completed_Packets command is a special command in
the sense that no event is normally generated after the command
has completed.
---
emulator/btdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index d47d50e..af93933 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -2402,6 +2402,12 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
cmd_complete(btdev, opcode, &status, sizeof(status));
break;
+ case BT_HCI_CMD_HOST_NUM_COMPLETED_PACKETS:
+ /* This command is special in the sense that no event is
+ * normally generated after the command has completed.
+ */
+ break;
+
case BT_HCI_CMD_READ_NUM_SUPPORTED_IAC:
if (btdev->type == BTDEV_TYPE_LE)
goto unsupported;
--
1.9.3
Commands codes in switch-case are kept in ascending order.
---
emulator/btdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index a2a2e50..d47d50e 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -2386,11 +2386,6 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
cmd_complete(btdev, opcode, &status, sizeof(status));
break;
- case BT_HCI_CMD_HOST_BUFFER_SIZE:
- status = BT_HCI_ERR_SUCCESS;
- cmd_complete(btdev, opcode, &status, sizeof(status));
- break;
-
case BT_HCI_CMD_SET_HOST_FLOW_CONTROL:
shfc = data;
if (shfc->enable > 0x03) {
@@ -2402,6 +2397,11 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
cmd_complete(btdev, opcode, &status, sizeof(status));
break;
+ case BT_HCI_CMD_HOST_BUFFER_SIZE:
+ status = BT_HCI_ERR_SUCCESS;
+ cmd_complete(btdev, opcode, &status, sizeof(status));
+ break;
+
case BT_HCI_CMD_READ_NUM_SUPPORTED_IAC:
if (btdev->type == BTDEV_TYPE_LE)
goto unsupported;
--
1.9.3