[dvblast-devel] [PATCH] * dvb.c, dvblast.[1ch]: Add support for uncommitted diseqc switch.

Zoran Turalija zoran.turalija at gmail.com
Thu Aug 9 09:43:26 CEST 2012


This supports configurations that use uncommitted diseqc switch
in front of committed diseqc switch to allow 8/16 satellites...

Example of such cascade:

    19.2E  13E    16E  1W      5E 28.2E  23.5E 30W
        \   |      |   |        \   |      |   /
         \1  \2  3/  4/          \1  \2  3/  4/
       +--o---o--o---o--+      +--o---o--o---o--+ LNB (-S n)
       | SPAUN SAR 411F |      | SPAUN SAR 411F |
       |    committed   |      |    committed   |
       +-----------o----+      +----o-----------+
                    \              /
                     \1          2/       sat:  switches:
       PORT (-k n) +--o----------o--+   19.2E:  -k 1 -S 1
                   | SPAUN SUR 211F |     13E:  -k 1 -S 2
                   |  uncommitted   |     16E:  -k 1 -S 3
                   +-------o--------+      1W:  -k 1 -S 4
                           |               5E:  -k 2 -S 1
                    +------o------+     28.2E:  -k 2 -S 2
                    | skystar HD2 |     23.5E:  -k 2 -S 3
                    +-------------+       30W:  -k 2 -S 4

Reception of 16 satellites is possible using eg. SPAUN SUR 420F as uncommitted
diseqc switch instead of SPAUN SUR 211F, and 2 more SPAUN SAR 411F committed
diseqc switches.
---
 dvb.c     |   39 +++++++++++++++++++++++++++++++++++++--
 dvblast.1 |    5 ++++-
 dvblast.c |   13 ++++++++++---
 dvblast.h |    1 +
 4 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/dvb.c b/dvb.c
index 36e4cd4..b0748ff 100644
--- a/dvb.c
+++ b/dvb.c
@@ -495,6 +495,17 @@ static int FrontendDoDiseqc(void)
          * specification is available from http://www.eutelsat.com/
          */
 
