Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Idea for getting SNR/BER, etc. on OSD without patchingVDR, maybe in plugin



Hi Rene,

Rene Bartsch schrieb:
Hi,

szap of current drivers includes femon-tool (femon.c -> femon).

This is a read-only tool accessing adapterX/frontendX. So it can run parallel to the application (VDR) and display values on stdout.

My approach is to use "femon -aX -f0 | svdrpsend.pl" in commands.conf to get SNR/BER, etc. on screen.
whilst not being a c programmer i start to learn by
doing, so i fiddled a little bit or two around,
and for people not wanting to patch vdr (techpatch)
i patched femon to generate only signal % and snr % output
suitable for vdr osd output (via commands.conf).

example
~~~~~from commands.conf~~~~~~~~
1 Get DVB signal and s/nr info:/vdr/DVB/apps/szap/femon
2 Get info for 2nd DVB card:/vdr/DVB/apps/szap/femon -a1
3 Get info from both:/vdr/DVB/apps/szap/femon -a0;/vdr/DVB/apps/szap/femon -a1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

or you can use a shell script to display these values
to the osd, or put to logfile, in a loop or single run,
but always keep 1 second in between the calls, since
the FE may get stuck if called too often, and else it
will return garbage if called too often.


femon is found in the apps/szap folder of the recent driver,
if you want detailed output, see line 48 in femon.c and
uncomment the "define ADVANCED_OUTPUT = 1", and more output
will be generated.(the percentage output and the original
femon output)

Have fun :-)
Onno



Maybe someone with C++-capabilities can use femon-code in a plugin recalculating the HEX-values to human readable values.
P.S.
was really easy, mostly an u for x and some math + ifdef


Rene




--- femon.c	Mon May  5 18:27:14 2003
+++ vdr-fe-check.c	Sat Jun 14 14:37:40 2003
@@ -43,10 +43,12 @@
 #ifndef FALSE
 #define FALSE (1==0)
 #endif
-
-
 #define FRONTENDDEVICE "/dev/dvb/adapter%d/frontend%d"
 
+//#define ADVANCED_OUTPUT = 1
+//uncomment above to get more output (hex values,frontend type,..)
+//patch by okx(at)gmc(dot)de, contact user "memed" at vdrportal.de
+
 static char *usage_str =
     "\nusage: femon [options]\n"
     "     -a number : use given adapter (default 0)\n"
@@ -64,25 +66,31 @@
 int check_frontend (int fe_fd)
 {
    fe_status_t status;
-   uint16_t snr, signal;
+   uint16_t snr, signal, snr_o, signal_o;
    uint32_t ber, uncorrected_blocks;
 
-   do {
+//   do {
       ioctl(fe_fd, FE_READ_STATUS, &status);
       ioctl(fe_fd, FE_READ_SIGNAL_STRENGTH, &signal);
       ioctl(fe_fd, FE_READ_SNR, &snr);
       ioctl(fe_fd, FE_READ_BER, &ber);
       ioctl(fe_fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks);
 
-      printf ("status %02x | signal %04x | snr %04x | ber %08x | unc %08x | ",
-	      status, signal, snr, ber, uncorrected_blocks);
+      signal_o=signal / 655;
+      snr_o=snr / 655;
 
+      printf ("signal%%: %02u| snr%%: %02u \n",	
+		      signal_o, snr_o);
+#ifdef ADVANCED_OUTPUT
+      printf ("status %02x| signal %04x| snr %04x| ber %08x| unc %08x| ",
+	      status, signal, snr, ber, uncorrected_blocks);
+      
       if (status & FE_HAS_LOCK)
 	 printf("FE_HAS_LOCK");
-
-      printf("\n");
-      usleep(1000000);
-   } while (1);
+         printf("\n");
+#endif
+//      usleep(1000000);
+//   } while (1);
 
    return 0;
 }
@@ -97,8 +105,9 @@
    struct dvb_frontend_info fe_info;
 
    snprintf(fedev, sizeof(fedev), FRONTENDDEVICE, adapter, frontend);
+#ifdef ADVANCED_OUTPUT
    printf("using '%s'\n", fedev);
-
+#endif
    if ((fefd = open(fedev, O_RDONLY | O_NONBLOCK)) < 0) {
       perror("opening frontend failed");
       return FALSE;
@@ -111,10 +120,10 @@
       close(fefd);
       return FALSE;
    }
-
+#ifdef ADVANCED_OUTPUT
    printf("FE: %s (%s)\n", fe_info.name, fe_info.type == FE_QPSK ? "SAT" :
 		   fe_info.type == FE_QAM ? "CABLE": "TERRESTRIAL");
-
+#endif
    check_frontend (fefd);
 
    close(fefd);

Home | Main Index | Thread Index