Commit 2f029024 authored by Federico Vaga's avatar Federico Vaga

tools: fix binary file writing

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent ba3fdb3a
......@@ -115,7 +115,6 @@ static int timeout = -1;
static int loop = 1;
static char *basefile;
static unsigned int nsamples = 0;
static unsigned int ssize = 0;
static char *_argv[16];
static uint32_t nchan;
......@@ -728,7 +727,7 @@ static int fald_acq_write_single(struct adc_buffer *buf)
err++;
#endif
data = buf->data;
if (fwrite(data, ssize, nsamples, f) != nsamples)
if (fwrite(data, buf->samplesize, nsamples, f) != nsamples)
err++;
if (err) {
......@@ -779,7 +778,7 @@ static int fald_acq_write_multiple(struct adc_buffer *buf,
return -1;
}
data = buf->data;
if (fwrite(data, ssize, nsamples, f)
if (fwrite(data, buf->samplesize, nsamples, f)
!= nsamples) {
fprintf(stderr, "write(%s): short write\n", fname);
return -1;
......@@ -981,7 +980,6 @@ int main(int argc, char *argv[])
adc_get_conf(&cfg_acq, ADC_CONF_ACQ_N_BITS, &bits);
adc_get_conf(&cfg_acq, ADC_CONF_ACQ_N_SHOTS, &nshots);
nsamples = pre + post;
ssize = (bits + (8 - 1)) / 8; /* get sample size - round up */
buf = adc_request_buffer(adc, nsamples, NULL /* alloc */, 0);
if (!buf) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment