linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* femon patch for dB
@ 2011-10-28 23:01 James
  2011-10-29  0:21 ` Marek Vasut
  2011-10-30 15:42 ` Antti Palosaari
  0 siblings, 2 replies; 11+ messages in thread
From: James @ 2011-10-28 23:01 UTC (permalink / raw)
  To: linux-media Mailing List

I added a switch to femon so it displays signal and snr in dB.

The cx23885 driver for my Hauppauge WinTV-HVR1250 reports signal and snr 
in dB.

http://lockie.ca/test/femon.patch.bz2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-28 23:01 femon patch for dB James
@ 2011-10-29  0:21 ` Marek Vasut
  2011-10-29  2:12   ` Randy Dunlap
  2011-10-30 15:42 ` Antti Palosaari
  1 sibling, 1 reply; 11+ messages in thread
From: Marek Vasut @ 2011-10-29  0:21 UTC (permalink / raw)
  To: James; +Cc: linux-media Mailing List

> I added a switch to femon so it displays signal and snr in dB.
> 
> The cx23885 driver for my Hauppauge WinTV-HVR1250 reports signal and snr
> in dB.
> 
> http://lockie.ca/test/femon.patch.bz2

Use git send-email to submit patches to mailing lists, thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-29  0:21 ` Marek Vasut
@ 2011-10-29  2:12   ` Randy Dunlap
  2011-10-29  5:12     ` James
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2011-10-29  2:12 UTC (permalink / raw)
  To: Marek Vasut; +Cc: James, linux-media Mailing List

On 10/28/11 17:21, Marek Vasut wrote:
>> I added a switch to femon so it displays signal and snr in dB.
>>
>> The cx23885 driver for my Hauppauge WinTV-HVR1250 reports signal and snr
>> in dB.
>>
>> http://lockie.ca/test/femon.patch.bz2
> 
> Use git send-email to submit patches to mailing lists, thanks

Use anything that will put the patch inline in the body of an email
message.  Without weird encoding.  Thanks.

