From 66ac7a5af542e4a87a7c75a37a9655104b8fe2d7 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 19 Oct 2013 02:14:58 -0700 Subject: [PATCH] monitor: Add support for decoding SSP debug mode command --- monitor/bt.h | 5 +++++ monitor/packet.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/monitor/bt.h b/monitor/bt.h index 2245ab312..0ae0fc49b 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -1107,6 +1107,11 @@ struct bt_hci_rsp_write_remote_amp_assoc { #define BT_HCI_CMD_ENABLE_DUT_MODE 0x1803 +#define BT_HCI_CMD_WRITE_SSP_DEBUG_MODE 0x1804 +struct bt_hci_cmd_write_ssp_debug_mode { + uint8_t mode; +} __attribute__ ((packed)); + #define BT_HCI_CMD_LE_SET_EVENT_MASK 0x2001 struct bt_hci_cmd_le_set_event_mask { uint8_t mask[8]; diff --git a/monitor/packet.c b/monitor/packet.c index 55c9f0f05..025d2eebf 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -924,6 +924,25 @@ static void print_simple_pairing_mode(uint8_t mode) print_field("Mode: %s (0x%2.2x)", str, mode); } +static void print_ssp_debug_mode(uint8_t mode) +{ + const char *str; + + switch (mode) { + case 0x00: + str = "Disabled"; + break; + case 0x01: + str = "Enabled"; + break; + default: + str = "Reserved"; + break; + } + + print_field("Debug mode: %s (0x%2.2x)", str, mode); +} + static void print_pscan_rep_mode(uint8_t pscan_rep_mode) { const char *str; @@ -4226,6 +4245,13 @@ static void write_remote_amp_assoc_rsp(const void *data, uint8_t size) print_phy_handle(rsp->phy_handle); } +static void write_ssp_debug_mode_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_write_ssp_debug_mode *cmd = data; + + print_ssp_debug_mode(cmd->mode); +} + static void le_set_event_mask_cmd(const void *data, uint8_t size) { const struct bt_hci_cmd_le_set_event_mask *cmd = data; @@ -5126,7 +5152,9 @@ static const struct opcode_data opcode_table[] = { { 0x1803, 130, "Enable Device Under Test Mode", null_cmd, 0, true, status_rsp, 1, true }, - { 0x1804, 157, "Write Simple Pairing Debug Mode" }, + { 0x1804, 157, "Write Simple Pairing Debug Mode", + write_ssp_debug_mode_cmd, 1, true, + status_rsp, 1, true }, { 0x1807, 189, "Enable AMP Receiver Reports" }, { 0x1808, 190, "AMP Test End" }, { 0x1809, 191, "AMP Test" }, -- 2.47.3