Diff between 746d3240287b9724bb7a8743af919e5fa13fcf65 and ed5ca845b1b11a5c3cb9bfc86cafe6bedbd0954d

Changed Files

File Additions Deletions Status
emulator/btdev.c +18 -0 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 641edea..fc7d1bc 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;