Guenael / rtlsdr-wsprd

WSPR daemon for RTL receivers
GNU General Public License v3.0
112 stars 32 forks source link

Feature/read files #119

Closed dforsi closed 2 years ago

dforsi commented 2 years ago

One commit of this PR is the same as the one in PR #118.

I think that the current code is too complicated and that it's uncommon that fread() read less than what found with fseek()+ftell(), but then the code reads any short file, as it should, since chances are that some signals would be decoded anyway thanks to error correction, eg. with half of 211212_2142.zip rtlsdr_wsprd can decode the same signal as with the full file:

$ dd if=211212_2142.c2 of=half_211212_2142.c2 ibs=1 count=180026
$ ./rtlsdr_wsprd [...]
Reading IQ file: c2/half_211212_2142.c2
Number of samples: 22500
        SNR      DT        Freq Dr    Call    Loc Pwr
Spot : -15.08  -0.08   7.040093  0   M0ICR   IO91 27

A message about less samples than expected would be useful.

Avoiding the use of fseek() would allow to read the files from a pipe or /dev/stdin (if the check for file extensions allowed that), like was asked in issue #20.

Guenael commented 2 years ago

Agree, good call!