SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-12-2016, 02:40 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
DVB-S2 Scanning and tuning

I've made some changes in this pull request to enable DVB-S scanning and DVB-S2 tuning on 64-bit Linux.

I would be grateful for any review, comments or help from anyone who is familiar with the DVBCapture library. I can only test this on the hardware I have (A Hauppauge NOVA-HD-S2 card, on which I have it working), but it would be better if it could be tested on more hardware.

It's my aim to get the open-source SageTV working on 64-bit Linux to the same functionality as I had on 32-bit Windows XP with my DVB cards. So far it's the DVB-S(2) tuning and config which has been problematic.

Many thanks,

echoes
Reply With Quote
  #2  
Old 04-12-2016, 03:23 PM
wubdich's Avatar
wubdich wubdich is offline
Sage Advanced User
 
Join Date: Sep 2009
Location: Germany
Posts: 235
Quote:
Originally Posted by echoes View Post
[..]It's my aim to get the open-source SageTV working on 64-bit Linux to the same functionality as I had on 32-bit Windows XP with my DVB cards.[..]
I will switch to Linux as soon as Satellite Channel Routing / Single Cable Distribution (SCR/CSS CENELEC EN50494) is available. I talked to DigitalDevices, then company building my DVB-S2 card, because on Windows SCR support is done by device driver. Unfortunately they told me on linux application software has to take care by itself.
Reply With Quote
  #3  
Old 04-12-2016, 04:49 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
Quote:
Originally Posted by wubdich View Post
I will switch to Linux as soon as Satellite Channel Routing / Single Cable Distribution (SCR/CSS CENELEC EN50494) is available. I talked to DigitalDevices, then company building my DVB-S2 card, because on Windows SCR support is done by device driver. Unfortunately they told me on linux application software has to take care by itself.
At first glance that might be feasible (for someone else to implement )provided that DiSeqC is used to select the transponder. I did come across this:
Code:
int  SageGetSatelliteTble( void* Capture, SAT_NAME *sat_name, int max_sat )
{
    //it's for DiSeqC, to be implemented soon.
	return 0;
}
Reply With Quote
  #4  
Old 04-12-2016, 04:55 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
LNB config file

I noticed that the following file is written holding my LNB configuration:
Code:
Digital-Conexant-CX24116-CX24118-0000-06-05-2-0.lnb
But the DVBCapture library code is looking for adapter0.cfg

As a workaround I used a soft link. Anyone know what is the 'correct' file name?

echoes
Reply With Quote
  #5  
Old 04-13-2016, 12:21 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Quote:
Originally Posted by echoes View Post
I noticed that the following file is written holding my LNB configuration:
Code:
Digital-Conexant-CX24116-CX24118-0000-06-05-2-0.lnb
But the DVBCapture library code is looking for adapter0.cfg

As a workaround I used a soft link. Anyone know what is the 'correct' file name?

echoes
This sounds very familiar. At one point we were using the linux video device name (adapter0) for storing configuration information like this. Then we modified things to use the actual device name (Digital-Conexant...) so they were more stable when devices were added/removed. Apparently that never got modified for the DVB code though.

However, that .lnb file looks like it was written by the Windows software because nothing in the Linux code will write out a .lnb file (but it's there in the Windows code). On Linux, it only reads the .cfg file instead. And I'm not sure if both of them store the same kind of information or not.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #6  
Old 04-13-2016, 05:57 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
I found that the STV XML file determines the lnb filename, and configures a regexp replace on troublesome characters (replacing them with '-').

The .lnb file name was definitely produced by SageTV on Linux.

The .frq files use the 'adapterX-DVB-[C|T|S].frq pattern.

There is some code to copy the lnb file to the 'adapterX-X.lnb (bear with me) pattern whenever an encoder is opened in sage.DVBCaptureDevice.startEncoding)

Now the native c code is trying to open adapterX.cfg, so I've made a couple of changes (that you might see in a pull request soon):
1) Use the same regex replacement to find the .lnb file that the Java code wrote.
2) If found, copy the .lnb file to 'adapterX.cfg' and not 'adapterX-X.lnb'

I'm unsure if the file formats of the .lnb and .cfg are exactly the same, but on my system this now works - the contents of the .cfg file are successfully used to determine the Intermediate Frequencies for the native DVB-S tune. So that's OK!

Are the native .cfg files used for any other purposes other than supplying LNB info?

Thanks for your help!

