diff options
author | Bert Vermeulen <bert@biot.com> | 2013-12-11 21:52:33 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2013-12-11 21:52:33 +0100 |
commit | caa4b2cc0cdb34570e0fe8e5a6dad05a2988cc89 (patch) | |
tree | c21b60db73f0fdf65dcb14bd954095e7cdad1246 /tests/runtc.c | |
parent | 554a49f9df0ee8c57d7fae64515cf57d622b0511 (diff) | |
download | libsigrokdecode-caa4b2cc0cdb34570e0fe8e5a6dad05a2988cc89.tar.gz libsigrokdecode-caa4b2cc0cdb34570e0fe8e5a6dad05a2988cc89.zip |
pdtest: Use -dd to turn on SR/SRD debugging.
Diffstat (limited to 'tests/runtc.c')
-rw-r--r-- | tests/runtc.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/runtc.c b/tests/runtc.c index bb25950..04151f8 100644 --- a/tests/runtc.c +++ b/tests/runtc.c @@ -94,13 +94,25 @@ void ERR(const char *format, ...) va_end(args); } +int sr_log(void *cb_data, int loglevel, const char *format, va_list args) +{ + (void)cb_data; + + if (loglevel == SR_LOG_ERR || loglevel == SR_LOG_WARN) + logmsg("Error: sr: ", stderr, format, args); + else if (debug) + logmsg("DBG: sr: ", stdout, format, args); + + return SRD_OK; +} + int srd_log(void *cb_data, int loglevel, const char *format, va_list args) { (void)cb_data; if (loglevel == SRD_LOG_ERR || loglevel == SRD_LOG_WARN) logmsg("Error: srd: ", stderr, format, args); - else if (loglevel >= SRD_LOG_DBG && debug) + else if (debug) logmsg("DBG: srd: ", stdout, format, args); return SRD_OK; @@ -464,6 +476,7 @@ int main(int argc, char **argv) if (!op->pd || op->type == -1) usage(NULL); + sr_log_callback_set(sr_log, NULL); if (sr_init(&ctx) != SR_OK) return 1; |