From: Daniel Elstner Date: Tue, 25 Feb 2014 23:29:55 +0000 (+0100) Subject: session: Always read a whole number of samples. X-Git-Tag: libsigrok-0.3.0~135 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8bbdd364d3355ee5e39b4573910f7b300ecf6d09;p=libsigrok.git session: Always read a whole number of samples. --- diff --git a/session_driver.c b/session_driver.c index d7e639f3..69a53c68 100644 --- a/session_driver.c +++ b/session_driver.c @@ -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;