]> git.pld-linux.org Git - packages/mythtv.git/blame - myth_legacy-switch_r10247.diff
- source tar.bz2 from 0.20 fix branch http://svn.mythtv.org/svn/branches/release...
[packages/mythtv.git] / myth_legacy-switch_r10247.diff
CommitLineData
b91fb912 1Index: libs/libmythtv/videosource.cpp
2===================================================================
3--- libs/libmythtv/videosource.cpp (revision 8614)
4+++ libs/libmythtv/videosource.cpp (working copy)
5@@ -1242,6 +1242,8 @@
6 addSelection("DiSEqC v1.2 Positioner","6");
7 addSelection("DiSEqC v1.3 Positioner (Goto X)","7");
8 addSelection("DiSEqC v1.1 or 2.1 (10-way method2)","8");
9+ addSelection("SW21 Switch","98");
10+ addSelection("SW64 Switch","99");
11 setHelpText(QObject::tr("Select the input type for DVB-S cards. "
12 "Leave as Single LNB/Input for DVB-C or DVB-T. "
13 "The inputs are mapped from Input Connections option "
14@@ -2404,6 +2406,8 @@
15 QString stxt = "DiSEqC Switch Input %1";
16 QString mtxt = "DiSEqC v1.2 Motor Position %1";
17 QString itxt = "DiSEqC v1.3 Input %1";
18+ QString l21txt = "SW21 Input %1";
19+ QString l64txt = "SW64 Input %1";
20
21 uint i;
22 switch (dvb_diseqc_type)
23@@ -2433,6 +2437,16 @@
24 list.append(DVBDiSEqCInputList(
25 stxt.arg(i+1,2), QString::number(i), ""));
26 break;
27+ case 98:
28+ for (i = 0; i < 2; ++i)
29+ list.append(DVBDiSEqCInputList(
30+ l21txt.arg(i+1,2), QString::number(i), ""));
31+ break;
32+ case 99:
33+ for (i = 0; i < 3; ++i)
34+ list.append(DVBDiSEqCInputList(
35+ l64txt.arg(i+1,2), QString::number(i), ""));
36+ break;
37 default:
38 list.append(DVBDiSEqCInputList(
39 QString("DVBInput"), QString(""), QString("")));
40Index: libs/libmythtv/dvbdiseqc.h
41===================================================================
42--- libs/libmythtv/dvbdiseqc.h (revision 8614)
43+++ libs/libmythtv/dvbdiseqc.h (working copy)
44@@ -37,6 +37,7 @@
45
46 bool ToneVoltageLnb(DVBTuning& tuning, bool reset, bool& havetuned);
47 bool ToneSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
48+ bool LegacyDishSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
49 bool Diseqc1xSwitch(DVBTuning& tuning, bool reset, bool& havetuned,
50 uint ports);
51 bool PositionerGoto(DVBTuning& tuning, bool reset, bool& havetuned);
52Index: libs/libmythtv/dvbdiseqc.cpp
53===================================================================
54--- libs/libmythtv/dvbdiseqc.cpp (revision 8614)
55+++ libs/libmythtv/dvbdiseqc.cpp (working copy)
56@@ -94,6 +94,11 @@
57 if (!Diseqc1xSwitch(tuning, reset, havetuned, 10))
58 return false;
59 break;
60+ case 98: // SW21
61+ case 99: // SW64
62+ if (!LegacyDishSwitch(tuning, reset, havetuned))
63+ return false;
64+ break;
65
66 default:
67 VERBOSE(VB_IMPORTANT, LOC_ERR + "Unsupported DiSEqC type("
68@@ -103,6 +108,69 @@
69 return true;
70 }
71
72+bool DVBDiSEqC::LegacyDishSwitch(DVBTuning& tuning, bool reset,
73+ bool& havetuned)
74+{
75+ if (reset)
76+ {
77+ //Do legacy switches need to be reset?
78+ }
79+ GENERAL(QString("Legacy Dish Switch - Port %1").arg(tuning.diseqc_port));
80+ if ((prev_tuning.diseqc_port != tuning.diseqc_port ||
81+ prev_tuning.tone != tuning.tone ||
82+ prev_tuning.voltage != tuning.voltage) || reset)
83+ {
84+
85+ uint8_t cmd = 0x00;
86+
87+ switch(tuning.diseqc_type) {
88+ //is there a pattern here?
89+ case 98: //SW21
90+ if(! tuning.diseqc_port)
91+ cmd=0x34;
92+ else
93+ cmd=0x65;
94+ break;
95+ case 99: //SW64
96+ if(tuning.diseqc_port == 0)
97+ if(tuning.voltage == SEC_VOLTAGE_13)
98+ cmd=0x39;
99+ else
100+ cmd=0x1A;
101+ else if(tuning.diseqc_port == 1)
102+ if(tuning.voltage == SEC_VOLTAGE_13)
103+ cmd=0x4B;
104+ else
105+ cmd=0x5C;
106+ else
107+ if(tuning.voltage == SEC_VOLTAGE_13)
108+ cmd=0x0D;
109+ else
110+ cmd=0x2E;
111+ break;
112+ }
113+ if(tuning.voltage == SEC_VOLTAGE_18)
114+ cmd|=0x80;
115+
116+#ifdef FE_DISHNETWORK_SEND_LEGACY_CMD
117+ if (ioctl(fd_frontend, FE_DISHNETWORK_SEND_LEGACY_CMD, cmd) <0)
118+ {
119+ ERRNO("Setup: Sending init command failed.");
120+ return false;
121+ }
122+#else
123+ VERBOSE(VB_IMPORTANT, "Kernel does not support Legacy Dish Switch!");
124+#endif
125+ usleep(DISEQC_SHORT_WAIT);
126+
127+ prev_tuning.diseqc_port = tuning.diseqc_port;
128+ prev_tuning.tone = tuning.tone;
129+ prev_tuning.voltage = tuning.voltage;
130+ havetuned = true;
131+ }
132+ return true;
133+}
134+
135 /*****************************************************************************
136 Backward Compatible Methods
137 ****************************************************************************/
This page took 0.042369 seconds and 4 git commands to generate.