add -D direct sampling flag to rtl_tcp

This commit is contained in:
rtlsdrblog 2023-08-23 22:40:21 +12:00
parent 8426cbe3f0
commit 65c8e96bb2
2 changed files with 12 additions and 2 deletions

View File

@ -1248,7 +1248,7 @@ int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on)
* specified bias tee support. Offset tuning is not used for * specified bias tee support. Offset tuning is not used for
*R820T devices so it is no problem. *R820T devices so it is no problem.
*/ */
rtlsdr_set_gpio(dev, 0, on); rtlsdr_set_bias_tee(dev, on);
return -2; return -2;
} }

View File

@ -105,6 +105,7 @@ void usage(void)
printf("\t[-d device index (default: 0)]\n"); printf("\t[-d device index (default: 0)]\n");
printf("\t[-P ppm_error (default: 0)]\n"); printf("\t[-P ppm_error (default: 0)]\n");
printf("\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n"); printf("\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n");
printf("\t[-D enable direct sampling (default: off)]\n");
exit(1); exit(1);
} }
@ -396,6 +397,7 @@ int main(int argc, char **argv)
int dev_given = 0; int dev_given = 0;
int gain = 0; int gain = 0;
int ppm_error = 0; int ppm_error = 0;
int direct_sampling = 0;
struct llist *curelem,*prev; struct llist *curelem,*prev;
pthread_attr_t attr; pthread_attr_t attr;
void *status; void *status;
@ -413,7 +415,7 @@ int main(int argc, char **argv)
struct sigaction sigact, sigign; struct sigaction sigact, sigign;
#endif #endif
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:T")) != -1) { while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:TD")) != -1) {
switch (opt) { switch (opt) {
case 'd': case 'd':
dev_index = verbose_device_search(optarg); dev_index = verbose_device_search(optarg);
@ -446,6 +448,9 @@ int main(int argc, char **argv)
case 'T': case 'T':
enable_biastee = 1; enable_biastee = 1;
break; break;
case 'D':
direct_sampling = 1;
break;
default: default:
usage(); usage();
break; break;
@ -482,6 +487,11 @@ int main(int argc, char **argv)
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE ); SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
#endif #endif
/* Set direct sampling */
if (direct_sampling || frequency < 2800000) {
verbose_direct_sampling(dev, 2);
}
/* Set the tuner error */ /* Set the tuner error */
verbose_ppm_set(dev, ppm_error); verbose_ppm_set(dev, ppm_error);