Skip to content

Commit

Permalink
added RTLSDR bias tee support
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools authored and f00b4r0 committed Jul 11, 2024
1 parent 7920079 commit 0b2440a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ for the RTLSDR device

-p ppm : set rtl ppm frequency correction

-B bias : Enable (1) or Disable (0) the bias tee (default is 0)

for the AirSpy device
-g gain : set airspy gain (0..21)

Expand Down
9 changes: 7 additions & 2 deletions acarsdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ int skip_reassembly = 0;
int gain = -100;
int ppm = 0;
int rtlMult = 160;
int bias = 0;
#endif

#ifdef WITH_AIR
Expand Down Expand Up @@ -111,7 +112,7 @@ static void usage(void)
#endif
#ifdef WITH_RTL
fprintf(stderr,
" [-g gain] [-p ppm] -r rtldevicenumber f1 [f2] ... [fN]");
" [-g gain] [-p ppm] [-B bias] -r rtldevicenumber f1 [f2] ... [fN]");
#endif
#ifdef WITH_AIR
fprintf(stderr,
Expand Down Expand Up @@ -173,6 +174,7 @@ static void usage(void)
" -g gain\t\t: set rtl gain in db (0 to 49.6; >52 and -10 will result in AGC; default is AGC)\n");
fprintf(stderr, " -p ppm\t\t\t: set rtl ppm frequency correction\n");
fprintf(stderr, " -m rtlMult\t\t\t: set rtl sample rate multiplier: 160 for 2 MS/s or 192 for 2.4 MS/s (default: 160)\n");
fprintf(stderr, " -B bias\t\t\t: Enable (1) or Disable (0) the bias tee (default is 0)\n");
fprintf(stderr,
" -r rtldevice f1 [f2]...[f%d]\t: decode from rtl dongle number or S/N rtldevice receiving at VHF frequencies f1 and optionally f2 to f%d in Mhz (ie : -r 0 131.525 131.725 131.825 )\n", MAXNBCHANNELS, MAXNBCHANNELS);
#endif
Expand Down Expand Up @@ -242,7 +244,7 @@ int main(int argc, char **argv)
idstation = strdup(sys_hostname);

res = 0;
while ((c = getopt_long(argc, argv, "HDvarfdsRo:t:g:m:Aep:n:N:j:l:c:i:L:G:b:M:P:U:T:", long_opts, NULL)) != EOF) {
while ((c = getopt_long(argc, argv, "HDvarfdsRo:t:g:m:Aep:n:N:j:l:c:i:L:G:b:M:P:U:T:B:", long_opts, NULL)) != EOF) {

switch (c) {
case 'v':
Expand Down Expand Up @@ -288,6 +290,9 @@ int main(int argc, char **argv)
case 'm':
rtlMult = atoi(optarg);
break;
case 'B':
bias = atoi(optarg);
break;
#endif
#ifdef WITH_SDRPLAY
case 's':
Expand Down
1 change: 1 addition & 0 deletions acarsdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ extern int mdly;
extern int hourly, daily;

extern int ppm;
extern int bias;
extern int lnaState;
extern int GRdB;
extern int initOutput(char*,char *);
Expand Down
7 changes: 7 additions & 0 deletions rtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ int initRtl(char **argv, int optind)
return 1;
}

r = rtlsdr_set_bias_tee(dev, bias);
if (verbose)
fprintf(stderr, "Set Bias Tee to %d\n", bias);
if(r < 0){
fprintf(stderr, "WARNING: Failed to set bias tee\n");
return 1;
}
return 0;
}

Expand Down

0 comments on commit 0b2440a

Please sign in to comment.