From: Stefan BrĂ¼ns Date: Sun, 17 Apr 2016 17:14:27 +0000 (+0200) Subject: hameg-hmo: Also start reading on timeout (workaround for USBTMC) X-Git-Tag: libsigrok-0.5.0~505 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f4f273ce1e718342b8de34b98786131102d7bcaa;p=libsigrok.git hameg-hmo: Also start reading on timeout (workaround for USBTMC) scpi_serial generate an POLLIN event after the requested data is returned by the instrument. For USBTMC it is necessary to 1. send an REQUEST_DEV_DEP_MSG_IN request 2. submit an USB bulk read transfer asynchronously. Using the synchronous libusb_bulk_read() does not generate an POLLIN event. Solving this properly needs major surgery in spci_usbtmc_libusb. --- diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 9d32dc67..bd2174a7 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -743,8 +743,12 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data) if (!(devc = sdi->priv)) return TRUE; + /* Although this is correct in general, the USBTMC libusb implementation + * currently does not generate an event prior to the first read. Often + * it is ok to start reading just after the 50ms timeout. See bug #785. if (revents != G_IO_IN) return TRUE; + */ ch = devc->current_channel->data;