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

added RTLSDR bias tee support with -B #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 6 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ FILE *logfd;
#ifdef WITH_RTL
int gain = 450;
int ppm = 0;
int bias = 0;
#endif
#ifdef WITH_AIR
int gain = 18;
Expand All @@ -66,7 +67,7 @@ static void usage(void)
"vdlm2dec %s Copyright (c) 2016-2023 Thierry Leconte \n\n", VDLM2DEC_VERSION);
fprintf(stderr, "Usage: vdlm2dec [-J] [-q] [-j addr:port ] [-s addr:port ] [-l logfile] [-g gain]");
#ifdef WITH_RTL
fprintf(stderr, " [-p ppm] -r rtldevicenumber");
fprintf(stderr, " [-p ppm] [-B bias] -r rtldevicenumber");
#endif
#ifdef WITH_AIR
fprintf(stderr, " [-k airspy_serial_number]");
Expand All @@ -93,6 +94,7 @@ static void usage(void)
fprintf(stderr,
" -g gain :\t\tset rtl preamp gain in tenth of db (ie -g 90 for +9db).\n");
fprintf(stderr, " -p ppm :\t\tppm frequency correction\n");
fprintf(stderr, " -B bias :\t\tEnable (1) or Disable(0) bias tee\n");
#endif
#ifdef WITH_AIR
fprintf(stderr,
Expand Down Expand Up @@ -123,7 +125,7 @@ int main(int argc, char **argv)
nbch = 0;
logfd = stdout;

while ((c = getopt(argc, argv, "vqrp:g:k:l:JRj:s:i:GEUb:a")) != EOF) {
while ((c = getopt(argc, argv, "vqrp:g:k:l:JRj:s:i:GEUb:a:B:")) != EOF) {
switch (c) {
case 'v':
verbose = 2;
Expand All @@ -148,6 +150,8 @@ int main(int argc, char **argv)
case 'g':
gain = atoi(optarg);
break;
case 'B':
bias = atoi(optarg);
#endif
#ifdef WITH_AIR
case 'g':
Expand Down
8 changes: 8 additions & 0 deletions rtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ int initRtl(char **argv, int optind, thread_param_t * param)
return 1;
}

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

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions vdlm2.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ extern pthread_barrier_t Bar1, Bar2;

#ifdef WITH_RTL
extern int ppm;
extern int bias;
extern complex float Cbuff[RTLINBUFSZ / 2];
#endif
#ifdef WITH_AIR
Expand Down