From 9cb270ab424dc95cf439050659432b0c8b6cf174 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 14 May 2005 10:14:54 +0000 Subject: [PATCH] hcidump: Add verbose decoding support --- tools/parser/obex.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tools/parser/obex.c b/tools/parser/obex.c index 0cf299479..3d23f5c91 100644 --- a/tools/parser/obex.c +++ b/tools/parser/obex.c @@ -226,6 +226,24 @@ static void parse_headers(int level, struct frame *frm) } } +static void print_status(uint8_t status) +{ + switch (status & 0x7f) { + case 0x10: + printf(" (continue)"); + break; + case 0x20: + printf(" (success)"); + break; + case 0x21: + printf(" (created)"); + break; + case 0x22: + printf(" (accepted)"); + break; + } +} + static uint8_t last_opcode = 0x00; static uint8_t last_status = 0x00; @@ -243,15 +261,13 @@ void obex_dump(int level, struct frame *frm) if ((opcode & 0x70) == 0x00) { printf("OBEX: %s cmd(%c): len %d", opcode2str(opcode), opcode & 0x80 ? 'f' : 'c', length); - if (last_status == 0x10) - printf(" (continue)"); + print_status(last_status); last_opcode = opcode; } else { printf("OBEX: %s rsp(%c): status %x%02d len %d", opcode2str(last_opcode), opcode & 0x80 ? 'f' : 'c', status >> 4, status & 0xf, length); - if (status == 0x10) - printf(" (continue)"); + print_status(status); opcode = last_opcode; } @@ -276,6 +292,11 @@ void obex_dump(int level, struct frame *frm) printf("\n"); } + if ((status >> 4) > 2 && (parser.flags & DUMP_VERBOSE)) { + p_indent(level, frm); + printf("Error: %s\n", opcode2str(status)); + } + parse_headers(level, frm); raw_dump(level, frm); -- 2.47.3