Diff between e6590fb96f37a69bc79cbee5aa6f311102c996e2 and bdaa349ba59c7d147db90efd4588bc472d85fc69

Changed Files

File Additions Deletions Status
emulator/btdev.c +23 -0 modified
monitor/bt.h +5 -0 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index f98b523..5f04bd1 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include <alloca.h>
 
 #include "monitor/bt.h"
 #include "btdev.h"
@@ -1072,6 +1073,8 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 	struct bt_hci_rsp_read_auth_enable rae;
 	struct bt_hci_rsp_read_class_of_dev rcod;
 	struct bt_hci_rsp_read_voice_setting rvs;
+	struct bt_hci_rsp_read_num_supported_iac rnsi;
+	struct bt_hci_rsp_read_current_iac_lap *rcil;
 	struct bt_hci_rsp_read_inquiry_mode rim;
 	struct bt_hci_rsp_read_afh_assessment_mode raam;
 	struct bt_hci_rsp_read_ext_inquiry_response reir;
@@ -1415,6 +1418,26 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		cmd_complete(btdev, opcode, &status, sizeof(status));
 		break;
 
+	case BT_HCI_CMD_READ_NUM_SUPPORTED_IAC:
+		if (btdev->type == BTDEV_TYPE_LE)
+			goto unsupported;
+		rnsi.status = BT_HCI_ERR_SUCCESS;
+		rnsi.num_iac = 0x01;
+		cmd_complete(btdev, opcode, &rnsi, sizeof(rnsi));
+		break;
+
+	case BT_HCI_CMD_READ_CURRENT_IAC_LAP:
+		if (btdev->type == BTDEV_TYPE_LE)
+			goto unsupported;
+		rcil = alloca(sizeof(*rcil) + 3);
+		rcil->status = BT_HCI_ERR_SUCCESS;
+		rcil->num_iac = 0x01;
+		rcil->iac_lap[0] = 0x33;
+		rcil->iac_lap[1] = 0x8b;
+		rcil->iac_lap[2] = 0x9e;
+		cmd_complete(btdev, opcode, rcil, sizeof(*rcil) + 3);
+		break;
+
 	case BT_HCI_CMD_WRITE_CURRENT_IAC_LAP:
 		if (btdev->type == BTDEV_TYPE_LE)
 			goto unsupported;
diff --git a/monitor/bt.h b/monitor/bt.h
index d82fdda..33831a0 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -741,6 +741,11 @@ struct bt_hci_rsp_read_num_supported_iac {
 } __attribute__ ((packed));
 
 #define BT_HCI_CMD_READ_CURRENT_IAC_LAP		0x0c39
+struct bt_hci_rsp_read_current_iac_lap {
+	uint8_t  status;
+	uint8_t  num_iac;
+	uint8_t  iac_lap[0];
+} __attribute__ ((packed));
 
 #define BT_HCI_CMD_WRITE_CURRENT_IAC_LAP	0x0c3a