Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ else()
endif()
message ( STATUS "Using libairspy: ${WITH_AIR}")

option(SDRPLAY "Enable SDRplay support via API version 2" ON)
option(SDRPLAY "Enable SDRplay support via API version 3" ON)

if(SDRPLAY)
SET(WITH_SDRPLAY NO)
find_library(LIBPLAY mirsdrapi-rsp)
find_library(LIBPLAY sdrplay_api)
if(LIBPLAY)
add_definitions(-DWITH_SDRPLAY )
target_sources( acarsdec PRIVATE sdrplay.c)
Expand All @@ -151,7 +151,7 @@ if(SDRPLAY)
else()
SET(WITH_SDRPLAY DISABLED)
endif()
message ( STATUS "Using libmirsdrapi-rsp: ${WITH_SDRPLAY}")
message ( STATUS "Using sdrplay_api: ${WITH_SDRPLAY}")

option(SOAPYSDR "Enable SoapySDR support" ON)

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ It depends on some optional external libraries :
* librtlsdr for RTL-based SDR input (http://sdr.osmocom.org/trac/wiki/rtl-sdr)
* libsoapysdr for SoapySDR input (https://github.com/pothosware/SoapySDR)
* libairspy for airspy SDR input (https://github.com/airspy/airspyone_host)
* libmirsdrapi-rsp for sdrplay software radio input
* libsdrplay_api for sdrplay software radio input
* libsndfile for audio input (https://github.com/libsndfile/libsndfile)
* libasound for ALSA input (https://github.com/alsa-project/alsa-lib)
* libacars for decoding ATS applications (https://github.com/szpajder/libacars)
Expand Down Expand Up @@ -199,13 +199,19 @@ DESTPARAMS are:
Note: acarsdec will try to set the R820T tuner bandwidth to suit given frequencies.
See https://tleconte.github.io/R820T/r820IF.html

#### SDRplay (untested, uses legacy v2 API - help wanted)
#### SDRplay (API version 3.15 and above)

```
--sdrplay decode from sdrplay
-a <antenna> set antenna port to use (default: first antenna)
-c <freq> set center frequency to tune to in MHz, e.g. 131.800 (default: automatic)
-G <GRdB> gain reduction in dB's, range 20 .. 59 (default: -100 is autogain)
-R <sample rate> sample rate in kHz - must be a multiple of 12, range 72 .. 10000 (default: 3024)
-W <bandwidth> IF bandwidth in kHz - one of: 200, 300, 600, 1536, 5000, 6000, 7000, and 8000 (default: 1536)
-G <gRdB> gain reduction in dB's, range 20 .. 59 (default: -100 is autogain)
-L <lnaState> set the lnaState (depends on the device)
-n <notch filter> enable notch filter - one of RF, FM, DAB, or RSPduo-AM (default: none enabled)
-p <ppm> set ppm frequency correction (default: 0)
-B <bias> enable (1) or disable (0) the bias tee (default is 0)
```

All SDR sources described above expect a list of frequencies `<f1> [<f2> [...]]` to decode from, expressed in decimal MHz
Expand Down
47 changes: 40 additions & 7 deletions acarsdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,15 @@ static void usage(void)
fprintf(stderr,
"\n sdrplayopts:\n"
" --sdrplay\t\t: decode from sdrplay\n"
" -a <antenna>\t\t: set antenna port to use (default: first antenna)\n"
" -c <freq>\t\t: set center frequency to tune to in MHz, e.g. 131.800 (default: automatic)\n"
" -G <GRdB>\t\t: gain reduction in dB's, range 20 .. 59 (default: -100 is autogain)\n"
" -L <lnaState>\t: set the lnaState (depends on the device)\n");
" -R <sample rate>\t: sample rate in kHz - must be a multiple of 12, range 72 .. 10000 (default: 3024)\n"
" -W <bandwidth>\t\t: IF bandwidth in kHz - one of: 200, 300, 600, 1536, 5000, 6000, 7000, and 8000 (default: depends on sample rate)\n"
" -G <gRdB>\t\t: gain reduction in dB's, range 20 .. 59 (default: -100 is autogain)\n"
" -L <lnaState>\t\t: set the lnaState (depends on the device)\n"
" -n <notch filter>\t: enable notch filter - one of RF, FM, DAB, or RSPduo-AM (default: none enabled)\n"
" -p <ppm>\t\t: set ppm frequency correction (default: 0)\n"
" -B <bias>\t\t: enable (1) or disable (0) the bias tee (default is 0)\n");
#endif
#ifdef WITH_SOAPY
fprintf(stderr,
Expand Down Expand Up @@ -262,6 +268,7 @@ int main(int argc, char **argv)
int c;
int res;
unsigned int n;
unsigned int sr;
struct sigaction sigact;
struct option long_opts[] = {
#ifdef WITH_ALSA
Expand All @@ -277,7 +284,7 @@ int main(int argc, char **argv)
{ "airspy", required_argument, NULL, IN_AIR },
#endif
#ifdef WITH_SDRPLAY
{ "sdrplay", no_argument, NULL, IN_SDRPLAY },
{ "sdrplay", required_argument, NULL, IN_SDRPLAY },
#endif
#ifdef WITH_SOAPY
{ "soapysdr", required_argument, NULL, IN_SOAPY },
Expand All @@ -299,7 +306,7 @@ int main(int argc, char **argv)
R.idstation = strdup(sys_hostname);

res = 0;
while ((c = getopt_long(argc, argv, "hvt:g:m:a:Aep:c:i:L:G:b:B:", long_opts, NULL)) != EOF) {
while ((c = getopt_long(argc, argv, "hvt:g:m:a:Aep:c:i:R:W:L:G:n:b:B:", long_opts, NULL)) != EOF) {
switch (c) {
case -2:
res = setup_output(optarg);
Expand Down Expand Up @@ -364,12 +371,35 @@ int main(int argc, char **argv)
if (R.inmode)
errx(-1, "Only 1 input allowed");
R.inmode = IN_SDRPLAY;
inarg = optarg;
break;
case 'R':
sr = (unsigned)atoi(optarg);
if (sr % (INTRATE / 1000))
errx(-1, "Invalid sample rate (not a multiple of 12k)");
if (sr < 72 || sr > 10000)
errx(-1, "Sample rate out of range 72 .. 10000");
R.rateMult = sr / (INTRATE / 1000);
break;
case 'W':
R.bandwidth = atoi(optarg);
break;
case 'L':
R.lnaState = atoi(optarg);
break;
case 'G':
R.GRdB = atoi(optarg);
R.gRdB = atoi(optarg);
break;
case 'n':
if (strcasecmp(optarg, "RF") == 0 || strcasecmp(optarg, "FM") == 0) {
R.rfNotch = 1;
} else if (strcasecmp(optarg, "DAB") == 0) {
R.dabNotch = 1;
} else if (strcasecmp(optarg, "RSPduo-AM") == 0) {
R.rspDuoAmNotch = 1;
} else {
errx(-1, "Invalid notch selection");
}
break;
#endif
#ifdef WITH_SOAPY
Expand All @@ -379,6 +409,8 @@ int main(int argc, char **argv)
R.inmode = IN_SOAPY;
inarg = optarg;
break;
#endif
#if defined(WITH_SOAPY) || defined(WITH_SDRPLAY)
case 'a':
R.antenna = optarg;
break;
Expand Down Expand Up @@ -445,7 +477,7 @@ int main(int argc, char **argv)
#endif
#ifdef WITH_SDRPLAY
case IN_SDRPLAY:
res = initSdrplay();
res = initSdrplay(inarg);
break;
#endif
#ifdef WITH_SOAPY
Expand Down Expand Up @@ -532,7 +564,8 @@ int main(int argc, char **argv)
#endif
#ifdef WITH_SDRPLAY
case IN_SDRPLAY:
res = runSdrplaySample();
runSdrplaySample();
res = runSdrplayClose();
break;
#endif
#ifdef WITH_SOAPY
Expand Down
10 changes: 8 additions & 2 deletions acarsdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,17 @@ typedef struct {
int ppm;
int bias;
unsigned int rateMult;
#ifdef WITH_SDRPLAY
int bandwidth;
int lnaState;
int GRdB;
int gRdB;
int rfNotch;
int dabNotch;
int rspDuoAmNotch;
#endif
unsigned int Fc, minFc, maxFc;

#ifdef WITH_SOAPY
#if defined(WITH_SOAPY) || defined(WITH_SDRPLAY)
char *antenna;
#endif
} runtime_t;
Expand Down
Loading