]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Handle partial analog frame reads.
authorMartin Ling <redacted>
Wed, 4 Dec 2013 13:08:49 +0000 (13:08 +0000)
committerMartin Ling <redacted>
Wed, 4 Dec 2013 13:31:42 +0000 (13:31 +0000)
Reading a frame over the DS1xx2 RS232 connection now sometimes works,
but most of the time stalls part way through with g_poll showing the
fd as not ready.

hardware/rigol-ds/protocol.c

index a900872507521fecfe1070a6d6263065988ce1d6..cd460e9f483b47c2d14e154731c79576871c01d6 100644 (file)
@@ -517,19 +517,15 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                                                rigol_ds_set_wait_event(devc, WAIT_BLOCK);
                                } else
                                        sr_dbg("%d of %d block bytes read", devc->num_block_read, devc->num_block_bytes);
+                       }
 
-                               devc->num_frame_bytes += len;
+                       devc->num_frame_bytes += len;
 
-                               if (devc->num_frame_bytes < devc->analog_frame_size)
-                                       /* Don't have the whole frame yet. */
-                                       return TRUE;
+                       if (devc->num_frame_bytes < devc->analog_frame_size)
+                               /* Don't have the whole frame yet. */
+                               return TRUE;
 
-                               sr_dbg("Frame completed, %d samples", devc->num_frame_bytes);
-                       } else {
-                               if (len != DS1000_ANALOG_LIVE_WAVEFORM_SIZE)
-                                       /* Don't have the whole frame yet. */
-                                       return TRUE;
-                       }
+                       sr_dbg("Frame completed, %d samples", devc->num_frame_bytes);
                } else {
                        logic.length = len - 10;
                        logic.unitsize = 2;