From 55eeda7afd5dd0b6ea5581295bbfcbfd7a742804 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 11 Nov 2012 18:42:47 +0900 Subject: [PATCH] monitor: Decode the L2CAP create channel commands --- monitor/bt.h | 15 +++++++++++++++ monitor/l2cap.c | 25 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index f10d5d43c..1bb9048ce 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -1403,3 +1403,18 @@ struct bt_l2cap_pdu_info_rsp { uint16_t type; uint16_t result; } __attribute__ ((packed)); + +#define BT_L2CAP_PDU_CREATE_CHAN_REQ 0x0c +struct bt_l2cap_pdu_create_chan_req { + uint16_t psm; + uint16_t scid; + uint8_t ctrlid; +} __attribute__ ((packed)); + +#define BT_L2CAP_PDU_CREATE_CHAN_RSP 0x0d +struct bt_l2cap_pdu_create_chan_rsp { + uint16_t dcid; + uint16_t scid; + uint16_t result; + uint16_t status; +} __attribute__ ((packed)); diff --git a/monitor/l2cap.c b/monitor/l2cap.c index ea85f53e7..355849ac4 100644 --- a/monitor/l2cap.c +++ b/monitor/l2cap.c @@ -427,6 +427,25 @@ static void sig_info_rsp(const void *data, uint16_t size) } } +static void sig_create_chan_req(const void *data, uint16_t size) +{ + const struct bt_l2cap_pdu_create_chan_req *pdu = data; + + print_psm(pdu->psm); + print_cid("Source", pdu->scid); + print_field("Controller ID: %d", pdu->ctrlid); +} + +static void sig_create_chan_rsp(const void *data, uint16_t size) +{ + const struct bt_l2cap_pdu_create_chan_rsp *pdu = data; + + print_cid("Destination", pdu->dcid); + print_cid("Source", pdu->scid); + print_conn_result(pdu->result); + print_conn_status(pdu->status); +} + struct sig_opcode_data { uint8_t opcode; const char *str; @@ -458,8 +477,10 @@ static const struct sig_opcode_data sig_opcode_table[] = { sig_info_req, 2, true }, { 0x0b, "Information Response", sig_info_rsp, 4, false }, - { 0x0c, "Create Channel Request" }, - { 0x0d, "Create Channel Response" }, + { 0x0c, "Create Channel Request", + sig_create_chan_req, 5, true }, + { 0x0d, "Create Channel Response", + sig_create_chan_rsp, 8, true }, { 0x0e, "Move Channel Request" }, { 0x0f, "Move Channel Response" }, { 0x10, "Move Channel Confirmation" }, -- 2.47.3