]> sigrok.org Git - libsigrok.git/commitdiff
session: Always read a whole number of samples.
authorDaniel Elstner <redacted>
Tue, 25 Feb 2014 23:29:55 +0000 (00:29 +0100)
committerBert Vermeulen <redacted>
Wed, 26 Feb 2014 20:38:41 +0000 (21:38 +0100)
session_driver.c

index d7e639f3d00234eec4fbb8dba9852c207c6a1ad5..69a53c6867102903fb22bee900b3eec652b348c9 100644 (file)
@@ -127,8 +127,12 @@ static int receive_data(int fd, int revents, void *cb_data)
                        return FALSE;
                }
 
-               ret = zip_fread(vdev->capfile, buf, CHUNKSIZE);
+               ret = zip_fread(vdev->capfile, buf,
+                               CHUNKSIZE / vdev->unitsize * vdev->unitsize);
                if (ret > 0) {
+                       if (ret % vdev->unitsize != 0)
+                               sr_warn("Read size %d not a multiple of the"
+                                       " unit size %d.", ret, vdev->unitsize);
                        got_data = TRUE;
                        packet.type = SR_DF_LOGIC;
                        packet.payload = &logic;