-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-29  2:12   ` Randy Dunlap
@ 2011-10-29  5:12     ` James
  2011-10-29  5:39       ` Randy Dunlap
  0 siblings, 1 reply; 11+ messages in thread
From: James @ 2011-10-29  5:12 UTC (permalink / raw)
  To: linux-media Mailing List

diff -r d4e8bf5658ce util/femon/femon.c
--- a/util/femon/femon.c    Fri Oct 07 01:26:04 2011 +0530
+++ b/util/femon/femon.c    Fri Oct 28 18:52:12 2011 -0400
@@ -16,6 +16,9 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * James Lockie: Oct. 2011
+ * modified to add a switch (-2) to show signal/snr in dB
  */
 
 
@@ -37,11 +40,16 @@
 
 #include <libdvbapi/dvbfe.h>
 
+/* the s5h1409 delivers both fields in 0.1dB increments, while
+ * some demods expect signal to be 0-65535 and SNR to be in 1/256
increments
+*/
+
 #define FE_STATUS_PARAMS
(DVBFE_INFO_LOCKSTATUS|DVBFE_INFO_SIGNAL_STRENGTH|DVBFE_INFO_BER|DVBFE_INFO_SNR|DVBFE_INFO_UNCORRECTED_BLOCKS)
 
 static char *usage_str =
     "\nusage: femon [options]\n"
-    "     -H        : human readable output\n"
+    "     -H        : human readable output: (signal: 0-65335, snr:
1/256 increments)\n"
+    "     -2        : human readable output: (signal and snr in .1 dB
increments)\n"
     "     -A        : Acoustical mode. A sound indicates the signal
quality.\n"
     "     -r        : If 'Acoustical mode' is active it tells the
application\n"
     "                 is called remotely via ssh. The sound is heard on
the 'real'\n"
@@ -62,7 +70,7 @@ static void usage(void)
 
 
 static
-int check_frontend (struct dvbfe_handle *fe, int human_readable,
unsigned int count)
+int check_frontend (struct dvbfe_handle *fe, int human_readable, int
db_readable, unsigned int count)
 {
     struct dvbfe_info fe_info;
     unsigned int samples = 0;
@@ -93,31 +101,32 @@ int check_frontend (struct dvbfe_handle
             fprintf(stderr, "Problem retrieving frontend information:
%m\n");
         }
 
+        //  print the status code
+        printf ("status %c%c%c%c%c | ",
+            fe_info.signal ? 'S' : ' ',
+            fe_info.carrier ? 'C' : ' ',
+            fe_info.viterbi ? 'V' : ' ',
+            fe_info.sync ? 'Y' : ' ',
+            fe_info.lock ? 'L' : ' ' );
 
+        if (db_readable) {
+                       printf ("signal %3.0fdB | snr %3.0fdB",
+                (fe_info.signal_strength * 0.1),
+                (fe_info.snr * 0.1) );
+        } else if (human_readable) {
+                       printf ("signal %3u%% | snr %3u%%",
+                (fe_info.signal_strength * 100) / 0xffff,
+                (fe_info.snr * 100) / 0xffff );
+        } else {
+            printf ("signal %04x | snr %04x",
+                fe_info.signal_strength,
+                fe_info.snr );
+        }
 
-        if (human_readable) {
-                       printf ("status %c%c%c%c%c | signal %3u%% | snr
%3u%% | ber %d | unc %d | ",
-                fe_info.signal ? 'S' : ' ',
-                fe_info.carrier ? 'C' : ' ',
-                fe_info.viterbi ? 'V' : ' ',
-                fe_info.sync ? 'Y' : ' ',
-                fe_info.lock ? 'L' : ' ',
-                (fe_info.signal_strength * 100) / 0xffff,
-                (fe_info.snr * 100) / 0xffff,
-                fe_info.ber,
-                fe_info.ucblocks);
-        } else {
-            printf ("status %c%c%c%c%c | signal %04x | snr %04x | ber
%08x | unc %08x | ",
-                fe_info.signal ? 'S' : ' ',
-                fe_info.carrier ? 'C' : ' ',
-                fe_info.viterbi ? 'V' : ' ',
-                fe_info.sync ? 'Y' : ' ',
-                fe_info.lock ? 'L' : ' ',
-                fe_info.signal_strength,
-                fe_info.snr,
-                fe_info.ber,
-                fe_info.ucblocks);
-        }
+        /* always print ber and ucblocks */
+        printf (" | ber %08x | unc %08x | ",
+            fe_info.ber,
+            fe_info.ucblocks);
 
         if (fe_info.lock)
             printf("FE_HAS_LOCK");
@@ -145,7 +154,7 @@ int check_frontend (struct dvbfe_handle
 
 
 static
-int do_mon(unsigned int adapter, unsigned int frontend, int
human_readable, unsigned int count)
+int do_mon(unsigned int adapter, unsigned int frontend, int
human_readable, int db_readable, unsigned int count)
 {
     int result;
     struct dvbfe_handle *fe;
@@ -175,7 +184,7 @@ int do_mon(unsigned int adapter, unsigne
     }
     printf("FE: %s (%s)\n", fe_info.name, fe_type);
 
-    result = check_frontend (fe, human_readable, count);
+    result = check_frontend (fe, human_readable, db_readable, count);
 
     dvbfe_close(fe);
 
@@ -186,9 +195,10 @@ int main(int argc, char *argv[])
 {
     unsigned int adapter = 0, frontend = 0, count = 0;
     int human_readable = 0;
+    int db_readable = 0;
     int opt;
 
-       while ((opt = getopt(argc, argv, "rAHa:f:c:")) != -1) {
+       while ((opt = getopt(argc, argv, "rAH2a:f:c:")) != -1) {
         switch (opt)
         {
         default:
@@ -206,6 +216,9 @@ int main(int argc, char *argv[])
         case 'H':
             human_readable = 1;
             break;
+        case '2':
+            db_readable = 1;
+            break;
         case 'A':
             // Acoustical mode: we have to reduce the delay between
             // checks in order to hear nice sound
@@ -218,7 +231,7 @@ int main(int argc, char *argv[])
         }
     }
 
-    do_mon(adapter, frontend, human_readable, count);
+    do_mon(adapter, frontend, human_readable, db_readable, count);
 
     return 0;
 }


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-29  5:12     ` James
@ 2011-10-29  5:39       ` Randy Dunlap
  2011-10-29  6:37         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2011-10-29  5:39 UTC (permalink / raw)
  To: James; +Cc: linux-media Mailing List

On 10/28/11 22:12, James wrote:
> diff -r d4e8bf5658ce util/femon/femon.c
> --- a/util/femon/femon.c    Fri Oct 07 01:26:04 2011 +0530
> +++ b/util/femon/femon.c    Fri Oct 28 18:52:12 2011 -0400
> @@ -16,6 +16,9 @@
>   * You should have received a copy of the GNU General Public License
>   * along with this program; if not, write to the Free Software
>   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + * James Lockie: Oct. 2011
> + * modified to add a switch (-2) to show signal/snr in dB
>   */
>  
>  
> @@ -37,11 +40,16 @@
>  
>  #include <libdvbapi/dvbfe.h>
>  
> +/* the s5h1409 delivers both fields in 0.1dB increments, while
> + * some demods expect signal to be 0-65535 and SNR to be in 1/256
> increments

Looks like thunderbird is being too helpful for us here -- by breaking
a long line where it shouldn't be broken.  You can see if
<kernel source>/Documentation/email-clients.txt helps you any with that.

> +*/
> +
>  #define FE_STATUS_PARAMS
> (DVBFE_INFO_LOCKSTATUS|DVBFE_INFO_SIGNAL_STRENGTH|DVBFE_INFO_BER|DVBFE_INFO_SNR|DVBFE_INFO_UNCORRECTED_BLOCKS)
>  
>  static char *usage_str =
>      "\nusage: femon [options]\n"
> -    "     -H        : human readable output\n"
> +    "     -H        : human readable output: (signal: 0-65335, snr:
> 1/256 increments)\n"
> +    "     -2        : human readable output: (signal and snr in .1 dB
> increments)\n"

same problem as above.

>      "     -A        : Acoustical mode. A sound indicates the signal
> quality.\n"
>      "     -r        : If 'Acoustical mode' is active it tells the
> application\n"
>      "                 is called remotely via ssh. The sound is heard on
> the 'real'\n"
> @@ -62,7 +70,7 @@ static void usage(void)
>  
>  
>  static
> -int check_frontend (struct dvbfe_handle *fe, int human_readable,
> unsigned int count)
> +int check_frontend (struct dvbfe_handle *fe, int human_readable, int
> db_readable, unsigned int count)

and again.

>  {
>      struct dvbfe_info fe_info;
>      unsigned int samples = 0;
> @@ -93,31 +101,32 @@ int check_frontend (struct dvbfe_handle
>              fprintf(stderr, "Problem retrieving frontend information:
> %m\n");
>          }
>  
> +        //  print the status code
> +        printf ("status %c%c%c%c%c | ",
> +            fe_info.signal ? 'S' : ' ',
> +            fe_info.carrier ? 'C' : ' ',
> +            fe_info.viterbi ? 'V' : ' ',
> +            fe_info.sync ? 'Y' : ' ',
> +            fe_info.lock ? 'L' : ' ' );
>  
> +        if (db_readable) {
> +                       printf ("signal %3.0fdB | snr %3.0fdB",
> +                (fe_info.signal_strength * 0.1),
> +                (fe_info.snr * 0.1) );
> +        } else if (human_readable) {
> +                       printf ("signal %3u%% | snr %3u%%",
> +                (fe_info.signal_strength * 100) / 0xffff,
> +                (fe_info.snr * 100) / 0xffff );
> +        } else {
> +            printf ("signal %04x | snr %04x",
> +                fe_info.signal_strength,
> +                fe_info.snr );
> +        }
>  
> -        if (human_readable) {
> -                       printf ("status %c%c%c%c%c | signal %3u%% | snr
> %3u%% | ber %d | unc %d | ",
> -                fe_info.signal ? 'S' : ' ',
> -                fe_info.carrier ? 'C' : ' ',
> -                fe_info.viterbi ? 'V' : ' ',
> -                fe_info.sync ? 'Y' : ' ',
> -                fe_info.lock ? 'L' : ' ',
> -                (fe_info.signal_strength * 100) / 0xffff,
> -                (fe_info.snr * 100) / 0xffff,
> -                fe_info.ber,
> -                fe_info.ucblocks);
> -        } else {
> -            printf ("status %c%c%c%c%c | signal %04x | snr %04x | ber
> %08x | unc %08x | ",
> -                fe_info.signal ? 'S' : ' ',
> -                fe_info.carrier ? 'C' : ' ',
> -                fe_info.viterbi ? 'V' : ' ',
> -                fe_info.sync ? 'Y' : ' ',
> -                fe_info.lock ? 'L' : ' ',
> -                fe_info.signal_strength,
> -                fe_info.snr,
> -                fe_info.ber,
> -                fe_info.ucblocks);
> -        }
> +        /* always print ber and ucblocks */
> +        printf (" | ber %08x | unc %08x | ",
> +            fe_info.ber,
> +            fe_info.ucblocks);
>  
>          if (fe_info.lock)
>              printf("FE_HAS_LOCK");
> @@ -145,7 +154,7 @@ int check_frontend (struct dvbfe_handle
>  
>  
>  static
> -int do_mon(unsigned int adapter, unsigned int frontend, int
> human_readable, unsigned int count)
> +int do_mon(unsigned int adapter, unsigned int frontend, int
> human_readable, int db_readable, unsigned int count)

and again.

>  {
>      int result;
>      struct dvbfe_handle *fe;
> @@ -175,7 +184,7 @@ int do_mon(unsigned int adapter, unsigne
>      }
>      printf("FE: %s (%s)\n", fe_info.name, fe_type);
>  
> -    result = check_frontend (fe, human_readable, count);
> +    result = check_frontend (fe, human_readable, db_readable, count);
>  
>      dvbfe_close(fe);
>  
> @@ -186,9 +195,10 @@ int main(int argc, char *argv[])
>  {
>      unsigned int adapter = 0, frontend = 0, count = 0;
>      int human_readable = 0;
> +    int db_readable = 0;
>      int opt;
>  
> -       while ((opt = getopt(argc, argv, "rAHa:f:c:")) != -1) {
> +       while ((opt = getopt(argc, argv, "rAH2a:f:c:")) != -1) {
>          switch (opt)
>          {
>          default:
> @@ -206,6 +216,9 @@ int main(int argc, char *argv[])
>          case 'H':
>              human_readable = 1;
>              break;
> +        case '2':
> +            db_readable = 1;
> +            break;
>          case 'A':
>              // Acoustical mode: we have to reduce the delay between
>              // checks in order to hear nice sound
> @@ -218,7 +231,7 @@ int main(int argc, char *argv[])
>          }
>      }
>  
> -    do_mon(adapter, frontend, human_readable, count);
> +    do_mon(adapter, frontend, human_readable, db_readable, count);
>  
>      return 0;
>  }
> 
> --


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-29  5:39       ` Randy Dunlap
@ 2011-10-29  6:37         ` Mauro Carvalho Chehab
  2011-10-30 13:52           ` Michael Krufky
  0 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2011-10-29  6:37 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: James, linux-media Mailing List

