From a0d075072dbc21f005408bbeafc68ba26991e80e Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 26 Feb 2021 14:34:09 -0800 Subject: [PATCH] btdev: Add support Read Local Supported Codec Capabilities > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 167 entries ... Read Local Supported Codec Capabilities (Octet 45 - Bit 3) --- emulator/btdev.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 7fc8efecf..c4b132a1b 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -4645,6 +4645,22 @@ static int cmd_read_local_codecs_v2(struct btdev *dev, const void *data, return 0; } +static int cmd_read_local_codec_caps(struct btdev *dev, const void *data, + uint8_t len) +{ + const struct bt_hci_cmd_read_local_codec_caps *cmd = data; + struct bt_hci_rsp_read_local_codec_caps rsp; + + memset(&rsp, 0, sizeof(rsp)); + + if (cmd->codec_id > 0x05) + rsp.status = BT_HCI_ERR_INVALID_PARAMETERS; + + cmd_complete(dev, BT_HCI_CMD_READ_LOCAL_CODEC_CAPS, &rsp, sizeof(rsp)); + + return 0; +} + #define CMD_LE_52 \ CMD(BT_HCI_CMD_LE_READ_BUFFER_SIZE_V2, cmd_read_size_v2, NULL), \ CMD(BT_HCI_CMD_LE_READ_ISO_TX_SYNC, cmd_read_iso_tx_sync, NULL), \ @@ -4670,7 +4686,8 @@ static int cmd_read_local_codecs_v2(struct btdev *dev, const void *data, NULL), \ CMD(BT_HCI_CMD_LE_ISO_TEST_END, cmd_iso_test_end, NULL), \ CMD(BT_HCI_CMD_LE_SET_HOST_FEATURE, cmd_set_host_feature, NULL), \ - CMD(BT_HCI_CMD_READ_LOCAL_CODECS_V2, cmd_read_local_codecs_v2, NULL) + CMD(BT_HCI_CMD_READ_LOCAL_CODECS_V2, cmd_read_local_codecs_v2, NULL), \ + CMD(BT_HCI_CMD_READ_LOCAL_CODEC_CAPS, cmd_read_local_codec_caps, NULL) static const struct btdev_cmd cmd_le_5_2[] = { CMD_COMMON_ALL, @@ -4705,6 +4722,7 @@ static void set_le_52_commands(struct btdev *btdev) btdev->commands[44] |= 0x01; /* LE ISO Test End */ btdev->commands[44] |= 0x02; /* LE ISO Set Host Feature */ btdev->commands[45] |= 0x04; /* Read Local Supported Codecs v2 */ + btdev->commands[45] |= 0x08; /* Read Local Supported Codecs Caps */ btdev->cmds = cmd_le_5_2; } -- 2.47.3