From bc704506e69ae30b0770aac32504e89cf2dc9ddf Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 14 Oct 2013 14:59:55 -0700 Subject: [PATCH] monitor: Add decoding for reading and writing current IAC LAP --- monitor/bt.h | 4 ++++ monitor/packet.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index 33831a02d..2245ab312 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -748,6 +748,10 @@ struct bt_hci_rsp_read_current_iac_lap { } __attribute__ ((packed)); #define BT_HCI_CMD_WRITE_CURRENT_IAC_LAP 0x0c3a +struct bt_hci_cmd_write_current_iac_lap { + uint8_t num_iac; + uint8_t iac_lap[0]; +} __attribute__ ((packed)); #define BT_HCI_CMD_READ_PAGE_SCAN_PERIOD_MODE 0x0c3b struct bt_hci_rsp_read_page_scan_period_mode { diff --git a/monitor/packet.c b/monitor/packet.c index b7f831459..55c9f0f05 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -3651,6 +3651,29 @@ static void read_num_supported_iac_rsp(const void *data, uint8_t size) print_field("Number of IAC: %d", rsp->num_iac); } +static void read_current_iac_lap_rsp(const void *data, uint8_t size) +{ + const struct bt_hci_rsp_read_current_iac_lap *rsp = data; + uint8_t i; + + print_status(rsp->status); + print_field("Number of IAC: %d", rsp->num_iac); + + for (i = 0; i < rsp->num_iac; i++) + print_iac(rsp->iac_lap + (i * 3)); +} + +static void write_current_iac_lap_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_write_current_iac_lap *cmd = data; + uint8_t i; + + print_field("Number of IAC: %d", cmd->num_iac); + + for (i = 0; i < cmd->num_iac; i++) + print_iac(cmd->iac_lap + (i * 3)); +} + static void read_page_scan_period_mode_rsp(const void *data, uint8_t size) { const struct bt_hci_rsp_read_page_scan_period_mode *rsp = data; @@ -4922,8 +4945,12 @@ static const struct opcode_data opcode_table[] = { { 0x0c38, 90, "Read Number of Supported IAC", null_cmd, 0, true, read_num_supported_iac_rsp, 2, true }, - { 0x0c39, 91, "Read Current IAC LAP" }, - { 0x0c3a, 92, "Write Current IAC LAP" }, + { 0x0c39, 91, "Read Current IAC LAP", + null_cmd, 0, true, + read_current_iac_lap_rsp, 2, false }, + { 0x0c3a, 92, "Write Current IAC LAP", + write_current_iac_lap_cmd, 1, false, + status_rsp, 1, true }, { 0x0c3b, 93, "Read Page Scan Period Mode", null_cmd, 0, true, read_page_scan_period_mode_rsp, 2, true }, -- 2.11.0