Em 29-10-2011 07:39, Randy Dunlap escreveu:
> On 10/28/11 22:12, James wrote:
>> diff -r d4e8bf5658ce util/femon/femon.c
>> --- a/util/femon/femon.c    Fri Oct 07 01:26:04 2011 +0530
>> +++ b/util/femon/femon.c    Fri Oct 28 18:52:12 2011 -0400
>> @@ -16,6 +16,9 @@
>>   * You should have received a copy of the GNU General Public License
>>   * along with this program; if not, write to the Free Software
>>   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>> + *
>> + * James Lockie: Oct. 2011
>> + * modified to add a switch (-2) to show signal/snr in dB
>>   */
>>  
>>  
>> @@ -37,11 +40,16 @@
>>  
>>  #include <libdvbapi/dvbfe.h>
>>  
>> +/* the s5h1409 delivers both fields in 0.1dB increments, while
>> + * some demods expect signal to be 0-65535 and SNR to be in 1/256
>> increments
> 
> Looks like thunderbird is being too helpful for us here -- by breaking
> a long line where it shouldn't be broken.  You can see if
> <kernel source>/Documentation/email-clients.txt helps you any with that.

This is not a kernel patch, but yes, you're right: there's nothing we can't
apply it to dvb-apps as-is.

Thunderbird only works well if the html editor is disabled and if the max number
of lines is set to 0. I use it here, but I'm currently sending patches directly
from git, as it is simpler, if the smtp server is properly configured.
There is one plugin for it that fixes those stuff on thunerbird (asalted-patches),
but this doesn't work with newer versions of it (well, fixing it is probably
a one-line patch like [2] changing the maxVersion).

[1] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/
[2] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/rev/49d587f60371

Regards,
Mauro

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-29  6:37         ` Mauro Carvalho Chehab
@ 2011-10-30 13:52           ` Michael Krufky
  2011-10-30 14:01             ` Michael Krufky
  2011-10-30 16:21             ` VDR User
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Krufky @ 2011-10-30 13:52 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Randy Dunlap, James, linux-media Mailing List

On Sat, Oct 29, 2011 at 2:37 AM, Mauro Carvalho Chehab
<mchehab@redhat.com> wrote:
> Em 29-10-2011 07:39, Randy Dunlap escreveu:
>> On 10/28/11 22:12, James wrote:
>>> diff -r d4e8bf5658ce util/femon/femon.c
>>> --- a/util/femon/femon.c    Fri Oct 07 01:26:04 2011 +0530
>>> +++ b/util/femon/femon.c    Fri Oct 28 18:52:12 2011 -0400
>>> @@ -16,6 +16,9 @@
>>>   * You should have received a copy of the GNU General Public License
>>>   * along with this program; if not, write to the Free Software
>>>   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>>> + *
>>> + * James Lockie: Oct. 2011
>>> + * modified to add a switch (-2) to show signal/snr in dB
>>>   */
>>>
>>>
>>> @@ -37,11 +40,16 @@
>>>
>>>  #include <libdvbapi/dvbfe.h>
>>>
>>> +/* the s5h1409 delivers both fields in 0.1dB increments, while
>>> + * some demods expect signal to be 0-65535 and SNR to be in 1/256
>>> increments
>>
>> Looks like thunderbird is being too helpful for us here -- by breaking
>> a long line where it shouldn't be broken.  You can see if
>> <kernel source>/Documentation/email-clients.txt helps you any with that.
>
> This is not a kernel patch, but yes, you're right: there's nothing we can't
> apply it to dvb-apps as-is.
>
> Thunderbird only works well if the html editor is disabled and if the max number
> of lines is set to 0. I use it here, but I'm currently sending patches directly
> from git, as it is simpler, if the smtp server is properly configured.
> There is one plugin for it that fixes those stuff on thunerbird (asalted-patches),
> but this doesn't work with newer versions of it (well, fixing it is probably
> a one-line patch like [2] changing the maxVersion).
>
> [1] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/
> [2] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/rev/49d587f60371
>
> Regards,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

please do not apply this patch - as per the patch description (i
haven't seen the patch yet since it wasnt sent inline) this is a
userspace conversion patch based on the output of *one* demodulator
driver.

I will push the work for the ATSC snr conversions to my git repository
and issue a pull request to Mauro by the end of the day.  This issue
is larger than a simple userspace unit conversion.  Please send in the
patch inline anyway, as some users may wish to experiment with it, but
we need to first standardize the kernel unit reporting before we claim
to report in a given unit.

Best regards,
Michael Krufky

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-30 13:52           ` Michael Krufky
@ 2011-10-30 14:01             ` Michael Krufky
  2011-10-31 16:42               ` James
  2011-10-30 16:21             ` VDR User
  1 sibling, 1 reply; 11+ messages in thread
From: Michael Krufky @ 2011-10-30 14:01 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Randy Dunlap, James, linux-media Mailing List

On Sun, Oct 30, 2011 at 9:52 AM, Michael Krufky <mkrufky@linuxtv.org> wrote:
> On Sat, Oct 29, 2011 at 2:37 AM, Mauro Carvalho Chehab
> <mchehab@redhat.com> wrote:
>> Em 29-10-2011 07:39, Randy Dunlap escreveu:
>>> On 10/28/11 22:12, James wrote:
>>>> diff -r d4e8bf5658ce util/femon/femon.c
>>>> --- a/util/femon/femon.c    Fri Oct 07 01:26:04 2011 +0530
>>>> +++ b/util/femon/femon.c    Fri Oct 28 18:52:12 2011 -0400
>>>> @@ -16,6 +16,9 @@
>>>>   * You should have received a copy of the GNU General Public License
>>>>   * along with this program; if not, write to the Free Software
>>>>   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>>>> + *
>>>> + * James Lockie: Oct. 2011
>>>> + * modified to add a switch (-2) to show signal/snr in dB
>>>>   */
>>>>
>>>>
>>>> @@ -37,11 +40,16 @@
>>>>
>>>>  #include <libdvbapi/dvbfe.h>
>>>>
>>>> +/* the s5h1409 delivers both fields in 0.1dB increments, while
>>>> + * some demods expect signal to be 0-65535 and SNR to be in 1/256
>>>> increments
>>>
>>> Looks like thunderbird is being too helpful for us here -- by breaking
>>> a long line where it shouldn't be broken.  You can see if
>>> <kernel source>/Documentation/email-clients.txt helps you any with that.
>>
>> This is not a kernel patch, but yes, you're right: there's nothing we can't
>> apply it to dvb-apps as-is.
>>
>> Thunderbird only works well if the html editor is disabled and if the max number
>> of lines is set to 0. I use it here, but I'm currently sending patches directly
>> from git, as it is simpler, if the smtp server is properly configured.
>> There is one plugin for it that fixes those stuff on thunerbird (asalted-patches),
>> but this doesn't work with newer versions of it (well, fixing it is probably
>> a one-line patch like [2] changing the maxVersion).
>>
>> [1] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/
>> [2] https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/rev/49d587f60371
>>
>> Regards,
>> Mauro
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
> please do not apply this patch - as per the patch description (i
> haven't seen the patch yet since it wasnt sent inline) this is a
> userspace conversion patch based on the output of *one* demodulator
> driver.
>
> I will push the work for the ATSC snr conversions to my git repository
> and issue a pull request to Mauro by the end of the day.  This issue
> is larger than a simple userspace unit conversion.  Please send in the
> patch inline anyway, as some users may wish to experiment with it, but
> we need to first standardize the kernel unit reporting before we claim
> to report in a given unit.


...actually, I couldn't resist -- I downloaded the bz2'd patch and
reviewed it.  The patch is actually OK with me, except that i disagree
with the -2 parameter choice.  I propose instead, to use a lowercase
'h' ...

If you could resend with that change, acked-by: Michael Krufky
<mkrufky@linuxtv.org>

(apologies for the previous reactive email ;-) )

Best regards,
Michael Krufky

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-28 23:01 femon patch for dB James
  2011-10-29  0:21 ` Marek Vasut
@ 2011-10-30 15:42 ` Antti Palosaari
  1 sibling, 0 replies; 11+ messages in thread
From: Antti Palosaari @ 2011-10-30 15:42 UTC (permalink / raw)
  To: James; +Cc: linux-media Mailing List

On 10/29/2011 02:01 AM, James wrote:
> I added a switch to femon so it displays signal and snr in dB.
>
> The cx23885 driver for my Hauppauge WinTV-HVR1250 reports signal and snr
> in dB.
>
> http://lockie.ca/test/femon.patch.bz2

from patch:
human readable output: (signal: 0-65335, snr: 1/256 increments)\n"
human readable output: (signal and snr in .1 dB increments)\n"

You should take look to demod drivers and check what those are 
returning. I have strong feeling that most drivers returns SNR as 10xdB. 
And SS as 0-0xffff. I think there is good consensus of SNR unit, but for 
SS it is not so clear. For my drivers I have used SNR 10xdB and SS 
0-0xffff. That's why, giving only those two alternatives is not 
suitable. Maybe it is better to set own param for SNR and SS?

Devin did some research about SNR long time back:
http://www.devinheitmueller.com/snr.txt

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-30 13:52           ` Michael Krufky
  2011-10-30 14:01             ` Michael Krufky
@ 2011-10-30 16:21             ` VDR User
  1 sibling, 0 replies; 11+ messages in thread
From: VDR User @ 2011-10-30 16:21 UTC (permalink / raw)
  To: Michael Krufky
  Cc: Mauro Carvalho Chehab, Randy Dunlap, James,
	linux-media Mailing List

On Sun, Oct 30, 2011 at 6:52 AM, Michael Krufky <mkrufky@linuxtv.org> wrote:
> I will push the work for the ATSC snr conversions to my git repository
> and issue a pull request to Mauro by the end of the day.  This issue
> is larger than a simple userspace unit conversion.  Please send in the
> patch inline anyway, as some users may wish to experiment with it, but
> we need to first standardize the kernel unit reporting before we claim
> to report in a given unit.

This topic comes up every so often but afaik nothing is ever done
beyond talking.  Are there actually plans to finally get this done?  I
hope so since it's useful information to the user rather than just
some value given in an unknown scale.

Sorry if my question is OT.

Derek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: femon patch for dB
  2011-10-30 14:01             ` Michael Krufky
@ 2011-10-31 16:42               ` James
  0 siblings, 0 replies; 11+ messages in thread
From: James @ 2011-10-31 16:42 UTC (permalink / raw)
  Cc: linux-media Mailing List

On 10/30/11 10:01, Michael Krufky wrote:
> The patch is actually OK with me, except that i disagree
> with the -2 parameter choice.  I propose instead, to use a lowercase
> 'h' ...


diff -r d4e8bf5658ce util/femon/femon.c
--- a/util/femon/femon.c	Fri Oct 07 01:26:04 2011 +0530
+++ b/util/femon/femon.c	Mon Oct 31 12:29:14 2011 -0400
@@ -16,6 +16,9 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * James Lockie: Oct. 2011
+ * modified to add a switch (-h) to show signal/snr in dB
  */
 
 
