kopia lustrzana https://github.com/keenerd/rtl-sdr
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> Conflicts: src/rtl_fm.c src/rtl_power.c Both trough hold and bias tee used option -T in rtl_power. As trough hold is probably less used, it was changed to -M ("minimum").pull/21/head
rodzic
d5d316eb77
commit
6b6d0a76c2
|
@ -93,6 +93,7 @@ void usage(void)
|
|||
"\t[-e allowed_errors (default: 5)]\n"
|
||||
"\t[-g tuner_gain (default: automatic)]\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"
|
||||
"\tfilename (a '-' dumps samples to stdout)\n"
|
||||
"\t (omitting the filename also uses stdout)\n\n"
|
||||
"Streaming with netcat:\n"
|
||||
|
@ -368,11 +369,12 @@ int main(int argc, char **argv)
|
|||
int dev_index = 0;
|
||||
int dev_given = 0;
|
||||
int ppm_error = 0;
|
||||
int enable_biastee = 0;
|
||||
pthread_cond_init(&ready, NULL);
|
||||
pthread_mutex_init(&ready_m, NULL);
|
||||
squares_precompute();
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:g:p:e:Q:VS")) != -1)
|
||||
while ((opt = getopt(argc, argv, "d:g:p:e:Q:VST")) != -1)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
|
@ -397,6 +399,9 @@ int main(int argc, char **argv)
|
|||
case 'Q':
|
||||
quality = (int)(atof(optarg) * 10);
|
||||
break;
|
||||
case 'T':
|
||||
enable_biastee = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
return 0;
|
||||
|
@ -467,6 +472,10 @@ int main(int argc, char **argv)
|
|||
/* Set the sample rate */
|
||||
verbose_set_sample_rate(dev, ADSB_RATE);
|
||||
|
||||
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) */
|
||||
verbose_reset_buffer(dev);
|
||||
|
||||
|
|
12
src/rtl_fm.c
12
src/rtl_fm.c
|
@ -244,6 +244,7 @@ void usage(void)
|
|||
"\t raw mode outputs 2x16 bit IQ pairs\n"
|
||||
"\t[-s sample_rate (default: 24k)]\n"
|
||||
"\t[-d device_index (default: 0)]\n"
|
||||
"\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n"
|
||||
"\t[-g tuner_gain (default: automatic)]\n"
|
||||
"\t[-l squelch_level (default: 0/off)]\n"
|
||||
//"\t for fm squelch is inverted\n"
|
||||
|
@ -1484,6 +1485,7 @@ int main(int argc, char **argv)
|
|||
int r, opt;
|
||||
int dev_given = 0;
|
||||
int custom_ppm = 0;
|
||||
int enable_biastee = 0;
|
||||
|
||||
dongle_init(&dongle);
|
||||
demod_init(&demod);
|
||||
|
@ -1491,7 +1493,7 @@ int main(int argc, char **argv)
|
|||
output_init(&output);
|
||||
controller_init(&controller);
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:f:g:s:b:l:o:t:r:p:E:F:A:M:h")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "d:f:g:s:b:l:o:t:r:p:E:F:A:M:hT")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
dongle.dev_index = verbose_device_search(optarg);
|
||||
|
@ -1602,6 +1604,9 @@ int main(int argc, char **argv)
|
|||
demod.deemph = 1;
|
||||
demod.squelch_level = 0;}
|
||||
break;
|
||||
case 'T':
|
||||
enable_biastee = 1;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
|
@ -1672,6 +1677,11 @@ int main(int argc, char **argv)
|
|||
if (!custom_ppm) {
|
||||
verbose_ppm_eeprom(dongle.dev, &(dongle.ppm_error));
|
||||
}
|
||||
|
||||
rtlsdr_set_bias_tee(dongle.dev, enable_biastee);
|
||||
if (enable_biastee)
|
||||
fprintf(stderr, "activated bias-T on GPIO PIN 0\n");
|
||||
|
||||
verbose_ppm_set(dongle.dev, dongle.ppm_error);
|
||||
|
||||
if (strcmp(output.filename, "-") == 0) { /* Write samples to stdout */
|
||||
|
|
|
@ -170,6 +170,7 @@ void usage(void)
|
|||
"\t[-d device_index (default: 0)]\n"
|
||||
"\t[-g tuner_gain (default: automatic)]\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"
|
||||
"\tfilename (a '-' dumps samples to stdout)\n"
|
||||
"\t omitting the filename also uses stdout\n"
|
||||
"\n"
|
||||
|
@ -189,7 +190,7 @@ void usage(void)
|
|||
"\t possible values are 2M to 3.2M\n"
|
||||
"\t[-E enables epoch timestamps (default: off/verbose)]\n"
|
||||
"\t[-P enables peak hold (default: off/averaging)]\n"
|
||||
"\t[-T enables trough hold (default: off/averaging)]\n"
|
||||
"\t[-M enables trough hold (default: off/averaging)]\n"
|
||||
"\t[-L enable linear output (default: off/dB)]\n"
|
||||
"\t[-D direct_sampling_mode, 0 (default/off), 1 (I), 2 (Q), 3 (no-mod)]\n"
|
||||
"\t[-O enable offset tuning (default: off)]\n"
|
||||
|
@ -1037,6 +1038,8 @@ int main(int argc, char **argv)
|
|||
int single = 0;
|
||||
int direct_sampling = 0;
|
||||
int offset_tuning = 0;
|
||||
int enable_biastee = 0;
|
||||
double crop = 0.0;
|
||||
char *freq_optarg;
|
||||
time_t next_tick;
|
||||
time_t time_now;
|
||||
|
@ -1048,7 +1051,7 @@ int main(int argc, char **argv)
|
|||
init_misc(&ms);
|
||||
strcpy(dev_label, "DEFAULT");
|
||||
|
||||
while ((opt = getopt(argc, argv, "f:i:s:r:t:d:g:p:e:w:c:F:1EPTLD:Oh")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "f:i:s:r:t:d:g:p:e:w:c:F:1EPMLTD:Oh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'f': // lower:upper:bin_size
|
||||
if (f_set) {
|
||||
|
@ -1116,7 +1119,7 @@ int main(int argc, char **argv)
|
|||
case 'P':
|
||||
ms.peak_hold = 1;
|
||||
break;
|
||||
case 'T':
|
||||
case 'M':
|
||||
ms.peak_hold = -1;
|
||||
break;
|
||||
case 'L':
|
||||
|
@ -1132,6 +1135,9 @@ int main(int argc, char **argv)
|
|||
ms.boxcar = 0;
|
||||
ms.comp_fir_size = atoi(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
enable_biastee = 1;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
|
@ -1212,6 +1218,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
verbose_ppm_set(dev, ppm_error);
|
||||
|
||||
rtlsdr_set_bias_tee(dev, enable_biastee);
|
||||
if (enable_biastee)
|
||||
fprintf(stderr, "activated bias-T on GPIO PIN 0\n");
|
||||
|
||||
if (strcmp(filename, "-") == 0) { /* Write log to stdout */
|
||||
file = stdout;
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -392,7 +394,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);
|
||||
|
@ -423,6 +425,9 @@ int main(int argc, char **argv)
|
|||
ppm_error = atoi(optarg);
|
||||
custom_ppm = 1;
|
||||
break;
|
||||
case 'T':
|
||||
enable_biastee = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
|
@ -496,6 +501,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)
|
||||
|
|
Ładowanie…
Reference in New Issue