[linux-dvb] [patch] display femon ss and snr in percent

Ludwig Nussel ludwig.nussel at suse.de
Thu Sep 29 11:56:07 CEST 2005


a percentage number is more readable than some hex value sometimes :-)

Index: dvb-apps/util/szap/femon.c
===================================================================
--- dvb-apps.orig/util/szap/femon.c
+++ dvb-apps/util/szap/femon.c
@@ -44,6 +44,7 @@
 #define FALSE (1==0)
 #endif
 
+static int humanreadable = 0;
 
 #define FRONTENDDEVICE "/dev/dvb/adapter%d/frontend%d"
 
@@ -74,7 +75,11 @@ int check_frontend (int fe_fd)
       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 | ",
+      if(humanreadable)
+	 printf ("status %02x | signal %3hu%% | snr %3hu%% | ber %08x | unc %08x | ",
+	      status, signal/655, snr/655, ber, uncorrected_blocks);
+      else
+	 printf ("status %02x | signal %04x | snr %04x | ber %08x | unc %08x | ",
 	      status, signal, snr, ber, uncorrected_blocks);
 
       if (status & FE_HAS_LOCK)
@@ -127,7 +132,7 @@ int main(int argc, char *argv[])
    unsigned int adapter = 0, frontend = 0;
    int opt;
 
-   while ((opt = getopt(argc, argv, "hlrn:a:f:d:")) != -1) {
+   while ((opt = getopt(argc, argv, "hlrn:a:f:d:H")) != -1) {
       switch (opt)
       {
 	 case '?':
@@ -139,6 +144,8 @@ int main(int argc, char *argv[])
 	    break;
 	 case 'f':
 	    frontend = strtoul(optarg, NULL, 0);
+	 case 'H':
+	    humanreadable = 1;
       }
    }
 
-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/



More information about the linux-dvb mailing list