From: Uwe Hermann Date: Tue, 19 Jun 2012 21:33:50 +0000 (+0200) Subject: sr: backend/zeroplus: Improve debug output. X-Git-Tag: dsupstream~910 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c13536fa9c5ec756ff169423d43fc14b10be8cfa;p=libsigrok.git sr: backend/zeroplus: Improve debug output. --- diff --git a/datastore.c b/datastore.c index 36bde281..f45353a0 100644 --- a/datastore.c +++ b/datastore.c @@ -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? */ } diff --git a/hardware/zeroplus-logic-cube/analyzer.c b/hardware/zeroplus-logic-cube/analyzer.c index e9476237..9a416d63 100644 --- a/hardware/zeroplus-logic-cube/analyzer.c +++ b/hardware/zeroplus-logic-cube/analyzer.c @@ -32,6 +32,7 @@ #include #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? */ diff --git a/session.c b/session.c index 5e1d54a1..7c3dcef4 100644 --- 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++) {