+        struct dvb_diseqc_master_cmd uncmd =
+            { {0xe0, 0x10, 0x39, 0xf0, 0x00, 0x00}, 4};
+
+        if ( i_uncommitted > 0 && i_uncommitted < 5 )
+        {
+           uncmd.msg[3] = 0xf0 /* reset bits */
+                             | ((i_uncommitted - 1) << 2)
+                             | (fe_voltage == SEC_VOLTAGE_13 ? 0 : 2)
+                             | (fe_tone == SEC_TONE_ON ? 1 : 0);
+        }
+
         struct dvb_diseqc_master_cmd cmd =
             { {0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4};
         cmd.msg[3] = 0xf0 /* reset bits */
@@ -502,6 +513,18 @@ static int FrontendDoDiseqc(void)
                           | (fe_voltage == SEC_VOLTAGE_13 ? 0 : 2)
                           | (fe_tone == SEC_TONE_ON ? 1 : 0);
 
+        if ( i_uncommitted > 0 && i_uncommitted < 5 )
+        {
+           if( ioctl( i_frontend, FE_DISEQC_SEND_MASTER_CMD, &uncmd ) < 0 )
+           {
+               msg_Err( NULL, "ioctl FE_SEND_MASTER_CMD failed (%s)",
+                        strerror(errno) );
+               exit(1);
+           }
+           /* Pause 125 ms between uncommitted & committed diseqc commands. */
+           msleep(125000);
+        }
+
         if( ioctl( i_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd ) < 0 )
         {
             msg_Err( NULL, "ioctl FE_SEND_MASTER_CMD failed (%s)",
@@ -511,6 +534,18 @@ static int FrontendDoDiseqc(void)
         msleep(100000); /* Should be 15 ms. */
 
         /* Do it again just to be sure. */
+        if ( i_uncommitted > 0 && i_uncommitted < 5 )
+        {
+           if( ioctl( i_frontend, FE_DISEQC_SEND_MASTER_CMD, &uncmd ) < 0 )
+           {
+               msg_Err( NULL, "ioctl FE_SEND_MASTER_CMD failed (%s)",
+                        strerror(errno) );
+               exit(1);
+           }
+           /* Pause 125 ms between uncommitted & committed diseqc commands. */
+           msleep(125000);
+        }
+
         if( ioctl( i_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd ) < 0 )
         {
             msg_Err( NULL, "ioctl FE_SEND_MASTER_CMD failed (%s)",
@@ -539,8 +574,8 @@ static int FrontendDoDiseqc(void)
 
     msleep(100000); /* ... */
 
-    msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x",
-             i_voltage, b_tone, i_satnum );
+    msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x uncommitted=%x",
+             i_voltage, b_tone, i_satnum, i_uncommitted );
     return bis_frequency;
 }
 
diff --git a/dvblast.1 b/dvblast.1
index e0bf8ee..1ed569c 100644
--- a/dvblast.1
+++ b/dvblast.1
@@ -4,7 +4,7 @@ DVBlast \- Simple and powerful dvb streaming application
 .SH SYNOPSIS
 .B dvblast
 [\fI-q\fR] [\fI-c <config_file>\fR] [\fI-r <remote_socket>\fR] [\fI-t <ttl>\fR] [\fI-o <SSRC_IP>\fR]
-[\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n <frontend_number>\fR] [\fI-S <diseqc>\fR]
+[\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n <frontend_number>\fR] [\fI-S <diseqc>\fR] [\fI-k <uncommitted port>\fR]
 [\fI-f <frequency>\fR] [\fI-D <src_host>[:<src_port>][[@<src_mcast>][:<port>]][/<opts>]\fR] [\fI-A <ASI_adapter>\fR]
 [\fI-s <symbol_rate>\fR] [\fI-v <0|13|18>\fR] [\fI-p\fR] [\fI-b <bandwidth>\fR] [\fI-I <inversion>\fR]
 [\fI-F <fec_inner>\fR] [\fI-m <modulation>\fR] [\fI-R <rolloff>\fR] [\fI-P <pilot>\fR] [\fI-K <fec_lp>\fR]
@@ -96,6 +96,9 @@ Character set used for printing messages (default UTF-8)
 \fB\-J\fR, \fB\-\-dvb-charset\fR <charset>
 Character set used in output DVB tables (default ISO_8859-1)
 .TP
+\fB\-k\fR, \fB\-\-uncommitted\fR <uncommitted port>
+Port number for uncommitted diseqc (0: no uncommitted diseqc, 1\-4)
+.TP
 \fB\-K\fR, \fB\-\-fec-lp\fR
 DVB-T low priority FEC (default auto)
 .TP
diff --git a/dvblast.c b/dvblast.c
index 549b174..6f99e5c 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -67,6 +67,7 @@ int i_srate = 27500000;
 int i_fec = 999;
 int i_rolloff = 35;
 int i_satnum = 0;
+int i_uncommitted = 0;
 int i_voltage = 13;
 int b_tone = 0;
 int i_bandwidth = 8;
@@ -437,7 +438,7 @@ void usage()
 {
     DisplayVersion();
     msg_Raw( NULL, "Usage: dvblast [-q] [-c <config file>] [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] "
-        "[-i <RT priority>] [-a <adapter>] [-n <frontend number>] [-S <diseqc>] "
+        "[-i <RT priority>] [-a <adapter>] [-n <frontend number>] [-S <diseqc>] [-k <uncommitted port>]"
         "[-f <frequency>|-D [<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*|-A <ASI adapter>] "
         "[-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-I <inversion>] "
         "[-F <fec inner>] [-m <modulation] [-R <rolloff>] [-P <pilot>] [-K <fec lp>] "
@@ -472,6 +473,7 @@ void usage()
     msg_Raw( NULL, "  -X --transmission     DVB-T transmission (2, 4, 8 or -1 auto, default)" );
     msg_Raw( NULL, "  -s --symbol-rate" );
     msg_Raw( NULL, "  -S --diseqc           satellite number for diseqc (0: no diseqc, 1-4, A or B)" );
+    msg_Raw( NULL, "  -k --uncommitted      port number for uncommitted diseqc (0: no uncommitted diseqc, 1-4)" );
     msg_Raw( NULL, "  -u --budget-mode      turn on budget mode (no hardware PID filtering)" );
     msg_Raw( NULL, "  -v --voltage          voltage to apply to the LNB (QPSK)" );
     msg_Raw( NULL, "  -w --select-pmts      set a PID filter on all PMTs" );
@@ -530,7 +532,7 @@ int main( int i_argc, char **pp_argv )
         usage();
 
     /*
-     * The only short options left are: ky0123456789
+     * The only short options left are: y0123456789
      * Use them wisely.
      */
     static const struct option long_options[] =
@@ -547,6 +549,7 @@ int main( int i_argc, char **pp_argv )
         { "rolloff",         required_argument, NULL, 'R' },
         { "symbol-rate",     required_argument, NULL, 's' },
         { "diseqc",          required_argument, NULL, 'S' },
+        { "uncommitted",     required_argument, NULL, 'k' },
         { "voltage",         required_argument, NULL, 'v' },
         { "force-pulse",     no_argument,       NULL, 'p' },
         { "bandwidth",       required_argument, NULL, 'b' },
@@ -588,7 +591,7 @@ int main( int i_argc, char **pp_argv )
         { 0, 0, 0, 0 }
     };
 
-    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:", long_options, NULL)) != -1 )
+    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:", long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -675,6 +678,10 @@ int main( int i_argc, char **pp_argv )
             i_satnum = strtol( optarg, NULL, 16 );
             break;
 
+        case 'k':
+            i_uncommitted = strtol( optarg, NULL, 16 );
+            break;
+
         case 'v':
             i_voltage = strtol( optarg, NULL, 0 );
             break;
diff --git a/dvblast.h b/dvblast.h
index bdcbaf5..752878b 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -155,6 +155,7 @@ extern int i_fenum;
 extern int i_frequency;
 extern int i_srate;
 extern int i_satnum;
+extern int i_uncommitted;
 extern int i_fec;
 extern int i_rolloff;
 extern int i_voltage;
-- 
1.7.5.4



More information about the dvblast-devel mailing list