Since code is worth a thousand words...
Before:
Code:
  public void startEncoding(CaptureDeviceInput cdi, String encodeFile, String channel) throws EncodingException
  {
    if (Sage.DBG) System.out.println("startEncoding for DVB capture device file=" + encodeFile + " chan=" + channel);

    // Rename the .lnb file properly if its been set
    java.io.File lnbFile = new java.io.File(captureDeviceName + "-" + captureDeviceNum + ".lnb");
    if (lnbFile.isFile())
    {
      java.io.File targetFile = new java.io.File(new java.io.File(linuxVideoDevice).getName() + "-" + captureDeviceNum + ".lnb");
      if (Sage.DBG) System.out.println("Copying LNB file to device specific name from " + lnbFile + " to " + targetFile);
      try
      {
        IOUtils.copyFile(lnbFile, targetFile);
      }
      catch (java.io.IOException ioe)
      {
        if (Sage.DBG) System.out.println("ERROR Failed copying LNB file for video device of:" + ioe);
      }
    }
    ...
After:
Code:
  public void startEncoding(CaptureDeviceInput cdi, String encodeFile, String channel) throws EncodingException
  {
    if (Sage.DBG) System.out.println("startEncoding for DVB capture device file=" + encodeFile + " chan=" + channel);

    // Rename the .lnb file properly if its been set
    String lnbFilename = (captureDeviceName + "-" + captureDeviceNum).replaceAll("[^A-Za-z0-9_-]", "-") + ".lnb";
    File lnbFile = new java.io.File(lnbFilename);
    if (lnbFile.isFile())
    {
      //java.io.File targetFile = new java.io.File(new java.io.File(linuxVideoDevice).getName() + "-" + captureDeviceNum + ".lnb");
      File targetFile = new File(new File(linuxVideoDevice).getName() + ".cfg");
      if (Sage.DBG) System.out.println("Copying LNB file to device specific name from " + lnbFile + " to " + targetFile);
      try
      {
        IOUtils.copyFile(lnbFile, targetFile);
      }
      catch (java.io.IOException ioe)
      {
        if (Sage.DBG) System.out.println("ERROR Failed copying LNB file for video device of:" + ioe);
      }
    }

Last edited by echoes; 04-13-2016 at 06:04 PM. Reason: Added code
Reply With Quote
  #7  
Old 04-14-2016, 01:18 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Lol...yeah, I forgot to look at the Java and STV code...I forgot we did stuff to modify those files in there too.

I really don't know what we had in the .cfg or the .lnb files...that was written by Qian, not myself. I'll send him an email and ask him if he remembers.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #8  
Old 04-14-2016, 02:01 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
That's appreciated!

Yeah, that file name took some finding with some increasingly desperate grepping...
Reply With Quote
  #9  
Old 04-18-2016, 11:34 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
This was the answer I got, hopefully this helps:

a .cfg file is a configuration file that is given to a satellite LNB device to scan DVB-s channel by iterating directions and channel frequencies.

a .lnb file has LNB data that are used to control LNB device to pick up a direction to lock up a frequency.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #10  
Old 04-18-2016, 12:32 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
That's good to know. Looks like it just needed consistent naming in the java, stv and native code. I'll submit a pull request soon.
Many thanks.
Reply With Quote
  #11  
Old 05-18-2016, 07:08 AM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
Update: I've tested this with another DVB-S2 tuner card: DVBSky S952 V3 with no problems.

I've had some trouble with a DVB-S channel scan on Linux64. I will be trying to get this working in the near future. I'm wondering if anyone else has been able to channel scan DVB-S(2) using Sage 9.x on Linux-64 successfully?

A couple of scanning questions:
1) Does the channel scanner use the NIT table to generate tuning information?
2) Are these modulation value mappings correct and consistent:
30 = DVB-S2, QPSK
31 = DVB-S2, QPSK
32 = DVB-S2, 8PSK

I can see some use of '30' being used for either 8PSK or QPSK, depending on where I look. e.g. line 485 of DVBPSIParser.c (UnpackNIT) assigns '30' for 8PSK/DVB-S2.
Reply With Quote
  #12  
Old 05-18-2016, 11:37 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Sorry, don't know those answers....I'm sure you've already used grep to try to figure out more, that's what I'd be doing. If you really get stuck, let me know and I'll ping the dev that wrote that code to see if he recalls how it works...but I try not to bother him too much.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #13  
Old 05-18-2016, 01:09 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
No worries! I'll have a play with it and see what I can figure out.

Rich.
Reply With Quote
  #14  
