From e170c431d881e336e529a2d9f1759249d9026160 Mon Sep 17 00:00:00 2001 From: Stefan Groenroos Date: Fri, 14 Nov 2014 16:20:24 +0200 Subject: [PATCH 1/3] Added option to disable dithering to rtl_tcp in the same way as in rtl_sdr --- src/rtl_tcp.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c index 35eadac..047e683 100644 --- a/src/rtl_tcp.c +++ b/src/rtl_tcp.c @@ -95,7 +95,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[-N no dithering (default: use dithering)]\n"); exit(1); } @@ -371,6 +372,7 @@ int main(int argc, char **argv) int gain = 0; int ppm_error = 0; int custom_ppm = 0; + int dithering = 1; struct llist *curelem,*prev; pthread_attr_t attr; void *status; @@ -388,7 +390,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:N:")) != -1) { switch (opt) { case 'd': dev_index = verbose_device_search(optarg); @@ -419,6 +421,9 @@ int main(int argc, char **argv) ppm_error = atoi(optarg); custom_ppm = 1; break; + case 'N': + dithering = 0; + break; default: usage(); break; @@ -455,6 +460,17 @@ int main(int argc, char **argv) SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE ); #endif + /* Enable/disable dithering */ + if (!dithering) { + fprintf(stderr, "Disabling dithering... "); + r = rtlsdr_set_dithering(dev, dithering); + if (r) { + fprintf(stderr, "failure\n"); + } else { + fprintf(stderr, "success\n"); + } + } + /* Set the tuner error */ if (!custom_ppm) { verbose_ppm_eeprom(dev, &ppm_error); From f7079e14fa4d63bc994c48538bc47198211ea091 Mon Sep 17 00:00:00 2001 From: Stefan Groenroos Date: Fri, 14 Nov 2014 16:30:10 +0200 Subject: [PATCH 2/3] Small fix --- src/rtl_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c index 047e683..1c2a37a 100644 --- a/src/rtl_tcp.c +++ b/src/rtl_tcp.c @@ -390,7 +390,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:N:")) != -1) { + while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:N")) != -1) { switch (opt) { case 'd': dev_index = verbose_device_search(optarg); From a861d40af1fad62aebc174094d650c1e1a1ebbf7 Mon Sep 17 00:00:00 2001 From: Stefan Groenroos Date: Mon, 17 Nov 2014 18:35:07 +0200 Subject: [PATCH 3/3] Whitespace fixes --- src/rtl_tcp.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c index 1c2a37a..1dc8047 100644 --- a/src/rtl_tcp.c +++ b/src/rtl_tcp.c @@ -95,8 +95,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[-N no dithering (default: use dithering)]\n"); + "\t[-P ppm_error (default: 0)]\n" + "\t[-N no dithering (default: use dithering)]\n"); exit(1); } @@ -372,7 +372,7 @@ int main(int argc, char **argv) int gain = 0; int ppm_error = 0; int custom_ppm = 0; - int dithering = 1; + int dithering = 1; struct llist *curelem,*prev; pthread_attr_t attr; void *status; @@ -390,7 +390,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:N")) != -1) { + while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:N")) != -1) { switch (opt) { case 'd': dev_index = verbose_device_search(optarg); @@ -421,9 +421,9 @@ int main(int argc, char **argv) ppm_error = atoi(optarg); custom_ppm = 1; break; - case 'N': - dithering = 0; - break; + case 'N': + dithering = 0; + break; default: usage(); break; @@ -460,16 +460,16 @@ int main(int argc, char **argv) SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE ); #endif - /* Enable/disable dithering */ - if (!dithering) { - fprintf(stderr, "Disabling dithering... "); - r = rtlsdr_set_dithering(dev, dithering); - if (r) { - fprintf(stderr, "failure\n"); - } else { - fprintf(stderr, "success\n"); - } - } + /* Enable/disable dithering */ + if (!dithering) { + fprintf(stderr, "Disabling dithering... "); + r = rtlsdr_set_dithering(dev, dithering); + if (r) { + fprintf(stderr, "failure\n"); + } else { + fprintf(stderr, "success\n"); + } + } /* Set the tuner error */ if (!custom_ppm) {