From: Martin Ling Date: Wed, 22 Jan 2014 04:57:48 +0000 (+0000) Subject: rigol-ds: Stop capture cleanly on read errors. X-Git-Tag: libsigrok-0.3.0~200 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7d63347e9083648abd82bdeb49435ec1f7a98a44;p=libsigrok.git rigol-ds: Stop capture cleanly on read errors. --- diff --git a/hardware/rigol-ds/protocol.c b/hardware/rigol-ds/protocol.c index fd8ba96b..2df69c56 100644 --- a/hardware/rigol-ds/protocol.c +++ b/hardware/rigol-ds/protocol.c @@ -541,8 +541,13 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) len = sr_scpi_read_data(scpi, (char *)devc->buffer, len); - if (len == -1) - return FALSE; + if (len == -1) { + sr_err("Read error, aborting capture."); + packet.type = SR_DF_FRAME_END; + sr_session_send(cb_data, &packet); + sdi->driver->dev_acquisition_stop(sdi, cb_data); + return TRUE; + } sr_dbg("Received %d bytes.", len); @@ -591,6 +596,8 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) } if (!sr_scpi_read_complete(scpi)) { sr_err("Read should have been completed"); + packet.type = SR_DF_FRAME_END; + sr_session_send(cb_data, &packet); sdi->driver->dev_acquisition_stop(sdi, cb_data); return TRUE; }