]> sigrok.org Git - libsigrok.git/commitdiff
sr: backend/zeroplus: Improve debug output.
authorUwe Hermann <redacted>
Tue, 19 Jun 2012 21:33:50 +0000 (23:33 +0200)
committerUwe Hermann <redacted>
Tue, 19 Jun 2012 21:33:50 +0000 (23:33 +0200)
datastore.c
hardware/zeroplus-logic-cube/analyzer.c
session.c

index 36bde28105e24d1ec5d4b3cd570ac23934b6c329..f45353a0f08c8c17447cda583a96d48002ab3159 100644 (file)
@@ -232,7 +232,8 @@ static gpointer new_chunk(struct sr_datastore **ds)
 
        chunk = g_try_malloc0(DATASTORE_CHUNKSIZE * (*ds)->ds_unitsize);
        if (!chunk) {
-               sr_err("ds: %s: chunk malloc failed", __func__);
+               sr_err("ds: %s: chunk malloc failed (ds_unitsize was %u)",
+                      __func__, (*ds)->ds_unitsize);
                return NULL; /* TODO: SR_ERR_MALLOC later? */
        }
 
index e9476237dcd6c62969f27b676366e9e2b57b67c1..9a416d6305e1ee67a600acdd286109389e0291ab 100644 (file)
@@ -32,6 +32,7 @@
 #include <assert.h>
 #include "analyzer.h"
 #include "gl_usb.h"
+#include "sigrok-internal.h"
 
 enum {
        HARD_DATA_CHECK_SUM             = 0x00,
@@ -241,6 +242,11 @@ static int __analyzer_set_freq(libusb_device_handle *devh, int freq, int scale)
                reg2 = 64;
                break;
        }
+
+       sr_dbg("zp: Setting samplerate regs (freq=%d, scale=%d): "
+              "reg0: %d, reg1: %d, reg2: %d, reg3: %d.",
+              freq, scale, divisor, reg0, 0x02, reg2);
+
        if (gl_reg_write(devh, FREQUENCY_REG0, divisor) < 0)
                return -1; /* Divisor maybe? */
 
index 5e1d54a1e86f5d2b8f9dac4129700bab08c823c2..7c3dcef45c92eb9c94fc88c87b63ad3d0dc9077e 100644 (file)
--- a/session.c
+++ b/session.c
@@ -217,7 +217,9 @@ static int sr_session_run_poll(void)
 
                /* Construct g_poll()'s array. */
                if (!(fds = g_try_malloc(sizeof(GPollFD) * num_sources))) {
-                       sr_err("session: %s: fds malloc failed", __func__);
+                       /* Not enough memory, or num_sources was 0. */
+                       sr_err("session: %s: fds malloc failed "
+                              "(num_sources was %d).", __func__, num_sources);
                        return SR_ERR_MALLOC;
                }
                for (i = 0; i < num_sources; i++) {