[dvblast-devel] [PATCH 9/9] Add --lnb-type option to dvblast

Georgi Chorbadzhiyski gf at unixsol.org
Thu Jan 25 01:23:05 CET 2018


-------------- next part --------------
From db8cf1ea9447438757cb91e8b626dd201a2f44f0 Mon Sep 17 00:00:00 2001
From: Georgi Chorbadzhiyski <gf at unixsol.org>
Date: Sat, 13 Jan 2018 20:30:54 +0200
Subject: [PATCH 9/9] Add --lnb-type option to dvblast

Setting --lnb-type old-sky allows dvblast to work with some
Australian satellite services.
---
 NEWS      |  1 +
 dvb.c     | 93 ++++++++++++++++++++++++++++++++++++++++-----------------------
 dvblast.1 |  3 +++
 dvblast.c | 10 ++++++-
 dvblast.h |  1 +
 5 files changed, 73 insertions(+), 35 deletions(-)

diff --git a/NEWS b/NEWS
index 9b175fa..647e3f5 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Changes between 3.2 and -next
   * Switch default string charset to UTF-8//IGNORE
   * Add --system-charset/-j option to dvblastctl
   * Add --timeout/-t option to dvblastctl and set default to 15 seconds
+  * Add --lnb-type universal|old-sky option to dvblast
 
 Changes between 3.1 and 3.2:
 ----------------------------
diff --git a/dvb.c b/dvb.c
index e07cdc5..3dd9289 100644
--- a/dvb.c
+++ b/dvb.c
@@ -471,44 +471,69 @@ static int FrontendDoDiseqc(void)
 
     fe_tone = b_tone ? SEC_TONE_ON : SEC_TONE_OFF;
 
-    /* Automatic mode. */
-    if ( i_frequency >= 950000 && i_frequency <= 2150000 )
+    if ( strcmp( psz_lnb_type, "universal" ) == 0 )
     {
-        msg_Dbg( NULL, "frequency %d is in IF-band", i_frequency );
-        bis_frequency = i_frequency;
-    }
-    else if ( i_frequency >= 2500000 && i_frequency <= 2700000 )
-    {
-        msg_Dbg( NULL, "frequency %d is in S-band", i_frequency );
-        bis_frequency = 3650000 - i_frequency;
-    }
-    else if ( i_frequency >= 3400000 && i_frequency <= 4200000 )
-    {
-        msg_Dbg( NULL, "frequency %d is in C-band (lower)", i_frequency );
-        bis_frequency = 5150000 - i_frequency;
-    }
-    else if ( i_frequency >= 4500000 && i_frequency <= 4800000 )
-    {
-        msg_Dbg( NULL, "frequency %d is in C-band (higher)", i_frequency );
-        bis_frequency = 5950000 - i_frequency;
-    }
-    else if ( i_frequency >= 10700000 && i_frequency < 11700000 )
-    {
-        msg_Dbg( NULL, "frequency %d is in Ku-band (lower)",
-                 i_frequency );
-        bis_frequency = i_frequency - 9750000;
+        /* Automatic mode. */
+        if ( i_frequency >= 950000 && i_frequency <= 2150000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in IF-band", i_frequency );
+            bis_frequency = i_frequency;
+        }
+        else if ( i_frequency >= 2500000 && i_frequency <= 2700000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in S-band", i_frequency );
+            bis_frequency = 3650000 - i_frequency;
+        }
+        else if ( i_frequency >= 3400000 && i_frequency <= 4200000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in C-band (lower)", i_frequency );
+            bis_frequency = 5150000 - i_frequency;
+        }
+        else if ( i_frequency >= 4500000 && i_frequency <= 4800000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in C-band (higher)", i_frequency );
+            bis_frequency = 5950000 - i_frequency;
+        }
+        else if ( i_frequency >= 10700000 && i_frequency < 11700000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in Ku-band (lower)",
+                     i_frequency );
+            bis_frequency = i_frequency - 9750000;
+        }
+        else if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
+                     i_frequency );
+            bis_frequency = i_frequency - 10600000;
+            fe_tone = SEC_TONE_ON;
+        }
+        else
+        {
+            msg_Err( NULL, "frequency %d is out of any known band",
+                     i_frequency );
+            exit(1);
+        }
     }
