Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RTLSDR bias tee support #116

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

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

#ifdef WITH_AIR
@@ -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,
@@ -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
@@ -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':
@@ -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':
1 change: 1 addition & 0 deletions acarsdec.h
Original file line number Diff line number Diff line change
@@ -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 *);
7 changes: 7 additions & 0 deletions rtl.c
Original file line number Diff line number Diff line change
@@ -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;
}