Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] dvbtune error-monitoring patch
Hi all
Since I tend to leave my nova-t card streaming for excessive periods of
time, to test signal strength, I wrote a patch against CVS version of
dvbtune. Ive added two command line switches
-d causes each line to be prefixed with the date in c-locale
%c and in seconds since epoche:
1042164232 Fri Jan 10 02:03:52 2003 Signal=10794, Verror=516, SNR=54741dB, BlockErrors=0, (S|L|C|V|SY|)
-e Filters lines where BlockErrors > 0
Both make it easy to log when errors occured.. a copy of gnuplot later and
its nice and easy to see when things were bad :)
Hope someone else finds it useful!
Patch is as follows:
diff -BNru dvbtune/dvbtune.c dvbtune.new/dvbtune.c
--- dvbtune/dvbtune.c Tue Oct 22 18:32:39 2002
+++ dvbtune.new/dvbtune.c Tue Dec 24 18:56:42 2002
@@ -46,6 +46,8 @@
#include <fcntl.h>
#include <unistd.h>
+#include <time.h>
+
// DVB includes:
#ifdef NEWSTRUCT
#include <linux/dvb/osd.h>
@@ -1053,7 +1055,9 @@
int do_info=0;
int do_scan=0;
int do_monitor=0;
-
+ int only_errors=0;
+ int date_prefix=0;
+
unsigned int freq=0;
char pol=0;
unsigned int srate=0;
@@ -1097,6 +1101,8 @@
fprintf(stderr,"-x Attempt to auto-find other transponders (experimental - DVB-S only)\n");
fprintf(stderr,"-m Monitor the reception quality\n");
+ fprintf(stderr,"-d Prefix monitor lines with date and time\n");
+ fprintf(stderr,"-e Only output actual error data\n");
fprintf(stderr,"-n dpid Add network interface and receive MPE on PID dpid\n");
fprintf(stderr,"\n");
return(-1);
@@ -1110,6 +1116,10 @@
do_info=1;
} else if (strcmp(argv[i],"-m")==0) { //
do_monitor=1;
+ } else if (strcmp(argv[i],"-e")==0) { //
+ only_errors=1;
+ } else if (strcmp(argv[i],"-d")==0) { //
+ date_prefix=1;
} else if (strcmp(argv[i],"-n")==0) { //
i++;
dpid=atoi(argv[i]);
@@ -1254,6 +1264,16 @@
FEReadSNR(fd_frontend, &snr);
FEReadUncorrectedBlocks(fd_frontend, &uncorr);
ioctl(fd_frontend,FE_READ_STATUS,&festatus);
+ if (!only_errors || uncorr) {
+ if (date_prefix) {
+ time_t datetime;
+ struct tm *datepre;
+ char dateprebuf[1024];
+ time(&datetime);
+ datepre=localtime(&datetime);
+ strftime(dateprebuf,1024,"%s\t%c\t",datepre);
+ fprintf(stderr,"%s",dateprebuf);
+ }
fprintf(stderr,"Signal=%d, Verror=%d, SNR=%ddB, BlockErrors=%d, (", strength, ber, snr, uncorr);
#ifndef NEWSTRUCT
if (festatus & FE_HAS_POWER) fprintf(stderr,"P|");
@@ -1266,7 +1286,7 @@
if (festatus & FE_HAS_SYNC) fprintf(stderr,"SY|");
fprintf(stderr,")\n");
sleep(1);
- }
+ }}
}
Chris Pitchford <cpitchford@intrepid.co.uk>
--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index