[vlc-devel] [PATCH] dtv multisat: Add support for uncommitted diseqc switch.

Zoran Turalija zoran.turalija at gmail.com
Fri Aug 10 20:34:42 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 (:dvb-satno n)
         | SPAUN SAR 411F |      | SPAUN SAR 411F |
         |    committed   |      |    committed   |
         +-----------o----+      +----o-----------+
                      \              /
                       \1          2/     sat:  switches:
         PORT        +--o----------o--+ 19.2E:  :dvb-uncommitted=1 :dvb-satno=1
(:dvb-uncommitted=n) | SPAUN SUR 211F |   13E:  :dvb-uncommitted=1 :dvb-satno=2
                     |  uncommitted   |   16E:  :dvb-uncommitted=1 :dvb-satno=3
                     +-------o--------+    1W:  :dvb-uncommitted=1 :dvb-satno=4
                             |             5E:  :dvb-uncommitted=2 :dvb-satno=1
                      +------o------+   28.2E:  :dvb-uncommitted=2 :dvb-satno=2
                      | skystar HD2 |   23.5E:  :dvb-uncommitted=2 :dvb-satno=3
                      +-------------+     30W:  :dvb-uncommitted=2 :dvb-satno=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.
---
 modules/access/dtv/access.c |   15 +++++++++++++++
 modules/access/dtv/linux.c  |   43 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/modules/access/dtv/access.c b/modules/access/dtv/access.c
index 93b8ee1..b02eb37 100644
--- a/modules/access/dtv/access.c
+++ b/modules/access/dtv/access.c
@@ -206,6 +206,19 @@ static const char *const satno_user[] = { N_("Unspecified"),
     "A/1", "B/2", "C/3", "D/4" };
 #endif
 
+#define UNCOMMITTED_TEXT N_("Uncommitted DiSEqC LNB number")
+#define UNCOMMITTED_LONGTEXT N_( \
+    "If the satellite receiver is connected to multiple " \
+    "low noise block-downconverters (LNB) through a cascade formed from " \
+    "DiSEqC 1.1 uncommitted switch and DiSEqC 1.0 committed switch, " \
+    "the correct uncommitted LNB can be selected (1 to 4). " \
+    "If there is no uncommitted switch, this parameter should be 0.")
+#ifdef __linux__
+static const int uncommitted_vlc[] = { 0, 1, 2, 3, 4 };
+static const char *const uncommitted_user[] = { N_("Unspecified"),
+    "A/1", "B/2", "C/3", "D/4" };
+#endif
+
 /* BDA module additional DVB-S Parameters */
 #define NETID_TEXT N_("Network identifier")
 #define AZIMUTH_TEXT N_("Satellite azimuth")
@@ -388,6 +401,8 @@ vlc_module_begin ()
 #ifdef __linux__
     add_integer ("dvb-satno", 0, SATNO_TEXT, SATNO_LONGTEXT, true)
         change_integer_list (satno_vlc, satno_user)
+    add_integer ("dvb-uncommitted", 0, UNCOMMITTED_TEXT, UNCOMMITTED_LONGTEXT, true)
+        change_integer_list (uncommitted_vlc, uncommitted_user)
     add_integer ("dvb-tone", -1, TONE_TEXT, TONE_LONGTEXT, true)
         change_integer_list (auto_off_on_vlc, auto_off_on_user)
 #endif
diff --git a/modules/access/dtv/linux.c b/modules/access/dtv/linux.c
index b0b88be..acb9f88 100644
--- a/modules/access/dtv/linux.c
+++ b/modules/access/dtv/linux.c
@@ -772,21 +772,60 @@ known:
     unsigned satno = var_InheritInteger (d->obj, "dvb-satno");
     if (satno > 0)
     {
-        /* DiSEqC 1.0 */
 #undef msleep /* we know what we are doing! */
+
+        /* DiSEqC Bus Specification:
+ http://www.eutelsat.com/satellites/pdf/Diseqc/Reference%20docs/bus_spec.pdf */
+
+        /* DiSEqC 1.1 */
+        struct dvb_diseqc_master_cmd uncmd;
+
+        /* DiSEqC 1.0 */
         struct dvb_diseqc_master_cmd cmd;
 
+        unsigned uncommitted = var_InheritInteger (d->obj, "dvb-uncommitted");
+        if (uncommitted > 0)
+        {
+          uncommitted = (uncommitted - 1) & 3;
+          uncmd.msg[0] = 0xE0; /* framing: master, no reply, 1st TX */
+          uncmd.msg[1] = 0x10; /* address: all LNB/switch */
+          uncmd.msg[2] = 0x39; /* command: Write Port Group 1 (uncommitted) */
+          uncmd.msg[3] = 0xF0  /* data[0]: clear all bits */
+                       | (uncommitted << 2) /* LNB (A, B, C or D) */
+                       | ((voltage == SEC_VOLTAGE_18) << 1) /* polarization */
+                       | (tone == SEC_TONE_ON); /* option */
+          uncmd.msg[4] = uncmd.msg[5] = 0; /* unused */
+          uncmd.msg_len = 4; /* length*/
+        }
+
         satno = (satno - 1) & 3;
         cmd.msg[0] = 0xE0; /* framing: master, no reply, 1st TX */
         cmd.msg[1] = 0x10; /* address: all LNB/switch */
-        cmd.msg[2] = 0x38; /* command: Write Port Group 0 */
+        cmd.msg[2] = 0x38; /* command: Write Port Group 0 (committed) */
         cmd.msg[3] = 0xF0  /* data[0]: clear all bits */
                    | (satno << 2) /* LNB (A, B, C or D) */
                    | ((voltage == SEC_VOLTAGE_18) << 1) /* polarization */
                    | (tone == SEC_TONE_ON); /* option */
         cmd.msg[4] = cmd.msg[5] = 0; /* unused */
         cmd.msg_len = 4; /* length*/
+
         msleep (15000); /* wait 15 ms before DiSEqC command */
+        if (uncommitted > 0)
+        {
+          if (ioctl (d->frontend, FE_DISEQC_SEND_MASTER_CMD, &uncmd) < 0)
+          {
+              msg_Err (d->obj, "cannot send DiSEqC command: %m");
+              return -1;
+          }
+          /* Repeat uncommitted command */
+          uncmd.msg[0] = 0xE1; /* framing: master, no reply, repeated TX */
+          if (ioctl (d->frontend, FE_DISEQC_SEND_MASTER_CMD, &uncmd) < 0)
+          {
+              msg_Err (d->obj, "cannot send DiSEqC command: %m");
+              return -1;
+          }
+          msleep(125000); /* wait 125 ms before committed DiSEqC command */
+        }
         if (ioctl (d->frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) < 0)
         {
             msg_Err (d->obj, "cannot send DiSEqC command: %m");
-- 
1.7.5.4




More information about the vlc-devel mailing list