From 759559da7fb9c03e5f42eab12acbc01ebe763186 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 28 Nov 2013 15:13:12 +0100 Subject: [PATCH 1/1] am7xxx: dump fields of unknown packet types Allow dumping the payload fields as generic header_data, this is useful when the packet type cannot be handled explicitly because the meaning of the data is not known. --- src/am7xxx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/am7xxx.c b/src/am7xxx.c index 3c7c5b4..76b997c 100644 --- a/src/am7xxx.c +++ b/src/am7xxx.c @@ -228,6 +228,18 @@ struct am7xxx_header { #ifdef DEBUG +static void debug_dump_generic_header(am7xxx_context *ctx, struct am7xxx_generic_header *g) +{ + if (ctx == NULL || g == NULL) + return; + + debug(ctx, "Generic header:\n"); + debug(ctx, "\tfield0: 0x%08x (%u)\n", g->field0, g->field0); + debug(ctx, "\tfield1: 0x%08x (%u)\n", g->field1, g->field1); + debug(ctx, "\tfield2: 0x%08x (%u)\n", g->field2, g->field2); + debug(ctx, "\tfield3: 0x%08x (%u)\n", g->field3, g->field3); +} + static void debug_dump_devinfo_header(am7xxx_context *ctx, struct am7xxx_devinfo_header *d) { if (ctx == NULL || d == NULL) @@ -306,7 +318,8 @@ static void debug_dump_header(am7xxx_context *ctx, struct am7xxx_header *h) break; default: - debug(ctx, "Packet type not supported!\n"); + debug(ctx, "Parsing data not supported for this packet type!\n"); + debug_dump_generic_header(ctx, &(h->header_data.data)); break; } debug(ctx, "END\n\n"); -- 2.1.4