From 22503e30d395e7fd440f9b5afc3351ac029042cb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 30 Jul 2014 05:12:37 +0200 Subject: [PATCH] monitor: Add support for LE Connection Parameter Request Reply commands --- monitor/bt.h | 25 +++++++++++++++++++++++++ monitor/packet.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index d7fd796fa..434653e27 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -1835,6 +1835,31 @@ struct bt_hci_rsp_le_test_end { uint16_t num_packets; } __attribute__ ((packed)); +#define BT_HCI_CMD_LE_CONN_PARAM_REQ_REPLY 0x2020 +struct bt_hci_cmd_le_conn_param_req_reply { + uint16_t handle; + uint16_t min_interval; + uint16_t max_interval; + uint16_t latency; + uint16_t supv_timeout; + uint16_t min_length; + uint16_t max_length; +} __attribute__ ((packed)); +struct bt_hci_rsp_le_conn_param_req_reply { + uint8_t status; + uint16_t handle; +} __attribute__ ((packed)); + +#define BT_HCI_CMD_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021 +struct bt_hci_cmd_le_conn_param_req_neg_reply { + uint16_t handle; + uint8_t reason; +} __attribute__ ((packed)); +struct bt_hci_rsp_le_conn_param_req_neg_reply { + uint8_t status; + uint16_t handle; +} __attribute__ ((packed)); + #define BT_HCI_EVT_INQUIRY_COMPLETE 0x01 struct bt_hci_evt_inquiry_complete { uint8_t status; diff --git a/monitor/packet.c b/monitor/packet.c index 8cfd3c8f8..a4f3f8b45 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -5888,6 +5888,45 @@ static void le_test_end_rsp(const void *data, uint8_t size) print_field("Number of packets: %d", le16_to_cpu(rsp->num_packets)); } +static void le_conn_param_req_reply_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_le_conn_param_req_reply *cmd = data; + + print_handle(cmd->handle); + print_slot_125("Min connection interval", cmd->min_interval); + print_slot_125("Max connection interval", cmd->max_interval); + print_field("Connection latency: 0x%4.4x", le16_to_cpu(cmd->latency)); + print_field("Supervision timeout: %d msec (0x%4.4x)", + le16_to_cpu(cmd->supv_timeout) * 10, + le16_to_cpu(cmd->supv_timeout)); + print_slot_625("Min connection length", cmd->min_length); + print_slot_625("Max connection length", cmd->max_length); +} + +static void le_conn_param_req_reply_rsp(const void *data, uint8_t size) +{ + const struct bt_hci_rsp_le_conn_param_req_reply *rsp = data; + + print_status(rsp->status); + print_handle(rsp->handle); +} + +static void le_conn_param_req_neg_reply_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_le_conn_param_req_neg_reply *cmd = data; + + print_handle(cmd->handle); + print_reason(cmd->reason); +} + +static void le_conn_param_req_neg_reply_rsp(const void *data, uint8_t size) +{ + const struct bt_hci_rsp_le_conn_param_req_neg_reply *rsp = data; + + print_status(rsp->status); + print_handle(rsp->handle); +} + struct opcode_data { uint16_t opcode; int bit; @@ -6515,8 +6554,12 @@ static const struct opcode_data opcode_table[] = { { 0x201f, 230, "LE Test End", null_cmd, 0, true, le_test_end_rsp, 3, true }, - { 0x2020, 268, "LE Remote Connection Parameter Request Reply" }, - { 0x2021, 269, "LE Remote Connection Parameter Request Negative Reply" }, + { 0x2020, 268, "LE Remote Connection Parameter Request Reply", + le_conn_param_req_reply_cmd, 14, true, + le_conn_param_req_reply_rsp, 3, true }, + { 0x2021, 269, "LE Remote Connection Parameter Request Negative Reply", + le_conn_param_req_neg_reply_cmd, 3, true, + le_conn_param_req_neg_reply_rsp, 3, true }, { } }; -- 2.47.3