In repeat mode, rewind file as many times as needed to fill buffer.

Fixes #720.
This commit is contained in:
Martin Ling
2022-08-07 18:01:09 +01:00
parent 06a0c2b189
commit 0c35cff05b

View File

@ -538,9 +538,16 @@ int tx_callback(hackrf_transfer* transfer)
return -1; /* not repeat mode, end of file */
}
while (bytes_read < bytes_to_read) {
fprintf(stderr, "Input file end reached. Rewind to beginning.\n");
rewind(file);
fread(transfer->buffer + bytes_read, 1, bytes_to_read - bytes_read, file);
bytes_read +=
fread(transfer->buffer + bytes_read,
1,
bytes_to_read - bytes_read,
file);
}
return 0;
}