From bdaa349ba59c7d147db90efd4588bc472d85fc69 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 14 Oct 2013 14:43:58 -0700 Subject: [PATCH] emulator: Add support for reading IAC information --- emulator/btdev.c | 23 +++++++++++++++++++++++ monitor/bt.h | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index f98b52398..5f04bd17b 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -30,6 +30,7 @@ #include #include #include +#include #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 d82fddafe..33831a02d 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 -- 2.47.3