Add option '-T' for activating bias-T in rtl_(adsb|fm|power|tcp)

* added debug output when activating
Signed-off-by: hayati ayguen <h_ayguen@web.de>
* fixed options argument
Signed-off-by: Fabian P. Schmidt <kerel-fs@gmx.de>
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
hayati ayguen
2017-06-11 00:18:53 +02:00
committed by Steve Markgraf
parent fa3a113b77
commit 18bf26989c
4 changed files with 41 additions and 5 deletions

View File

@ -78,6 +78,7 @@ typedef struct { /* structure size must be multiple of 2 bytes */
static rtlsdr_dev_t *dev = NULL;
static int enable_biastee = 0;
static int global_numq = 0;
static struct llist *ll_buffers = 0;
static int llbuf_num = 500;
@ -95,7 +96,8 @@ void usage(void)
"\t[-b number of buffers (default: 15, set by library)]\n"
"\t[-n max number of linked list buffers to keep (default: 500)]\n"
"\t[-d device index (default: 0)]\n"
"\t[-P ppm_error (default: 0)]\n");
"\t[-P ppm_error (default: 0)]\n"
"\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n");
exit(1);
}
@ -395,7 +397,7 @@ int main(int argc, char **argv)
struct sigaction sigact, sigign;
#endif
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:")) != -1) {
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:T")) != -1) {
switch (opt) {
case 'd':
dev_index = verbose_device_search(optarg);
@ -425,6 +427,9 @@ int main(int argc, char **argv)
case 'P':
ppm_error = atoi(optarg);
break;
case 'T':
enable_biastee = 1;
break;
default:
usage();
break;
@ -495,6 +500,10 @@ int main(int argc, char **argv)
fprintf(stderr, "Tuner gain set to %f dB.\n", gain/10.0);
}
rtlsdr_set_bias_tee(dev, enable_biastee);
if (enable_biastee)
fprintf(stderr, "activated bias-T on GPIO PIN 0\n");
/* Reset endpoint before we start reading from it (mandatory) */
r = rtlsdr_reset_buffer(dev);
if (r < 0)