]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Stop capture cleanly on read errors.
authorMartin Ling <redacted>
Wed, 22 Jan 2014 04:57:48 +0000 (04:57 +0000)
committerBert Vermeulen <redacted>
Thu, 23 Jan 2014 00:42:33 +0000 (01:42 +0100)
hardware/rigol-ds/protocol.c

index fd8ba96beec1b4916c456f056f3262366ac23eb3..2df69c56d8e9cedaf4e99916b0cca13e6c9b3788 100644 (file)
@@ -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;
                        }