X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fopenbench-logic-sniffer%2Fapi.c;h=8ff1456daad47e8896fb6aaec6a1b8b387b59d94;hp=fc0d9ebdb3afe6813e7e3e26fed2258dc449e37d;hb=aad0c777088b7a4571272fa168a81ff9a2df05dc;hpb=b04cbd0ba3301396bd9e1e31c6f462087caf1de8 diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index fc0d9ebd..8ff1456d 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -396,7 +396,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_serial_dev_inst *serial; - uint16_t samplecount, readcount, delaycount; + uint32_t samplecount, readcount, delaycount; uint8_t ols_changrp_mask, arg[4]; int num_ols_changrp; int ret, i; @@ -417,14 +417,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* * Limit readcount to prevent reading past the end of the hardware - * buffer. + * buffer. Rather read too many samples than too few. */ samplecount = MIN(devc->max_samples / num_ols_changrp, devc->limit_samples); - readcount = samplecount / 4; - - /* Rather read too many samples than too few. */ - if (samplecount % 4 != 0) - readcount++; + readcount = (samplecount + 3) / 4; /* Basic triggers. */ if (ols_convert_trigger(sdi) != SR_OK) {