diff --git a/README.md b/README.md index 894cdcb..3bc1073 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/acarsdec.c b/acarsdec.c index e96581d..329f517 100644 --- a/acarsdec.c +++ b/acarsdec.c @@ -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': diff --git a/acarsdec.h b/acarsdec.h index e0b6428..953d26f 100644 --- a/acarsdec.h +++ b/acarsdec.h @@ -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 *); diff --git a/rtl.c b/rtl.c index a0c7042..5831827 100644 --- a/rtl.c +++ b/rtl.c @@ -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; }