@@ -37,11 +40,16 @@
 
 #include <libdvbapi/dvbfe.h>
 
+/* the s5h1409 delivers both fields in 0.1dB increments, while
+ * some demods expect signal to be 0-65535 and SNR to be in 1/256 increments
+*/
+
 #define FE_STATUS_PARAMS (DVBFE_INFO_LOCKSTATUS|DVBFE_INFO_SIGNAL_STRENGTH|DVBFE_INFO_BER|DVBFE_INFO_SNR|DVBFE_INFO_UNCORRECTED_BLOCKS)
 
 static char *usage_str =
     "\nusage: femon [options]\n"
-    "     -H        : human readable output\n"
+    "     -H        : human readable output: (signal: 0-65335, snr: 1/256 increments)\n"
+    "     -h        : human readable output: (signal and snr in .1 dB increments)\n"
     "     -A        : Acoustical mode. A sound indicates the signal quality.\n"
     "     -r        : If 'Acoustical mode' is active it tells the application\n"
     "                 is called remotely via ssh. The sound is heard on the 'real'\n"
@@ -62,7 +70,7 @@
 
 
 static
-int check_frontend (struct dvbfe_handle *fe, int human_readable, unsigned int count)
+int check_frontend (struct dvbfe_handle *fe, int human_readable, int db_readable, unsigned int count)
 {
 	struct dvbfe_info fe_info;
 	unsigned int samples = 0;
@@ -93,31 +101,32 @@
 			fprintf(stderr, "Problem retrieving frontend information: %m\n");
 		}
 
