Jump to content


Photo

Reading the RF signal level


  • Please log in to reply
15 replies to this topic

#1 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 3 June 2020 - 12:58

Hi All,

 

I would like to build an application for reading the RF level on the tuner card.

I have some past experience building Enigma 2 plug-in's so the UI design etc. shouldn't be an issue.

 

Is there an enigma Python module I can import / use to read the RF level or use to interact with the tuner at a lower level?

 

I've seen the OpenPLi Satfinder Plug-In which shows an SNR readout but I cannot work out where the SNR is imported from!! - I was wondering if I could work this out I could use the same technique to get a 'raw' RF level.

 

Does anybody have any experience reading information like this?

 

Cheers,

O.



Re: Reading the RF signal level #2 WanWizard

  • PLi® Core member
  • 70,563 posts

+1,816
Excellent

Posted 3 June 2020 - 13:22

Communication with the hardware happens using the Linux DVB AP (https://linuxtv.org/...v5/index.html)I, so check files like ./lib/dvb/frontend.cpp.

 

Afaik the API doesn't give you access to raw tuner data, if that was true we would have had access to the outer FEC, and we could do proper BER calculations.


Edited by WanWizard, 3 June 2020 - 13:23.

Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: Reading the RF signal level #3 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 3 June 2020 - 13:34

Thank you for your help with this!

 

I'll take a look at the Linux DVB AP and the frontend.cpp files and report back if I have any issues with this.

 

Thanks again,

O.



Re: Reading the RF signal level #4 Erik Slagter

  • PLi® Core member
  • 46,969 posts

+542
Excellent

Posted 4 June 2020 - 18:12

The API will probably define some calls to retrieve information besides the information Enigma already supplies (like SNR, AGC and BER), but you will find that no single tuner does support these calls.

 

That's why Enigma doesn't give any of them. I am afraid this is a futile operation. 

 

Anyway, only the SNR value is interesting. Even BER (after FEC) and AGC are not really interesting and often completely bogus values.


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Reading the RF signal level #5 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 16 June 2020 - 13:18

Thank you for your help and advice so far.

 

I'm not having too much luck with the frontend.cpp file... But I have come across the iFrontendInformation enigma module. There is a python file called TunerInfo.py at usr/lib/enigma2/python/components and it looks like it may have access to the SNR through this iFrontendInformation module.

 

Once again I cannot find any documentation on how this module works or if it would even work - where can I find the actual python enigma modules on my STB? If I could access these I would be able to see what functions are available in iFrontendInformation and find a viable solution to retrieve the SNR.



Re: Reading the RF signal level #6 WanWizard

  • PLi® Core member
  • 70,563 posts

+1,816
Excellent

Posted 16 June 2020 - 13:54

You need to install the "enigma2-src" package to get the source on the box.

 

You will find them in /usr/lib/enigma2/python.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: Reading the RF signal level #7 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 16 June 2020 - 15:31

I got the enigma2-src package working and managed to find the modules I would like to use but unfortunately I'm still stuck...

 

Do you have any example code I can use to quickly pull an SNR from the box?

 

I just tried the iFrontendInformation module using the line "iFrontendInformation.signalQuality", this seems to return the number 2. The reported SNR in Satfinder is 0dB because the satellite is currently disconnected - I can already see an issue here.

Testing "iFrontendInformation.lockState" command seems to return 3 (I would expect a 0 here for no Lock). Maybe I need to use something like getFrontendInfo or readFrontendData.

 

E.g. 

iFrontendInformation.getFrontendInfo(iFrontendInformation.signalQuality)

I must be missing something really obvious...



Re: Reading the RF signal level #8 WanWizard

  • PLi® Core member
  • 70,563 posts

+1,816
Excellent

Posted 16 June 2020 - 16:39

I'm not an Enigma developer.

 

I can read C and Python, find stuff, and do a little bit of bug fixing, but that's about it.So I hope a developer can chip in...


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: Reading the RF signal level #9 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 16 June 2020 - 17:29

Thank you for your help so far WanWizard.

 

As you said, hopefully a developer may come across this thread and chip in. :thumbs-up:

 

I think the code I looked at so far must rely on another module I'm missing - I find I can follow the process of getting the SNR so far until I come across a one off variable or a function not in the main body of code and it no longer makes sense...!



Re: Reading the RF signal level #10 Erik Slagter

  • PLi® Core member
  • 46,969 posts

+542
Excellent

Posted 16 June 2020 - 18:05

Oliver.M. I have a question for you: where do you think (whatever part of) Enigma2 gets the information about the tuner ("frontend") from?


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Reading the RF signal level #11 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 16 June 2020 - 18:51

Hi Erik Slagter -

 

I'm fairly confident frontend.cpp is the source of the tuner information... I have read through frontend.cpp and can see where the SNR or signalQuality is placed in a dictionary structure under the key "tuner_signal_quality".

 

I would assume this is the same dictionary I get in Satfinder plugin using the code below

res_mgr = eDVBResourceManager.getInstance()

And therefore this would mean I just need to pull "tuner_signal_quality" from the eDVBResourceManager instance...



Re: Reading the RF signal level #12 mrvica

  • Senior Member
  • 1,261 posts

+86
Good

Posted 16 June 2020 - 18:54

you get some data over the webinterface:

root@h7:/var/volatile/tmp# wget -O - -q http://localhost/web/signal?AGC
<?xml version="1.0" encoding="UTF-8"?>
<e2frontendstatus>
        <e2snrdb>12.50 dB</e2snrdb>
        <e2snr>63 %</e2snr>
        <e2ber>0</e2ber>
        <e2acg>73 %</e2acg>
</e2frontendstatus>
root@h7:/var/volatile/tmp#



Re: Reading the RF signal level #13 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 16 June 2020 - 19:17

mrvica -

 

This is a really nice way of getting the SNR value (and other information)!! Just tested on my STB and working - thank you very much.

 

I will look at implementing this into my Python plug-in over the next few days while I work out how to use the frontend.cpp related methods.



Re: Reading the RF signal level #14 Erik Slagter

  • PLi® Core member
  • 46,969 posts

+542
Excellent

Posted 17 June 2020 - 17:39

Hi Erik Slagter -

 

I'm fairly confident frontend.cpp is the source of the tuner information... I have read through frontend.cpp and can see where the SNR or signalQuality is placed in a dictionary structure under the key "tuner_signal_quality".

 

I would assume this is the same dictionary I get in Satfinder plugin using the code below

res_mgr = eDVBResourceManager.getInstance()

And therefore this would mean I just need to pull "tuner_signal_quality" from the eDVBResourceManager instance...

 

My point is that any part of enigma and any other user space program will get their tuner information from the tuner itself, via a Linux interface from the (closed source) driver.

 

This means that all of the information you will see has the same origin, the closed source manufacturer driver.

 

This also means there is no way to retrieve any information from the tuner that enigma doesn't already show you. Unless you know how to address the tuner over the I2C bus and how to command it. But that information is secret and NDA, so very unlikely to be available to any of us.

 

This purely to prevent you from disappointment.


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: Reading the RF signal level #15 Oliver.M.

  • Member
  • 12 posts

0
Neutral

Posted 17 June 2020 - 20:07

Thank you for your help Erik Slagter.

 

I think I have a much better understanding of the underlying enigma code now - and the barriers and limitations present which prevent me from getting direct access to the tuner!

 

I will continue looking into the way the whole Linux interface stuff works but for now mrvica's solution resolves my issue short term.

 

Thank you all for your help with this!



Re: Reading the RF signal level #16 mrvica

  • Senior Member
  • 1,261 posts

+86
Good

Posted 17 June 2020 - 20:40

SNR as dB

#!/bin/sh

# show SNR as dB
snr=`/usr/bin/wget -O - -q http://127.0.0.1/web/signal?AGC | /bin/grep snr | /usr/bin/cut -d '>' -f 2 | /usr/bin/cut -d '<' -f 1 | /usr/bin/cut -d 'B' -f 1 | /usr/bin/cut -d 'd' -f 1| /bin/sed '2d'`
echo $snr

SNR as percent

#!/bin/sh

# show SNR as %
snr=`/usr/bin/wget -O - -q http://127.0.0.1/web/signal?AGC | /bin/grep snr | /usr/bin/cut -d '>' -f 2 | /usr/bin/cut -d '%' -f 1 | /bin/sed '1d'`
echo $snr



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users