From: Uwe Hermann Date: Tue, 29 Jan 2013 11:05:00 +0000 (+0100) Subject: hantek-dso: Use message logging helpers. X-Git-Tag: dsupstream~296 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cbc6f3b25331bc4acca1eff9a5e60786e2efd2f8;p=libsigrok.git hantek-dso: Use message logging helpers. --- diff --git a/hardware/hantek-dso/dso.c b/hardware/hantek-dso/dso.c index 3006380d..66d6978f 100644 --- a/hardware/hantek-dso/dso.c +++ b/hardware/hantek-dso/dso.c @@ -237,7 +237,7 @@ static int get_channel_offsets(struct dev_context *devc) devc->channel_levels[chan][v][0], devc->channel_levels[chan][v][1]); } - sr_dbg(gs->str); + sr_dbg("%s", gs->str); } g_string_free(gs, TRUE); } @@ -505,7 +505,7 @@ SR_PRIV int dso_set_relays(struct dev_context *devc) g_string_printf(gs, "Relays:"); for (i = 0; i < 17; i++) g_string_append_printf(gs, " %.2x", relays[i]); - sr_dbg(gs->str); + sr_dbg("%s", gs->str); g_string_free(gs, TRUE); } diff --git a/hardware/hantek-dso/dso.h b/hardware/hantek-dso/dso.h index 5f766f9f..beabbd5b 100644 --- a/hardware/hantek-dso/dso.h +++ b/hardware/hantek-dso/dso.h @@ -22,6 +22,15 @@ #ifndef LIBSIGROK_HARDWARE_HANTEK_DSO_H #define LIBSIGROK_HARDWARE_HANTEK_DSO_H +/* Message logging helpers with driver-specific prefix string. */ +#define DRIVER_LOG_DOMAIN "hantek-dso: " +#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args) +#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args) +#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args) +#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args) +#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args) +#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args) + #define USB_INTERFACE 0 #define USB_CONFIGURATION 1 #define DSO_EP_IN 0x86