+		//  print the status code
+		printf ("status %c%c%c%c%c | ",
+			fe_info.signal ? 'S' : ' ',
+			fe_info.carrier ? 'C' : ' ',
+			fe_info.viterbi ? 'V' : ' ',
+			fe_info.sync ? 'Y' : ' ',
+			fe_info.lock ? 'L' : ' ' );
 
+		if (db_readable) {
+                       printf ("signal %3.0fdB | snr %3.0fdB",
+				(fe_info.signal_strength * 0.1),
+				(fe_info.snr * 0.1) );
+		} else if (human_readable) {
+                       printf ("signal %3u%% | snr %3u%%",
+				(fe_info.signal_strength * 100) / 0xffff,
+				(fe_info.snr * 100) / 0xffff );
+		} else {
+			printf ("signal %04x | snr %04x",
+				fe_info.signal_strength,
+				fe_info.snr );
+		}
 
-		if (human_readable) {
-                       printf ("status %c%c%c%c%c | signal %3u%% | snr %3u%% | ber %d | unc %d | ",
-				fe_info.signal ? 'S' : ' ',
-				fe_info.carrier ? 'C' : ' ',
-				fe_info.viterbi ? 'V' : ' ',
-				fe_info.sync ? 'Y' : ' ',
-				fe_info.lock ? 'L' : ' ',
-				(fe_info.signal_strength * 100) / 0xffff,
-				(fe_info.snr * 100) / 0xffff,
-				fe_info.ber,
-				fe_info.ucblocks);
-		} else {
-			printf ("status %c%c%c%c%c | signal %04x | snr %04x | ber %08x | unc %08x | ",
-				fe_info.signal ? 'S' : ' ',
-				fe_info.carrier ? 'C' : ' ',
-				fe_info.viterbi ? 'V' : ' ',
-				fe_info.sync ? 'Y' : ' ',
-				fe_info.lock ? 'L' : ' ',
-				fe_info.signal_strength,
-				fe_info.snr,
-				fe_info.ber,
-				fe_info.ucblocks);
-		}
+		/* always print ber and ucblocks */
+		printf (" | ber %08x | unc %08x | ",
+			fe_info.ber,
+			fe_info.ucblocks);
 
 		if (fe_info.lock)
 			printf("FE_HAS_LOCK");
