Commit 7de3cab6 authored by Federico Vaga's avatar Federico Vaga

Merge commit 'tools: fix binary file writing' into develop

parents a3407e56 2f029024
......@@ -171,7 +171,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;
......@@ -888,7 +887,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) {
......@@ -939,7 +938,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;
......@@ -1175,7 +1174,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