[dvblast-devel] Fix reading of BER, SNR and strength values.

Georgi Chorbadzhiyski git at videolan.org
Thu Oct 3 14:16:18 CEST 2013


dvblast | branch: master | Georgi Chorbadzhiyski <gf at unixsol.org> | Thu Oct  3 15:14:09 2013 +0300| [833e649b1bcd4aad88fa0f81b283f243e2fd9845] | committer: Georgi Chorbadzhiyski

Fix reading of BER, SNR and strength values.

According to Linux DVB docs FE_READ_SIGNAL_STRENGTH and FE_READ_SNR
have int16_t parameter, not int32_t.

Also FE_READ_BER returns uint32_t, not int32_t.

Using the wrong types caused dvblastctl to report absurd values
for strength and snr.

Reported by: Ibrahim Tachijian <barhom at gmail.com>

Signed-off-by: Georgi Chorbadzhiyski <gf at unixsol.org>

> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=833e649b1bcd4aad88fa0f81b283f243e2fd9845
---

 comm.h       |    3 ++-
 dvblastctl.c |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/comm.h b/comm.h
index be2902e..a878bc7 100644
--- a/comm.h
+++ b/comm.h
@@ -73,7 +73,8 @@ struct ret_frontend_status
 {
     struct dvb_frontend_info info;
     fe_status_t i_status;
-    int32_t i_ber, i_strength, i_snr;
+    uint32_t i_ber;
+    int16_t i_strength, i_snr;
 };
 
 struct ret_mmi_status
diff --git a/dvblastctl.c b/dvblastctl.c
index e38d00e..71f5a0b 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -710,11 +710,11 @@ int main( int i_argc, char **ppsz_argv )
         {
             if ( i_print_type == PRINT_XML )
             {
-                printf(" <VALUE bit_error_rate=\"%d\"/>\n", p_ret->i_ber);
+                printf(" <VALUE bit_error_rate=\"%u\"/>\n", p_ret->i_ber);
                 printf(" <VALUE signal_strength=\"%d\"/>\n", p_ret->i_strength);
                 printf(" <VALUE SNR=\"%d\"/>\n", p_ret->i_snr);
             } else {
-                printf("\nBit error rate: %d\n", p_ret->i_ber);
+                printf("\nBit error rate: %u\n", p_ret->i_ber);
                 printf("Signal strength: %d\n", p_ret->i_strength);
                 printf("SNR: %d\n", p_ret->i_snr);
             }



More information about the dvblast-devel mailing list