All pastes #33555 Raw Edit

Miscellany

public text v1 · immutable
#33555 ·published 2005-12-13 19:42 UTC
rendered paste body
diff -u -r --exclude=.svn mythtv-svn-backup-09152005/mythtv/libs/libmythtv/dvbdiseqc.cpp mythtv/libs/libmythtv/dvbdiseqc.cpp
--- mythtv-svn-backup-09152005/mythtv/libs/libmythtv/dvbdiseqc.cpp	2005-09-15 14:41:03.000000000 -0700
+++ mythtv/libs/libmythtv/dvbdiseqc.cpp	2005-09-16 17:08:31.000000000 -0700
@@ -88,7 +88,12 @@
             if (!Diseqc1xSwitch_10way(tuning, reset, havetuned))
                 return false;
             break;
- 
+        case 9: // SW21
+        case 10: // SW64
+            if (!LegacyDishSwitch(tuning, reset, havetuned))
+                return false;
+             break;
+
         default:
             ERRNO("Unsupported DiSEqC type.");
     }
@@ -96,6 +101,64 @@
     return true;
 }
 
+bool DVBDiSEqC::LegacyDishSwitch(DVBTuning& tuning, bool reset,
+				 bool& havetuned)
+{
+    if (reset) 
+    {
+      //Do legacy switches need to be reset?
+    }
+    GENERAL(QString("Legacy Dish 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)
+    {
+	dvb_diseqc_master_cmd cmd = 
+	    {{0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, 3};
+
+	switch(tuning.diseqc_type) {
+	    //is there a pattern here?
+	    case 9: //SW21
+		if(! tuning.diseqc_port) 
+		    cmd.msg[2]=0x34;
+		else
+		    cmd.msg[2]=0x65;
+		break;
+	    case 10: //SW64
+		if(tuning.diseqc_port == 0)
+		    if(tuning.voltage == SEC_VOLTAGE_13) 
+			cmd.msg[2]=0x39;
+		    else
+			cmd.msg[2]=0x1A;
+		else if(tuning.diseqc_port == 1)
+		    if(tuning.voltage == SEC_VOLTAGE_13)
+			cmd.msg[2]=0x4B;
+		    else
+			cmd.msg[2]=0x5C;
+		else
+		    if(tuning.voltage == SEC_VOLTAGE_13)
+			cmd.msg[2]=0x0D;
+		    else
+			cmd.msg[2]=0x2E;
+		break;
+	}
+	if(tuning.voltage == SEC_VOLTAGE_18)
+	    cmd.msg[2]|=0x80;
+	if (ioctl(fd_frontend, FE_DISHNETWORK_SEND_LEGACY_CMD, cmd.msg[2]) <0)
+	{
+	    ERRNO("Setup: Sending init command failed.");
+	    return false;
+	}
+	usleep(DISEQC_SHORT_WAIT);
+
+	prev_tuning.diseqc_port = tuning.diseqc_port;
+	prev_tuning.tone = tuning.tone;
+	prev_tuning.voltage = tuning.voltage;
+	havetuned = true;
+    }
+    return true;
+}
+
 /*****************************************************************************
                         Backward Compatible Methods
  ****************************************************************************/
diff -u -r --exclude=.svn mythtv-svn-backup-09152005/mythtv/libs/libmythtv/dvbdiseqc.h mythtv/libs/libmythtv/dvbdiseqc.h
--- mythtv-svn-backup-09152005/mythtv/libs/libmythtv/dvbdiseqc.h	2005-09-15 14:41:03.000000000 -0700
+++ mythtv/libs/libmythtv/dvbdiseqc.h	2005-09-16 17:09:10.000000000 -0700
@@ -37,6 +37,7 @@
     
     bool ToneVoltageLnb(DVBTuning& tuning, bool reset, bool& havetuned);
     bool ToneSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
+    bool LegacyDishSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
     bool Diseqc1xSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
     bool Diseqc1xSwitch_10way(DVBTuning& tuning, bool reset, bool& havetuned);
     bool PositionerGoto(DVBTuning& tuning, bool reset, bool& havetuned);
diff -u -r --exclude=.svn mythtv-svn-backup-09152005/mythtv/libs/libmythtv/videosource.cpp mythtv/libs/libmythtv/videosource.cpp
--- mythtv-svn-backup-09152005/mythtv/libs/libmythtv/videosource.cpp	2005-09-15 14:41:03.000000000 -0700
+++ mythtv/libs/libmythtv/videosource.cpp	2005-09-16 17:23:08.000000000 -0700
@@ -1121,6 +1121,8 @@
         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");
+        addSelection("SW21 Switch","9");
+        addSelection("SW64 Switch","10");
         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 "
@@ -2193,6 +2195,20 @@
             list.append(DVBDiseqcInputList(QString("DiSEqC Switch Input 10"),
                                            QString("9"), QString("")));
             break;
+        case 9:
+            list.append(DVBDiseqcInputList(QString("SW21 Input 1"),
+                                           QString("0"), QString("")));
+            list.append(DVBDiseqcInputList(QString("SW21 Input 2"),
+                                           QString("1"), QString("")));
+            break;
+        case 10:
+            list.append(DVBDiseqcInputList(QString("SW64 Input 1"),
+                                           QString("0"), QString("")));
+            list.append(DVBDiseqcInputList(QString("SW64 Input 2"),
+                                           QString("1"), QString("")));
+            list.append(DVBDiseqcInputList(QString("SW64 Input 3"),
+                                           QString("2"), QString("")));
+            break;
         default:
             list.append(DVBDiseqcInputList(
                             QString("DVBInput"), QString(""), QString("")));