[PATCH] output calculated ppm to stderr

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Андрей Родионов rodionovamp at mail.ru
Sat Sep 23 09:07:48 UTC 2017


Good day,

I found an issue, when i call rtl_test from external program with "-p” argument. PPM is written into stdout, which means it will be automatically flushed on interactive shell or when fflush called manually. Neither of this was used. All other output was written to stderr, hence simple patch:

diff --git a/src/rtl_test.c b/src/rtl_test.c
index 9a6cfda..c7e60c5 100644
--- a/src/rtl_test.c
+++ b/src/rtl_test.c
@@ -202,7 +202,7 @@
 	interval += (int64_t)(ppm_now.tv_nsec - ppm_recent.tv_nsec);
 	nsamples_total += nsamples;
 	interval_total += interval;
-	printf("real sample rate: %i current PPM: %i cumulative PPM: %i\n",
+	fprintf(stderr, "real sample rate: %i current PPM: %i cumulative PPM: %i\n",
 		(int)((1000000000UL * nsamples) / interval),
 		ppm_report(nsamples, interval),
 		ppm_report(nsamples_total, interval_total));


Best Regards,
Andrey


More information about the osmocom-sdr mailing list