Old 05-23-2016, 03:09 AM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
Been playing around with the DVB-S scan and discovered the following issues:
1) Could not get a scan to start unless the mmc/dvbs_region property was set (in my case to "Astra (28.2)"). I couldn't find anywhere where this property was set in code or STV. I think this property should be more properly picked up from the .lnb / .cfg file though.
2) The scan does use the NIT information to determine the subsequent tuning frequencies.
3) On first look, the DVB-S/S2 and modulation bits in the NIT descriptors are not being interpreted correctly. More investigation needed here.

Just an update for now.

Rich
Reply With Quote
  #15  
Old 05-23-2016, 11:45 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
It looks like we have code in the STV for setting the region for DVBT and DVBC...but apparently not for DVBS. I'm not sure why it was done that way....
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #16  
Old 05-23-2016, 12:58 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
I'm guessing that the region may have multiple values in case of a diseqc setup. In which case the region, along with the rest of the LNB config would be in sections of the the lnb/cfg file for that adapter. It always worked for me on Windows with v7. Perhaps the Windows native code does things a bit differently. More things to check...

R
Reply With Quote
  #17  
Old 05-23-2016, 04:23 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
Some progress
Have got the DVBPSIParser to correctly read the modulation type and modulation system bits, as defined in the DVB BlueBook A038 Oct 2015 (a thoroughly riveting bedtime read) and map them to the integer values which Sage uses for tuning:
DVB-S:
1 (16QAM), 20 (QPSK), 22 (8PSK)
DVB-S2:
31 (QPSK), 32 (8PSK)

The tuneDVBSFrequency function then maps these values to the required API constants.

I've got this to do a full channel scan, and all the expected DVB-S and DVB-S2 entries in the NIT were scanned and tested - so now I have a complete, SageV9-produced DVBS frq file for the first time. I assume a DVB-S only card will just refuse to tune a DVB-S2 tuning entry - but that would seem natural.

Next I'll investigate the DVB-S region setting and see how that should be read. But that's for another day.

R

Last edited by echoes; 05-23-2016 at 04:30 PM.
Reply With Quote
  #18  
Old 05-24-2016, 11:16 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Great work!
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #19  
Old 08-31-2017, 12:20 PM
starfire starfire is offline
Sage Expert
 
Join Date: Mar 2008
Location: England, UK
Posts: 505
Just found this thread, thanks for the work on this - I've been trying to get my TBS 8921 working, see https://forums.sagetv.com/forums/showthread.php?t=64961

After setting mmc/dvbs_region to "Astra (28.2)" I could get sage to actually start a scan but it immediately crashes

./startsagecore: line 55: 114 Aborted java -Djava.awt.headless=$HEADLESS $JAVAMEM -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=25 -XX:GCTimeRatio=24 $(if [[ $EUID -eq 0 ]]; then echo '-XX:ThreadPriorityPolicy=1'; fi) $JAVAOPTS -cp Sage.jar:JARs/lucene-core-3.6.0.jar:/:$(echo JARs/*.jar | sed 's/ */:/g') sage.Sage 0 0 x "sagetv Sage.properties" 0>&-

Cannot see any dump file or useful data in native.log or sagetv_0.txt to help me debug it any further.
__________________
2 X HD300, 2 X HD100 & KVM unRAID Host with SageTV Docker using TBS 6285 Quad DVB-T2 & TBS 6984 Quad DVB-S2 Tuners
Reply With Quote
  #20  
Old 08-31-2017, 01:09 PM
echoes echoes is offline
Sage User
 
Join Date: Aug 2008
Location: Guildford, UK
Posts: 27
Hi starfire,

This sounds familiar. I remember encountering something like this, and I did manage to fix it, but with the day job taking over, I didn't get round to committing the code. From memory, the scan terminated immediately, but didn't terminate the process, but details are hazy. I'll see if my fix will merge into the code as soon as I get a chance.

Echoes
Reply With Quote
Reply

Tags
dvb-s, dvb-s2


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
hdhr3 tuning and sagetv tuning granto Hardware Support 2 09-06-2011 09:06 AM
6.5.3 and QAM scanning SageGk SageTV Beta Test Software 3 12-13-2008 11:02 AM
DVB-S Scanning problem Bacon2002 Hardware Support 0 01-29-2008 03:09 PM
4.1.8 / DVB-T and scanning antplugger SageTV Beta Test Software 6 02-25-2006 10:18 PM
Scanning/Scrolling KeDruff SageTV Beta Test Software 1 02-07-2004 09:57 PM


All times are GMT -6. The time now is 05:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.