diff options
author | Gowtham Anandha Babu <gowtham.ab@samsung.com> | 2014-12-17 17:29:44 +0530 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-12-19 10:59:30 -0200 |
commit | e0150908f1fc36ecba094dc6f3e3c58489398fa7 (patch) | |
tree | c21b2c7e41c1da808bdd425da8ef6cf68808e499 /monitor/rfcomm.c | |
parent | 202fb6bd69703300b6e4b3a2a215018a90917aa7 (diff) | |
download | bluez-e0150908f1fc36ecba094dc6f3e3c58489398fa7.tar.gz |
monitor/rfcomm: Add support for decoding Test command
RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
Address: 0x01 cr 0 dlci 0x00
Control: 0xef poll/final 0
Length: 6
FCS: 0xaa
MCC Message type: Test Command RSP(0x08)
Length: 4
Test Data: 0x 5f 54 65 73
Diffstat (limited to 'monitor/rfcomm.c')
-rw-r--r-- | monitor/rfcomm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c index 7d22fa033..be215a109 100644 --- a/monitor/rfcomm.c +++ b/monitor/rfcomm.c @@ -146,6 +146,23 @@ static void print_rfcomm_hdr(struct rfcomm_frame *rfcomm_frame, uint8_t indent) print_field("%*cFCS: 0x%2.2x", indent, ' ', hdr.fcs); } +static inline bool mcc_test(struct rfcomm_frame *rfcomm_frame, uint8_t indent) +{ + struct l2cap_frame *frame = &rfcomm_frame->l2cap_frame; + uint8_t data; + + printf("%*cTest Data: 0x ", indent, ' '); + + while (frame->size > 1) { + if (!l2cap_frame_get_u8(frame, &data)) + return false; + printf("%2.2x ", data); + } + + printf("\n"); + return true; +} + static inline bool mcc_msc(struct rfcomm_frame *rfcomm_frame, uint8_t indent) { struct l2cap_frame *frame = &rfcomm_frame->l2cap_frame; @@ -358,6 +375,8 @@ static inline bool mcc_frame(struct rfcomm_frame *rfcomm_frame, uint8_t indent) rfcomm_frame->mcc = mcc; switch (type) { + case RFCOMM_TEST: + return mcc_test(rfcomm_frame, indent+10); case RFCOMM_MSC: return mcc_msc(rfcomm_frame, indent+2); case RFCOMM_RPN: |