From 22afb5410579757ed9e5befeb78f51a6c7132396 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 8 Feb 2024 23:53:37 -0500 Subject: [PATCH 1/4] added RTLSDR bias tee support --- acarsdec.c | 8 ++++++-- acarsdec.h | 1 + rtl.c | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/acarsdec.c b/acarsdec.c index e96581d..25a1ae5 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, @@ -242,7 +243,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 +289,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; } From 7492d8b78b05eaf24978767e4658878e65968abe Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 9 Feb 2024 00:07:06 -0500 Subject: [PATCH 2/4] typo --- acarsdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/acarsdec.c b/acarsdec.c index 25a1ae5..329f517 100644 --- a/acarsdec.c +++ b/acarsdec.c @@ -112,7 +112,7 @@ static void usage(void) #endif #ifdef WITH_RTL fprintf(stderr, - " [-g gain] [-p ppm] [-b bias] -r rtldevicenumber f1 [f2] ... [fN]"); + " [-g gain] [-p ppm] [-B bias] -r rtldevicenumber f1 [f2] ... [fN]"); #endif #ifdef WITH_AIR fprintf(stderr, @@ -174,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 From a2332e3b6e17ce514ba48d1b72df6dc6e3fa76c0 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 9 Feb 2024 00:08:50 -0500 Subject: [PATCH 3/4] typo --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 894cdcb..ea2480f 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) From 0a083a99fb6340f097baa26574f52dbadb414528 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 9 Feb 2024 00:10:10 -0500 Subject: [PATCH 4/4] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea2480f..3bc1073 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ for the RTLSDR device -p ppm : set rtl ppm frequency correction - -B bias: Enable (1) or Disable (0) the bias tee (default is 0) + -B bias : Enable (1) or Disable (0) the bias tee (default is 0) for the AirSpy device -g gain : set airspy gain (0..21)