[mythtv] [PATCH] for 10/1 diseqc switch

Marcus Metzler mocm at mocm.de
Tue Mar 29 18:30:19 UTC 2005


Hi,

here is a small patch against todays CVS for the 10 to 1 diseqc
switch.

Index: dvbdiseqc.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbdiseqc.cpp,v
retrieving revision 1.9
diff -u -r1.9 dvbdiseqc.cpp
--- dvbdiseqc.cpp	23 Jan 2005 22:45:30 -0000	1.9
+++ dvbdiseqc.cpp	29 Mar 2005 18:25:50 -0000
@@ -84,6 +84,10 @@
             if (!PositionerGotoAngular(tuning,reset,havetuned))
 		return false;
             break;
+        case 8: // v1.1 10 Way
+            if (!Diseqc1xSwitch_10way(tuning, reset, havetuned))
+                return false;
+            break;
  
         default:
             ERRNO("Unsupported DiSEqC type.");
@@ -318,6 +322,52 @@
     return true;
 }
 
+bool DVBDiSEqC::Diseqc1xSwitch_10way(dvb_tuning_t& tuning, bool reset, 
+                               bool& havetuned)
+{
+    if (reset) 
+    {
+      	if (!DiseqcReset()) 
+        {
+      	    ERRNO("DiseqcReset() failed");
+      	    return false;
+      	}
+    }
+
+    GENERAL(QString("DiSEqC 1.1 Switch - Port %1").arg(tuning.diseqc_port));
+
+    if ((prev_tuning.diseqc_port != tuning.diseqc_port ||
+        prev_tuning.tone != tuning.tone ||
+        prev_tuning.voltage != tuning.voltage) || reset)
+    {
+        if (tuning.diseqc_port > 9)
+        {
+            ERRNO("Supports only up to 10-way switches.");
+            return false;
+        }
+
+        dvb_diseqc_master_cmd cmd = 
+            {{CMD_FIRST, MASTER_TO_LSS, WRITE_N1, 0xf0, 0x00, 0x00}, 4};
+
+        cmd.msg[DATA_1] = 0xF0 
+		| (tuning.diseqc_port & 0x0F); 
+
+        if (!SendDiSEqCMessage(tuning,cmd)) 
+        {
+            ERRNO("Setting DiSEqC failed.\n");
+            return false;
+        }
+
+        prev_tuning.diseqc_port = tuning.diseqc_port;
+        prev_tuning.tone = tuning.tone;
+        prev_tuning.voltage = tuning.voltage;
+        havetuned = true;
+
+    }
+
+    return true;
+}
+
 bool DVBDiSEqC::Diseqc1xSwitch(dvb_tuning_t& tuning, bool reset, 
                                bool& havetuned)
 {
Index: dvbdiseqc.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbdiseqc.h,v
retrieving revision 1.3
diff -u -r1.3 dvbdiseqc.h
--- dvbdiseqc.h	11 Apr 2004 03:30:48 -0000	1.3
+++ dvbdiseqc.h	29 Mar 2005 18:25:50 -0000
@@ -38,6 +38,7 @@
     bool ToneVoltageLnb(dvb_tuning_t& tuning, bool reset, bool& havetuned);
     bool ToneSwitch(dvb_tuning_t& tuning, bool reset, bool& havetuned);
     bool Diseqc1xSwitch(dvb_tuning_t& tuning, bool reset, bool& havetuned);
+    bool Diseqc1xSwitch_10way(dvb_tuning_t& tuning, bool reset, bool& havetuned);
     bool PositionerGoto(dvb_tuning_t& tuning, bool reset, bool& havetuned);
     bool PositionerStore(dvb_tuning_t& tuning);
     bool PositionerStopMovement();
Index: videosource.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.cpp,v
retrieving revision 1.72
diff -u -r1.72 videosource.cpp
--- videosource.cpp	29 Mar 2005 05:59:00 -0000	1.72
+++ videosource.cpp	29 Mar 2005 18:26:23 -0000
@@ -825,6 +825,7 @@
         addSelection("DiSEqC v1.1 Switch (4-Way)","5");
         addSelection("DiSEqC v1.2 Positioner","6");
         addSelection("DiSEqC v1.3 Positioner (Goto X)","7");
+        addSelection("DiSEqC v1.1 or 2.1 (10-way method2)","8");
         setHelpText(QObject::tr("Select the input type for DVB-S cards. "
                     "Leave as Single LNB/Input for DVB-C or DVB-T. "
                     "The inputs are mapped from Input Connections option "
@@ -1767,6 +1768,28 @@
             for (int x=1;x<20;x++)
                 list.append ( DVBDiseqcInputList(QString("DiSEqC v1.3 Input %1").arg(x),QString(""),QString("%1").arg(x)));
             break;
+        case 8:
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  1"),
+                                           QString("0"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  2"),
+                                           QString("1"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  3"),
+                                           QString("2"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  4"),
+                                           QString("3"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  5"),
+                                           QString("4"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  6"),
+                                           QString("5"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  7"),
+                                           QString("6"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  8"),
+                                           QString("7"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input  9"),
+                                           QString("8"), QString("")));
+            list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input 10"),
+                                           QString("9"), QString("")));
+            break;
         default:
             list.append ( DVBDiseqcInputList(QString("DVBInput"),QString(""),QString("")));
     }
 


Marcus

-- 
/--------------------------------------------------------------------\
| Dr. Marcus O.C. Metzler        |                                   |
| mocm at metzlerbros.de            | http://www.metzlerbros.de/        |
\--------------------------------------------------------------------/
 |>>>             Quis custodiet ipsos custodies                 <<<|


More information about the mythtv-dev mailing list