From 0b548ec4cdf8d9fbe6257a726423c70719b4b71c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 4 Mar 2013 15:13:29 +0200 Subject: [PATCH] monitor: Add full decoding of Page Scan Type HCI commands --- monitor/bt.h | 11 +++++++++++ monitor/packet.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index 9f50a438c..64cbe74fd 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -609,6 +609,17 @@ struct bt_hci_cmd_write_inquiry_mode { uint8_t mode; } __attribute__ ((packed)); +#define BT_HCI_CMD_READ_PAGE_SCAN_TYPE 0x0c46 +struct bt_hci_rsp_read_page_scan_type { + uint8_t status; + uint8_t type; +} __attribute__ ((packed)); + +#define BT_HCI_CMD_WRITE_PAGE_SCAN_TYPE 0x0c47 +struct bt_hci_cmd_write_page_scan_type { + uint8_t type; +} __attribute__ ((packed)); + #define BT_HCI_CMD_READ_AFH_ASSESS_MODE 0x0c48 struct bt_hci_rsp_read_afh_assess_mode { uint8_t status; diff --git a/monitor/packet.c b/monitor/packet.c index bd68d358d..dc2a9ee78 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -761,6 +761,25 @@ static void print_inquiry_mode(uint8_t mode) print_field("Mode: %s (0x%2.2x)", str, mode); } +static void print_pscan_type(uint8_t type) +{ + const char *str; + + switch (type) { + case 0x00: + str = "Standard Scan"; + break; + case 0x01: + str = "Interlaced Scan"; + break; + default: + str = "Reserved"; + break; + } + + print_field("Type: %s (0x%2.2x)", str, type); +} + static void print_simple_pairing_mode(uint8_t mode) { const char *str; @@ -3124,6 +3143,21 @@ static void write_inquiry_mode_cmd(const void *data, uint8_t size) print_inquiry_mode(cmd->mode); } +static void read_page_scan_type_rsp(const void *data, uint8_t size) +{ + const struct bt_hci_rsp_read_page_scan_type *rsp = data; + + print_status(rsp->status); + print_pscan_type(rsp->type); +} + +static void write_page_scan_type_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_write_page_scan_type *cmd = data; + + print_pscan_type(cmd->type); +} + static void read_ext_inquiry_response_rsp(const void *data, uint8_t size) { const struct bt_hci_rsp_read_ext_inquiry_response *rsp = data; @@ -3988,8 +4022,12 @@ static const struct opcode_data opcode_table[] = { { 0x0c45, 103, "Write Inquiry Mode", write_inquiry_mode_cmd, 1, true, status_rsp, 1, true }, - { 0x0c46, 104, "Read Page Scan Type" }, - { 0x0c47, 105, "Write Page Scan Type" }, + { 0x0c46, 104, "Read Page Scan Type", + null_cmd, 0, true, + read_page_scan_type_rsp, 2, true }, + { 0x0c47, 105, "Write Page Scan Type", + write_page_scan_type_cmd, 1, true, + status_rsp, 1, true }, { 0x0c48, 106, "Read AFH Channel Assessment Mode" }, { 0x0c49, 107, "Write AFH Channel Assessment Mode" }, /* reserved commands */ -- 2.47.3