From ed5ca845b1b11a5c3cb9bfc86cafe6bedbd0954d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 23 Jul 2014 19:00:50 +0200 Subject: [PATCH] emulator: Add support for Read Local Supported Codecs command --- emulator/btdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index 641edead4..fc7d1bce8 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -379,6 +379,7 @@ static void set_bredr_commands(struct btdev *btdev) btdev->commands[18] |= 0x02; /* Write Inquiry Response TX Power */ btdev->commands[18] |= 0x80; /* IO Capability Request Reply */ btdev->commands[23] |= 0x04; /* Read Data Block Size */ + btdev->commands[29] |= 0x20; /* Read Local Supported Codecs */ } static void set_le_commands(struct btdev *btdev) @@ -1830,6 +1831,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, struct bt_hci_rsp_read_country_code rcc; struct bt_hci_rsp_read_bd_addr rba; struct bt_hci_rsp_read_data_block_size rdbs; + struct bt_hci_rsp_read_local_codecs *rlsc; struct bt_hci_rsp_read_local_amp_info rlai; struct bt_hci_rsp_read_local_amp_assoc rlaa_rsp; struct bt_hci_rsp_le_read_buffer_size lrbs; @@ -2500,6 +2502,22 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, cmd_complete(btdev, opcode, &rdbs, sizeof(rdbs)); break; + case BT_HCI_CMD_READ_LOCAL_CODECS: + if (btdev->type == BTDEV_TYPE_LE) + goto unsupported; + rlsc = alloca(sizeof(*rlsc) + 7); + rlsc->status = BT_HCI_ERR_SUCCESS; + rlsc->num_codecs = 0x06; + rlsc->codec[0] = 0x00; + rlsc->codec[1] = 0x01; + rlsc->codec[2] = 0x02; + rlsc->codec[3] = 0x03; + rlsc->codec[4] = 0x04; + rlsc->codec[5] = 0x05; + rlsc->codec[6] = 0x00; + cmd_complete(btdev, opcode, rlsc, sizeof(*rlsc) + 7); + break; + case BT_HCI_CMD_READ_RSSI: rrssi = data; -- 2.11.0