]> sigrok.org Git - libsigrok.git/commitdiff
better session bus logging
authorBert Vermeulen <redacted>
Mon, 20 Jun 2011 09:42:43 +0000 (11:42 +0200)
committerBert Vermeulen <redacted>
Mon, 20 Jun 2011 09:42:43 +0000 (11:42 +0200)
session.c

index 632ac9467763a5d3dbe042a00fa1a579a225c1d9..bbcf5bc923172328f5b7be322f7172c3304861aa 100644 (file)
--- a/session.c
+++ b/session.c
@@ -211,6 +211,33 @@ void sr_session_stop(void)
 
 }
 
+static void datafeed_dump(struct sr_datafeed_packet *packet)
+{
+       struct sr_datafeed_logic *logic;
+
+       switch (packet->type) {
+       case SR_DF_HEADER:
+               sr_dbg("bus: received SR_DF_HEADER");
+               break;
+       case SR_DF_TRIGGER:
+               sr_dbg("bus: received SR_DF_TRIGGER at %lu ms",
+                               packet->timeoffset / 1000000);
+               break;
+       case SR_DF_LOGIC:
+               logic = packet->payload;
+               sr_dbg("bus: received SR_DF_LOGIC at %f ms duration %f ms, %"PRIu64" bytes",
+                               packet->timeoffset / 1000000.0, packet->duration / 1000000.0,
+                               logic->length);
+               break;
+       case SR_DF_END:
+               sr_dbg("bus: received SR_DF_END");
+               break;
+       default:
+               sr_dbg("bus: received unknown packet type %d", packet->type);
+       }
+
+}
+
 void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
 {
        GSList *l;
@@ -222,6 +249,7 @@ void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
         */
        for (l = session->datafeed_callbacks; l; l = l->next) {
                cb = l->data;
+               datafeed_dump(packet);
                cb(device, packet);
        }
 }