2018-07-26 11:23:29

by Jaganath K

[permalink] [raw]
Subject: [PATCH BlueZ] emulator: Fix unsupported command for WRITE_LE_HOST_SUPPORTED

WRITE_LE_HOST_SUPPORTED command needs check for BTDEV_TYPE_LE as well.
---
emulator/btdev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index f8289d0..ae30950 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -2960,6 +2960,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,

case BT_HCI_CMD_WRITE_LE_HOST_SUPPORTED:
if (btdev->type != BTDEV_TYPE_BREDRLE &&
+ btdev->type != BTDEV_TYPE_LE &&
btdev->type != BTDEV_TYPE_BREDRLE50)
goto unsupported;
wlhs = data;
--
2.7.4


2018-07-26 12:19:34

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] emulator: Fix unsupported command for WRITE_LE_HOST_SUPPORTED

Hi Jaganath,

On Thu, Jul 26, 2018, Jaganath Kanakkassery wrote:
> WRITE_LE_HOST_SUPPORTED command needs check for BTDEV_TYPE_LE as well.
> ---
> emulator/btdev.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/emulator/btdev.c b/emulator/btdev.c
> index f8289d0..ae30950 100644
> --- a/emulator/btdev.c
> +++ b/emulator/btdev.c
> @@ -2960,6 +2960,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
>
> case BT_HCI_CMD_WRITE_LE_HOST_SUPPORTED:
> if (btdev->type != BTDEV_TYPE_BREDRLE &&
> + btdev->type != BTDEV_TYPE_LE &&
> btdev->type != BTDEV_TYPE_BREDRLE50)
> goto unsupported;
> wlhs = data;

Applied. Thanks.

FWIW, the alternative solution would have been to remove the command
from the supported commands bitmap, since it's an optional command for
single-mode controllers. Additionally, the call to
bthost_write_le_host_supported() from mgmt-tester.c should have been
removed when the tests sets enable_le=true for data->type ==
HCIEMU_TYPE_LE, since this is where it's comming from (it's not the
kernel that's sending it).

Johan