@@ -145,7 +154,7 @@
 
 
 static
-int do_mon(unsigned int adapter, unsigned int frontend, int human_readable, unsigned int count)
+int do_mon(unsigned int adapter, unsigned int frontend, int human_readable, int db_readable, unsigned int count)
 {
 	int result;
 	struct dvbfe_handle *fe;
@@ -175,7 +184,7 @@
 	}
 	printf("FE: %s (%s)\n", fe_info.name, fe_type);
 
-	result = check_frontend (fe, human_readable, count);
+	result = check_frontend (fe, human_readable, db_readable, count);
 
 	dvbfe_close(fe);
 
@@ -186,9 +195,10 @@
 {
 	unsigned int adapter = 0, frontend = 0, count = 0;
 	int human_readable = 0;
+	int db_readable = 0;
 	int opt;
 
-       while ((opt = getopt(argc, argv, "rAHa:f:c:")) != -1) {
+       while ((opt = getopt(argc, argv, "rAHha:f:c:")) != -1) {
 		switch (opt)
 		{
 		default:
@@ -206,6 +216,9 @@
 		case 'H':
 			human_readable = 1;
 			break;
+		case 'h':
+			db_readable = 1;
+			break;
 		case 'A':
 			// Acoustical mode: we have to reduce the delay between
 			// checks in order to hear nice sound
@@ -218,7 +231,7 @@
 		}
 	}
 
-	do_mon(adapter, frontend, human_readable, count);
+	do_mon(adapter, frontend, human_readable, db_readable, count);
 
 	return 0;
 }


On 10/30/11 11:42, Antti Palosaari wrote:
> 
> 
> You should take look to demod drivers and check what those are returning. I have strong feeling that most drivers returns SNR as 10xdB. And SS as 0-0xffff. I think there is good consensus of SNR unit, but for SS it is not so clear. For my drivers I have used SNR 10xdB and SS 0-0xffff. That's why, giving only those two alternatives is not suitable. Maybe it is better to set own param for SNR and SS?

Good point.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-31 16:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 23:01 femon patch for dB James
2011-10-29  0:21 ` Marek Vasut
2011-10-29  2:12   ` Randy Dunlap
2011-10-29  5:12     ` James
2011-10-29  5:39       ` Randy Dunlap
2011-10-29  6:37         ` Mauro Carvalho Chehab
2011-10-30 13:52           ` Michael Krufky
2011-10-30 14:01             ` Michael Krufky
2011-10-31 16:42               ` James
2011-10-30 16:21             ` VDR User
2011-10-30 15:42 ` Antti Palosaari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).