-    else if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
+    else if ( strcmp( psz_lnb_type, "old-sky" ) == 0 )
     {
-        msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
-                 i_frequency );
-        bis_frequency = i_frequency - 10600000;
-        fe_tone = SEC_TONE_ON;
+         if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
+        {
+            msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
+                     i_frequency );
+            bis_frequency = i_frequency - 11300000;
+            fe_tone = SEC_TONE_ON;
+        }
+        else
+        {
+            msg_Err( NULL, "frequency %d is out of any known band",
+                     i_frequency );
+            exit(1);
+        }
     }
     else
     {
-        msg_Err( NULL, "frequency %d is out of any known band",
-                 i_frequency );
+        msg_Err( NULL, "lnb-type '%s' is not known. Valid type: universal old-sky",
+                 psz_lnb_type );
         exit(1);
     }
 
@@ -609,8 +634,8 @@ static int FrontendDoDiseqc(void)
 
     msleep(100000); /* ... */
 
-    msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x uncommitted=%x",
-             i_voltage, b_tone, i_satnum, i_uncommitted );
+    msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x uncommitted=%x lnb-type=%s bis_frequency=%d",
+             i_voltage, b_tone, i_satnum, i_uncommitted, psz_lnb_type, bis_frequency );
     return bis_frequency;
 }
 
diff --git a/dvblast.1 b/dvblast.1
index f9d8212..c8ff4bf 100644
--- a/dvblast.1
+++ b/dvblast.1
@@ -73,6 +73,9 @@ Frontend frequency. If '\-' is specified instead of a numeric value,
 the frontend will be not be tuned by dvblast and you should use external
 tuning tool (szap) to tune it.
 .TP
+\fB\-8\fR, \fB\-\-lnb\-type\fR universal\|old\-sky
+Choose LNB type. Default: 'universal' - Universal LNB ("Astra" LNB)
+.TP
 \fB\-F\fR, \fB\-\-fec\-inner\fR <FEC>
 Forward Error Correction used by satellite (FEC Inner)
 .br
diff --git a/dvblast.c b/dvblast.c
index 8424d05..eebb562 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -67,6 +67,7 @@ int i_fenum = 0;
 int i_canum = 0;
 char *psz_delsys = NULL;
 int i_frequency = 0;
+char *psz_lnb_type = "universal";
 int dvb_plp_id = 0;
 int i_inversion = -1;
 int i_srate = 27500000;
@@ -644,6 +645,8 @@ void usage()
     msg_Raw( NULL, "  -5 --delsys           delivery system" );
     msg_Raw( NULL, "    DVBS|DVBS2|DVBC_ANNEX_A|DVBT|DVBT2|ATSC|ISDBT|DVBC_ANNEX_B(ATSC-C/QAMB) (default guessed)");
     msg_Raw( NULL, "  -f --frequency        frontend frequency" );
+    msg_Raw( NULL, "  -8 --lnb-type <type>  Set LNB type')" );
+    msg_Raw( NULL, "        universal old-sky (default: universal)");
     msg_Raw( NULL, "  -9 --dvb-plp-id <number> Switch PLP of the DVB-T2 transmission (for Russia special)" );
     msg_Raw( NULL, "  -F --fec-inner        Forward Error Correction (FEC Inner)");
     msg_Raw( NULL, "    DVB-S2 0|12|23|34|35|56|78|89|910|999 (default auto: 999)");
@@ -730,7 +733,7 @@ int main( int i_argc, char **pp_argv )
         usage();
 
     /*
-     * The only short options left are: 48
+     * The only short options left are: 4
      * Use them wisely.
      */
     static const struct option long_options[] =
@@ -745,6 +748,7 @@ int main( int i_argc, char **pp_argv )
         { "delsys",          required_argument, NULL, '5' },
         { "dvb-plp-id",      required_argument, NULL, '9' },
         { "frequency",       required_argument, NULL, 'f' },
+        { "lnb-type",        required_argument, NULL, '8' },
         { "fec-inner",       required_argument, NULL, 'F' },
         { "rolloff",         required_argument, NULL, 'R' },
         { "symbol-rate",     required_argument, NULL, 's' },
@@ -890,6 +894,10 @@ int main( int i_argc, char **pp_argv )
 #endif
             break;
 
+        case '8':
+            psz_lnb_type = optarg;
+            break;
+
         case 'F':
             i_fec = strtol( optarg, NULL, 0 );
             break;
diff --git a/dvblast.h b/dvblast.h
index 8434880..0c5218c 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -221,6 +221,7 @@ extern int i_canum;
 extern char *psz_delsys;
 extern int i_dvr_buffer_size;
 extern int i_frequency;
+extern char *psz_lnb_type;
 extern int i_srate;
 extern int i_satnum;
 extern int i_uncommitted;
-- 
2.16.0



More information about the dvblast-devel mailing list