X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcommon%2Fusb.c;h=6e678fdb401d1d681000fc3a6e273c7374656957;hb=945e4343e2be4ad9e70e1a995182988b2331e0bd;hp=c4d78f90a236acd036c4ad7e60a1ea902f225fa1;hpb=6640324f7f2730dc5a120af90a849b8d8fee52fa;p=libsigrok.git diff --git a/hardware/common/usb.c b/hardware/common/usb.c index c4d78f90..6e678fdb 100644 --- a/hardware/common/usb.c +++ b/hardware/common/usb.c @@ -33,14 +33,7 @@ #define SUBCLASS_USBTMC 0x03 #define USBTMC_USB488 0x01 -/* Message logging helpers with subsystem-specific prefix string. */ -#define LOG_PREFIX "usb: " -#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) -#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) -#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) -#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) -#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) -#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) +#define LOG_PREFIX "usb" /** * Find USB devices according to a connection string. @@ -267,8 +260,11 @@ SR_PRIV int usb_callback(int fd, int revents, void *cb_data) g_mutex_lock(&ctx->usb_mutex); ret = ctx->usb_cb(fd, revents, ctx->usb_cb_data); - ResetEvent(ctx->usb_event); - g_mutex_unlock(&ctx->usb_mutex); + + if (ctx->usb_thread_running) { + ResetEvent(ctx->usb_event); + g_mutex_unlock(&ctx->usb_mutex); + } return ret; }