From: Bert Vermeulen Date: Thu, 23 Jan 2014 00:09:16 +0000 (+0100) Subject: ols: Don't reduce sample count just because it's not a multiple of 4. X-Git-Tag: libsigrok-0.3.0~208 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=32f09bfd9e2eaa6b909a672f779b74c53838120e;p=libsigrok.git ols: Don't reduce sample count just because it's not a multiple of 4. --- diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 2d201bb2..7852b6ce 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -422,7 +422,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, struct sr_serial_dev_inst *serial; uint32_t trigger_config[4]; uint32_t data; - uint16_t readcount, delaycount; + uint16_t samplecount, readcount, delaycount; uint8_t changrp_mask; int num_channels; int i; @@ -456,7 +456,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, * Limit readcount to prevent reading past the end of the hardware * buffer. */ - readcount = MIN(devc->max_samples / num_channels, devc->limit_samples) / 4; + samplecount = MIN(devc->max_samples / num_channels, devc->limit_samples); + readcount = samplecount / 4; + if (samplecount % 4) + readcount++; memset(trigger_config, 0, 16); trigger_config[devc->num_stages] |= 0x08;