projects
/
libam7xxx.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8799de1
)
am7xxx: dump fields of unknown packet types
author
Antonio Ospite <ospite@studenti.unina.it>
Thu, 28 Nov 2013 14:13:12 +0000
(15:13 +0100)
committer
Antonio Ospite <ospite@studenti.unina.it>
Thu, 28 Nov 2013 14:28:16 +0000
(15:28 +0100)
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
patch
|
blob
|
history
diff --git
a/src/am7xxx.c
b/src/am7xxx.c
index
3c7c5b4
..
76b997c
100644
(file)
--- a/
src/am7xxx.c
+++ b/
src/am7xxx.c
@@
-228,6
+228,18
@@
struct am7xxx_header {
#ifdef DEBUG
#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)
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:
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");
break;
}
debug(ctx, "END\n\n");