Skip to content

Commit

Permalink
emulator: Add support for reading IAC information
Browse files Browse the repository at this point in the history
  • Loading branch information
holtmann committed Oct 14, 2013
1 parent e6590fb commit bdaa349
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions emulator/btdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <alloca.h>

#include "monitor/bt.h"
#include "btdev.h"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions monitor/bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bdaa349

Please sign in to comment.